Skip to content

parsers: extract the triplicated sink + timestamp layer into go/internal #33

Description

@armcconnell

Raised by @juan-malbeclabs in review of #29 (thread), and noted in that PR body as a known tradeoff.

Problem

As of #29 these four files are byte-identical across three modules — topofbook-parser, marketbyorder-parser, marketbyprice-parser:

  • sink_json.go
  • sink_socket.go
  • timestamp_linux.go
  • timestamp_other.go

A bug in the socket sink now needs three separate fixes. sink_socket.go is the concerning one: it carries the non-trivial slow-client drop logic and the mutex-held-across-sends reasoning that keeps Close from racing a send.

Fix

Lift them into go/internal, which is already a workspace member consumed by kernel-receiver and xdp-receiver, so there is precedent and no new dependency shape.

Note the OutputSink interface is currently defined per module over each module's own Record type, so the extraction needs a decision on that boundary first — either a shared Record, or the sink taking an interface / pre-serialized lines. Worth settling before the fourth feed lands.

Standalone-per-feed is the established convention and the reason the duplication exists; this is not a call to abandon it wholesale, just to share the transport layer that has no feed-specific content.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions