feat: real serve path — framing, transport, Server (rollout step 7d) - #4
Merged
Conversation
Replace the all-stubbed setup/ layer (async_trait + Arc<RwLock> + Box<dyn>,
against the sync/no-alloc contract) with the real thing:
- wire request/response framing. no_std, no alloc: encode into a
BufMut, borrow on decode. Request = [call_id u16][request_id
u64][params]; Response = [request_id u64][envelope].
- transport a sync frame Transport trait (send / recv-into-buf), + an
InMemory std impl backed by mpsc, with duplex().
- serve Server<D, W> -- holds the Dispatch, the WireFormat, and three
reused buffers; serve_one / serve read a request, dispatch,
frame the response. Generic over the Transport.
tests/serve_roundtrip.rs: a Greet protocol served on a thread over InMemory
while the client frames a request and reads the response end to end.
setup/ and the old stubbed setups integration test are deleted; the
setup-only deps (eyre, async-trait, downcast-rs, tokio, serde_json,
json-rpc-types) and the json_rpc feature go with them. package_abi stays.
All feature configs green: cargo test (12 lib + 3 + 1), --no-default-features
(2), --features alloc (8). Warnings 7 -> 1 (a pre-existing abi_stable macro
lint in package_abi).
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.
Follows #3. Replaces the all-stubbed
setup/layer (async_trait+Arc<RwLock>+Box<dyn>, at odds with the sync / no-alloc contract) with a working one.wireno_std, no alloc — encode into aBufMut, borrow on decode. Request =[call_id u16][request_id u64][params]; Response =[request_id u64][envelope].transportTransporttrait (send/recv-into-buf) + anInMemorystdimpl overmpsc, withduplex().serveServer<D, W>— holds theDispatch, theWireFormat, and three reused buffers;serve_one/serveread a request, dispatch, frame the response. Generic over theTransport.tests/serve_roundtrip.rs— aGreetprotocol served on a thread overInMemorywhile the client frames a request and reads the response, end to end.setup/and the old stubbedsetupstest are deleted, along with the setup-only deps (eyre,async-trait,downcast-rs,tokio,serde_json,json-rpc-types) and thejson_rpcfeature.package_abistays.Verified
All feature configs green:
cargo test(12 lib + 3 + 1),--no-default-features(2),--features alloc(8). Warnings 7 → 1 (a pre-existingabi_stablemacro lint inpackage_abi).Next (7e)
The consumer side — a
Clientthat owns aTransport+WireFormat, assigns request ids, and returns a borrowedEnvelope; then a TCPTransportwith length-prefixed stream framing.