This documentation is part of the "Projects with Books" initiative at zenOSmosis.
The source code for this project is available on GitHub.
Glossary
Loading…
Glossary
Relevant source files
- Cargo.lock
- Cargo.toml
- DRAFT.md
- README.md
- extensions/muxio-rpc-service-caller/src/caller_interface.rs
- extensions/muxio-rpc-service-caller/src/lib.rs
- extensions/muxio-rpc-service-caller/src/prebuffered/traits.rs
- extensions/muxio-rpc-service-caller/tests/dynamic_channel_tests.rs
- extensions/muxio-rpc-service-endpoint/src/error.rs
- extensions/muxio-rpc-service-endpoint/src/lib.rs
- extensions/muxio-rpc-service-endpoint/tests/prebuffered_endpoint_tests.rs
- extensions/muxio-tokio-rpc-client/src/rpc_client.rs
- extensions/muxio-tokio-rpc-server/src/rpc_server.rs
- extensions/muxio-wasm-rpc-client/src/rpc_wasm_client.rs
This page provides definitions for the specific terminology, abbreviations, and domain concepts used within the Muxio framework. Muxio uses a layered architecture where concepts from the low-level framing layer are composed to build high-level RPC abstractions.
Core Concepts & Jargon
Binary-First / Framed Transport
Muxio operates on raw byte streams rather than text-based formats like JSON README.md:33-34 Data is transmitted in discrete, ordered chunks called Frames. This approach allows for zero-assumption serialization (e.g., bitcode, FlatBuffers, or raw f32 arrays) DRAFT.md:11-13
Bidirectional Symmetry
Unlike traditional HTTP where roles are strictly Requestor (Client) and Responder (Server), Muxio allows both ends of a connection to act as both a client and a server simultaneously DRAFT.md:15-16 A “Client” in Muxio can register handlers to receive calls from the “Server” via the RpcServiceEndpointInterface extensions/muxio-rpc-service-endpoint/src/endpoint_interface.rs:1-12
Layered Transport Kit
A design philosophy where the core logic is written in a non-async, callback-driven style DRAFT.md:43-48 This allows the same core multiplexing logic to be wrapped by different “Transport Kits” like Tokio for native apps or wasm-bindgen for web browsers README.md:35-41
Sources: README.md:17-41 DRAFT.md:11-16 DRAFT.md:43-48
Technical Terms
| Term | Definition | Key Code Entity |
|---|---|---|
| Dispatcher | The central coordinator that manages stream lifecycles, request correlation, and response handling. | RpcDispatcher extensions/muxio-rpc-service-caller/src/caller_interface.rs28 |
| Endpoint | A registry for RPC method handlers. It maps method_id to asynchronous logic. | RpcServiceEndpoint extensions/muxio-rpc-service-endpoint/src/endpoint.rs:1-10 |
| Frame | The smallest unit of data transmission, containing a header and a payload chunk. | Frame muxio-core/src/frame/mod.rs |
| Method ID | A unique u64 identifier for an RPC function, typically generated via xxh3 hashing at compile time. | rpc_method_id! extensions/muxio-rpc-service/src/lib.rs |
| Prebuffered | A communication pattern where the entire payload (request or response) is collected into a single buffer before being passed to the handler or caller. | RpcMethodPrebuffered extensions/muxio-rpc-service-caller/src/prebuffered/traits.rs11 |
| RPC Session | An internal state tracker that manages unique rpc_request_id allocation and stream event routing. | RpcRespondableSession muxio-core/src/rpc/mod.rs |
| Dynamic Channel | An abstraction over bounded and unbounded mpsc channels used for streaming RPC responses. | DynamicChannel extensions/muxio-rpc-service-caller/src/dynamic_channel.rs:6-10 |
Sources: extensions/muxio-rpc-service-caller/src/caller_interface.rs:25-30 extensions/muxio-rpc-service-caller/src/prebuffered/traits.rs:11-21 extensions/muxio-rpc-service-caller/src/dynamic_channel.rs:1-10
Data Flow & Architecture Diagrams
The following diagrams illustrate how natural language concepts map to specific code entities and how data flows through the system.
Request Lifecycle: From Caller to Transport
This diagram bridges the “Natural Language Space” of making a call to the “Code Entity Space” of encoders and emitters.
graph TD
User["User Code"] -- "1. call(input)" --> RPCBP["RpcCallPrebuffered::call"]
RPCBP -- "2. encode" --> RM["RpcMethodPrebuffered::encode_request"]
RPCBP -- "3. dispatch" --> RSCI["RpcServiceCallerInterface::call_rpc_streaming"]
RSCI -- "4. init" --> DISP["RpcDispatcher (Core)"]
DISP -- "5. encode frame" --> RSE["RpcStreamEncoder"]
RSE -- "6. emit bytes" --> EMIT["RpcEmit (Callback)"]
EMIT -- "7. write" --> SOCK["Underlying Transport (Tokio/WASM)"]
subgraph "muxio-rpc-service-caller"
RPCBP
RSCI
end
subgraph "muxio-core"
DISP
RSE
end
Title: RPC Call Invocation Flow
Sources: extensions/muxio-rpc-service-caller/src/caller_interface.rs:33-89 extensions/muxio-rpc-service-caller/src/prebuffered/traits.rs:50-81
Endpoint Pipeline: From Bytes to Handler
This diagram shows the pipeline used by the RpcServiceEndpoint to process incoming data, specifically how it integrates with the WASM client.
graph LR
Bytes["&[u8] from JS/Transport"] --> Read["RpcWasmClient::read_bytes"]
subgraph "RpcServiceEndpoint::read_bytes"
Read -- "1. decode" --> DISP["RpcDispatcher::read_bytes"]
DISP -- "2. finalized" --> EP["RpcServiceEndpoint"]
EP -- "3. execute" --> Handlers["Async Prebuffered Handlers"]
Handlers -- "4. respond" --> OutBytes["Outbound Bytes (emit)"]
end
OutBytes --> JS["JS static_muxio_write_bytes"]
Title: Endpoint Read Bytes Pipeline
Sources: extensions/muxio-wasm-rpc-client/src/rpc_wasm_client.rs:46-55 extensions/muxio-rpc-service-endpoint/tests/prebuffered_endpoint_tests.rs:71-74
Key Abbreviations
- FFI : Foreign Function Interface. Muxio’s byte-oriented design facilitates bridging Rust with JS (via WASM) or C/C++ README.md:62-63
- ID (u32/u64) :
rpc_request_id(u32): A monotonic ID unique to a single connection session, used to correlate responses to requests.rpc_method_id(u64): A static hash identifying a specific RPC service method extensions/muxio-rpc-service-caller/src/caller_interface.rs47
- WASM : WebAssembly. Specifically refers to the
muxio-wasm-rpc-clientwhich uses a bridge to communicate with JavaScript README.md53
System State Definitions
RpcTransportState
Represents the connectivity status of a caller interface extensions/muxio-rpc-service-caller/src/transport_state.rs:1-10
- Connected : The underlying transport is active; requests can be sent extensions/muxio-wasm-rpc-client/src/rpc_wasm_client.rs:35-41
- Disconnected : The transport is closed. Any pending requests are failed with
ReadAfterCancelor similar extensions/muxio-tokio-rpc-client/src/rpc_client.rs:102-103
RpcStreamEvent
The internal signaling mechanism used by the RpcSession to notify the RpcDispatcher of progress extensions/muxio-rpc-service-caller/src/caller_interface.rs:123-163
- Header : New stream started; contains metadata and initial parameters extensions/muxio-rpc-service-caller/src/caller_interface.rs:124-139
- PayloadChunk : A piece of the body has arrived extensions/muxio-rpc-service-caller/src/caller_interface.rs:141-156
- End : The stream is complete.
- Error : The stream was interrupted or corrupted.
Sources: extensions/muxio-rpc-service-caller/src/caller_interface.rs:123-163 extensions/muxio-tokio-rpc-client/src/rpc_client.rs:80-108 extensions/muxio-wasm-rpc-client/src/rpc_wasm_client.rs:58-68