Repository navigation
1.2 Architecture Overview
corpus-ipc is the schema and transport layer for Limen-Neural SNN runtimes (spike and neuromodulator wire protocol plus IPC transports; README / src/lib.rs as of 08d2f28). Application code talks to IpcBackend; BackendFactory selects RustBackend or (feature zmq) ZmqIpcBackend. Optional feature server builds corpus_ipc_server, a thin Axum 0.8 binary over corpus_ipc::server::router. Structured messages use IpcMessage with fail-closed wire-version gating via decode_ipc_message_json / encode_canonical_ipc_message. Feature zmq also exposes structured PUB/SUB (zmq_message) and ZmqHybridFlowBackend (#55).
Sources: src/lib.rs, README.md
Real flow in the tree: HTTP client → Axum router → AppState → IpcBackend::process_batch → (when ZMQ is selected) bounded SUB drain → parse_readout_packet.
flowchart LR
Client["HTTP client"] -->|"POST /process JSON"| Router["corpus_ipc::server::router"]
Router --> AppState["AppState Mutex + AtomicBool"]
AppState -->|"process_batch"| Trait["IpcBackend"]
Trait --> Rust["RustBackend"]
Trait --> Zmq["ZmqIpcBackend"]
Zmq -->|"DONTWAIT drain up to 64 msgs / 5 ms"| Sub["zmq::Socket SUB"]
Pub["External PUB"] -->|"i64 tick + N x f32 LE"| Sub
Sub --> Parse["parse_readout_packet"]
Parse --> Cache["last_readout cache"]
Cache --> Trait
Sources: src/server.rs, src/bin/corpus_ipc_server.rs, src/zmq_backend.rs, src/zmq_readout.rs
Separate from binary readout and from REST. Publisher binds; subscriber connects; hybrid adapter maps spikes/embeddings out and gradients/traces in.
flowchart LR
Caller["HybridFlowBackend caller"] --> HF["ZmqHybridFlowBackend"]
HF -->|"Spikes / Embeddings"| Pub["ZmqMessagePublisher"]
Pub -->|"canonical WireEnvelope JSON"| PeerIn["Peer SUB"]
PeerOut["Peer PUB"] -->|"canonical WireEnvelope JSON"| Sub["ZmqMessageSubscriber"]
Sub -->|"GradientUpdate / EligibilityTraces"| HF
HF --> Caller
Sources: src/zmq_message/, 3.4
| Layer | Modules | Feature |
|---|---|---|
| Traits / factory | trait_def |
always |
| Native backend | rust_backend |
always |
| ZMQ binary readout + parser |
zmq_backend, zmq_readout
|
zmq |
| Structured ZMQ IpcMessage | zmq_message |
zmq |
| Wire models | models |
always |
| Validation | validation |
always |
| Envelope + canonical encode |
compatibility, canonical_ser
|
always |
| REST router | server |
server |
| Binary | bin/corpus_ipc_server |
server |
-
Structured hybrid-flow JSON:
IpcMessageenvelopes (WireCompatibility::CURRENT = 1). Encode withencode_canonical_ipc_message; decode withdecode_ipc_message_json. Over ZeroMQ: 3.4. Spec:docs/wire-encoding.md. -
ZMQ binary readout:
ZmqIpcBackendis a SUB consumer ofi64tick +N×f32LE frames. It does not implementHybridFlowBackendand does not auto-split 88-byte frames into neuromodulator scores. -
REST: wraps
IpcBackendonly; does not speakIpcMessageJSON or binary readout frames.
- Home
- 1. Overview
- 1.1. Getting Started
- 1.2. Architecture Overview
- 1.3. Crate Exports and Module Map
- 2. Core Abstractions
- 2.1. IpcBackend Trait
- 2.2. HybridFlowBackend Trait
- 2.3. BackendFactory and BackendType
- 2.4. Error Handling
- 3. Backend Implementations
- 3.1. RustBackend
- 3.2. ZmqIpcBackend
- 3.3. ZMQ Readout Parsing and Golden Frames
- 3.4. Structured ZeroMQ IpcMessage Transport
- 4. IPC Protocol and Data Models
- 4.1. IpcMessage Protocol
- 4.2. Batch Data Types
- 4.3. NeuromodulatorSnapshot and Neuromodulator Packet
- 4.4. StimulusBatch and Runtime Ingress
- 4.5. Deserialization Hooks and Model Compat Aliases
- 5. Validation and Wire Compatibility
- 5.1. Validation Framework and ProtocolLimits
- 5.2. ValidationError and ValidationKind
- 5.3. WireCompatibility and Envelope Decoding
- 5.4. Canonical Wire-v1 Encoding
- 6. corpus_ipc_server HTTP Server
- 6.1. REST API Endpoints
- 6.2. Server Configuration and Deployment
- 7. Build, Dependencies, and Quality Gates
- 7.1. Cargo Features and Dependency Isolation
- 7.2. Testing Strategy
- 7.2.1. Wire-v1 Golden Test Vectors
- 7.2.2. Property-Based Wire Tests
- 7.3. CI, Coverage, and Release Qualification
- 8. Project History and Licensing
- 8.1. Naming History and Completed Renames
- 8.2. Licensing
- 9. Glossary