Repository navigation
stream: cross-node bridge — frames cross node-to-node (Phase 10, PR9 — capstone) - #612
Merged
Merged
Conversation
…ase 10, PR9)
The capstone. The control plane (PR1-5) lets a peer DISCOVER a stream;
the data-plane transport (PR6-8) carries frame bytes over gRPC. PR9 ties
them together so a stream produced on one node is consumed on another.
New cvc::ariadne::stream::stream_bridge (ariadne layer; maps a
cvc::ariadne::stream::frame to/from the transport envelope — payload is
the frame bytes, seq/pts ride along, the format comes from the replicated
descriptor and is not re-sent per frame):
- serve(local, consumer_endpoint): the PRODUCER opens a StreamChannel to
the consumer and pushes local's frames — a pusher subscribes to
local.channel() (ring, drop-oldest under overload) and send()s each
frame (chunked by the transport) until the stream closes or the
consumer disconnects.
- receive_into(stream_id, proxy): the CONSUMER routes inbound frames for
stream_id into a local proxy stream via publish_external, so its local
consumers observe them like any local stream. The transport sink is a
shared router so a frame delivered after the bridge is destroyed hits a
live object, not a dangling this.
Roles vs the original plan: to reuse the PR7/8 transport unchanged, the
CONSUMER runs the gRPC server and the PRODUCER is the client that pushes.
Wiring the consumer's endpoint via a sendMessage offer/answer handshake
(so merely discovering the descriptor auto-serves a consumer) is the thin
next layer on this bridge; the conventional producer-serves-a-port model
needs a transport server-push path. Both noted as follow-ups; v1 proves
frames cross with the least new code.
Transport: add stream_transport_grpc::set_server_echo(bool) (default ON,
preserving the PR7/8 round-trip tests). The bridge turns it OFF: a one-way
push never reads echoes, and an unread echo would fill gRPC flow control
and deadlock the sender (found + fixed while bringing up the capstone).
Test stream_bridge_test.FramesCrossNodeToNode: 5 frames published into a
stream on app A arrive byte-identical and in order in a proxy stream on
app B, over the gRPC data plane. The PR7/8 transport tests (4) and the
control-plane grpc test (21) stay green.
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.
Cross-node streaming critical path — PR9 of 9 — 🎯 the capstone: frames cross node-to-node
Based on master (PR1–8 merged). The control plane (PR1–5) lets a peer discover a stream; the data-plane transport (PR6–8) carries frame bytes over gRPC. PR9 ties them together — a stream produced on one node is consumed on another.
cvc::ariadne::stream::stream_bridgeMaps a
cvc::ariadne::stream::frame↔ the transport envelope (payload = frame bytes; seq/pts ride along; the format comes from the replicated descriptor, not re-sent per frame):serve(local, consumer_endpoint)— the producer opens aStreamChannelto the consumer and pusheslocal's frames: a pusher subscribes tolocal.channel()(ring; drop-oldest under overload — drop-at-source) andsend()s each frame (chunked by PR8) until the stream closes or the consumer disconnects.receive_into(stream_id, proxy)— the consumer routes inbound frames forstream_idinto a local proxy stream viapublish_external, so its local consumers observe them like any local stream. The transport sink is a shared router so a frame delivered after the bridge is destroyed hits a live object, not a danglingthis.Roles (a pragmatic refinement)
To reuse the PR7/8 transport unchanged, the consumer runs the gRPC server and the producer is the client that pushes. Wiring the consumer's endpoint via a
sendMessageoffer/answer handshake (so merely discovering the descriptor auto-serves a consumer), and the conventional producer-serves-a-port model (needs a transport server-push path), are noted as the thin next layers — v1 proves frames cross with the least new code.One transport fix
Added
stream_transport_grpc::set_server_echo(bool)(default ON, preserving the PR7/8 round-trip tests). The bridge turns it OFF: a one-way push never reads echoes, and an unread echo fills gRPC flow control and deadlocks the sender — found and fixed while bringing up the capstone.Test —
stream_bridge_test.FramesCrossNodeToNode5 frames published into a stream on app A arrive byte-identical and in order in a proxy stream on app B, over the gRPC data plane (36 ms). The PR7/8 transport tests (4) and the control-plane grpc test (21) stay green.
This completes the critical path
Control plane (discover) ✅ · data plane (carry) ✅ · bridge (cross) ✅. A stream opened on one node is now discoverable and consumable on another — the goal the whole 9-PR effort set out to reach.