Skip to content

feat: real serve path — framing, transport, Server (rollout step 7d) - #4

Merged
Kinflou merged 1 commit into
mainfrom
feat/runtime-serve-inmemory
Sep 1, 2026
Merged

feat: real serve path — framing, transport, Server (rollout step 7d)#4
Kinflou merged 1 commit into
mainfrom
feat/runtime-serve-inmemory

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 1, 2026

Copy link
Copy Markdown
Member

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.

module
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 over 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 test are deleted, along with the setup-only deps (eyre, async-trait, downcast-rs, tokio, serde_json, json-rpc-types) and the json_rpc feature. package_abi stays.

Verified

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).

Next (7e)

The consumer side — a Client that owns a Transport + WireFormat, assigns request ids, and returns a borrowed Envelope; then a TCP Transport with length-prefixed stream framing.

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).
@Kinflou
Kinflou merged commit 0604dc8 into main Sep 1, 2026
6 checks passed
@Kinflou
Kinflou deleted the feat/runtime-serve-inmemory branch September 2, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant