edge: add feed runner, manager, HTTP API, and CLI#3524
Draft
armcconnell wants to merge 1 commit intoedge/2-sinksfrom
Draft
edge: add feed runner, manager, HTTP API, and CLI#3524armcconnell wants to merge 1 commit intoedge/2-sinksfrom
armcconnell wants to merge 1 commit intoedge/2-sinksfrom
Conversation
Wires the parser and sinks into the doublezerod daemon so operators can actually enable a feed. This is the commit where the edge feature turns on end-to-end. Runner owns one feed: two multicast listener goroutines (marketdata on one UDP port, refdata on another), a parser, a sink, and a small set of atomic counters. Each listener joins the multicast group, reads frames in a loop, hands them to the parser, and forwards any produced records to the sink. A periodic goroutine logs a summary every 30s so operators can see liveness without polling the API. Manager owns many runners keyed by code. Enable(cfg) validates the config (required ports, both must differ, resolver + subscription checks, parser/sink factories), constructs a runner, starts it with a long-lived context owned by the manager, and stores it. Disable(code) and Close() cancel the runner context and release the sink. HTTP endpoints ServeEnable / ServeDisable / ServeStatus are thin wrappers over those methods and expose them on the existing doublezerod Unix socket API. Critically, Enable takes no ctx from the caller — the runner's lifetime is owned by the manager, not by the HTTP request, so the request finishing does not tear down the feed. On the operator side, adds `doublezero edge enable/disable/status` subcommands to the Rust CLI, communicating with doublezerod over its Unix socket. The enable command takes --code, --parser, --format, --output, --marketdata-port, and --refdata-port. Status supports --json for machine-readable output. runtime/run.go wires up the manager: resolves multicast group codes to IPs via the existing serviceability reader and routes subscription checks through the existing user manager, so the edge feature automatically respects onchain allowlists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3 of 4 — edge feed parser stack
Draft until the prior two land. This is the PR where the edge feature turns on — after it merges, operators can call `doublezero edge enable` and a feed will actually flow.
Summary
Testing Verification
Size note
~625 production lines across Go + Rust, slightly above the ~500-line target. The unit is cohesive (runner lifecycle + HTTP surface + CLI binding) and splitting further would leave intermediate states where the feature compiles but can't be invoked end-to-end.