Work in progress!
I've decided to make my intermediate work public because it stimulates be to work with higher quality.
Multi-bus, type-safe event library. Supports zero-copy local delivery and serialized remote transport (MQTT, network, etc).
- Cell = node
- Nucleus = hub
- Membrane = gateway
- Signal = message
- Hypha = transport (the link/pathway)
┌──────────────┐
│ User │
└──────┬───────┘
│
▼
┌─────────────────────┐
│ Publisher/ │ Multi-topic
│ Subscriber │ Multi-bus
│ Endpoint │
└──────┬──────────────┘
│
▼
┌─────────────────────┐
│ HyphaBus(es) │ Routing
└──┬────────┬─────────┘ Serialization
│ │
▼ ▼
┌────────┐ ┌──────────┐
│ Local │ │ Backend │ Transport
│Callback│ │ (MQTT..) │ (raw bytes)
└────────┘ └──────────┘
Responsibility: User-facing API for publishing/subscribing
Characteristics:
- Can connect to multiple buses simultaneously
- Handles multiple topics
- Type-safe publish/subscribe
- No serialization logic
Separation: PublisherEndpoint vs SubscriberEndpoint (single responsibility)
Responsibility: Route events between endpoints and backends
Key functions:
- Dispatch events to local subscribers (zero-copy via
shared_ptr) - Serialize events for remote backends
- Maintain subscriber registry
- Manage backend connections
Serialization strategy: Happens HERE, once per event, for all remote backends
Responsibility: Transport serialized bytes to external systems
Interface: Receives (EventMetadata, byte_payload), handles delivery
Examples: MQTT, TCP, IPC, file logging
Event = Data + Metadata
- Data:
shared_ptr<T>(user-allocated, immutable after publish) - Metadata: Topic, type info, timestamp (value type, bus-allocated)