Repository navigation
2.2 HybridFlowBackend Trait
Optional message-oriented trait for structured spike/embedding exchange and non-blocking gradient/trace receive. Defined in src/trait_def.rs. It does not own the wire encoding; JSON implementors should decode with decode_ipc_message_json, then Validate.
| Method | Direction | Payload |
IpcMessage variant |
|---|---|---|---|
send_spikes |
Outbound | SpikeBatch |
Spikes |
send_embeddings |
Outbound | EmbeddingBatch |
Embeddings |
try_receive_gradients |
Inbound | Option<GradientBatch> |
GradientUpdate |
try_receive_traces |
Inbound | Option<TraceBatch> |
EligibilityTraces |
Stimuli, neuromodulators, loss, config, and control variants are real IpcMessage values on a generic structured transport; they are not methods of this trait. Observing one on a receive call returns BackendError::Protocol (ProtocolError::UnexpectedVariant) instead of discarding the frame.
Ok(None) means nothing queued right now. InvalidInput is payload validation failure. CommunicationError covers framing, version, transport, and structural JSON decode failures.
With feature zmq, ZmqHybridFlowBackend implements this trait over ZmqMessagePublisher / ZmqMessageSubscriber (one canonical JSON envelope per ZeroMQ message). See #55 / 08d2f28.
ZmqIpcBackend does not implement HybridFlowBackend. It is the binary [i64 tick][N × f32 LE] readout subscriber only.
classDiagram
class IpcBackend {
<<trait>>
+initialize()
+process_batch()
+save_state()
+get_spike_states()
+reset()
}
class HybridFlowBackend {
<<trait>>
+send_spikes()
+send_embeddings()
+try_receive_gradients()
+try_receive_traces()
}
class RustBackend
class ZmqIpcBackend
class ZmqHybridFlowBackend
IpcBackend <|.. RustBackend
IpcBackend <|.. ZmqIpcBackend
HybridFlowBackend <|.. ZmqHybridFlowBackend
flowchart LR
subgraph Outbound
Spikes["send_spikes"] --> Sp["IpcMessage::Spikes"]
Emb["send_embeddings"] --> Em["IpcMessage::Embeddings"]
end
subgraph Inbound
Gu["IpcMessage::GradientUpdate"] --> Rg["try_receive_gradients"]
Tr["IpcMessage::EligibilityTraces"] --> Rt["try_receive_traces"]
end
Sp --> Peer["Peer engine"]
Em --> Peer
Peer --> Gu
Peer --> Tr
Sources: src/trait_def.rs, src/zmq_message/hybrid.rs
- 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