Skip to main content

Module bus

Module bus 

Source
Expand description

The C ABI for the in-process event bus.

These functions wrap [pamoja_bus] for callers that reach the SDK through the flat C boundary: one publisher, many subscribers, inside a single process. It is how the parts of a gateway talk to each other without knowing about each other, so a sampler can announce a reading and whatever cares about readings picks it up.

The Rust bus carries any cloneable event; a C ABI has no such parameter, so this one carries bytes. That is the shape every binding already exchanges, and a caller who wants structure encodes it with crate::codec on the way in.

Every call on an endpoint takes it by shared pointer, and an endpoint may be used from several threads at once: a publish or a subscribe runs while a next waits on another thread, and two nexts on one endpoint take turns.

Structs§

PamojaEventBus
An opaque handle to one endpoint on an event bus.
PamojaEventPublisher
An opaque handle that publishes to a bus and has no queue of its own.

Functions§

pamoja_event_bus_free⚠
Releases an event bus endpoint.
pamoja_event_bus_missed⚠
Counts the events this endpoint lost by falling behind.
pamoja_event_bus_new
Creates an event bus.
pamoja_event_bus_next⚠
Waits for the next event on this endpoint.
pamoja_event_bus_next_within⚠
Waits for the next event on this endpoint, giving up after a time limit.
pamoja_event_bus_publish⚠
Publishes an event to every subscriber, this endpoint included.
pamoja_event_bus_publisher⚠
Takes a publish-only handle on the same bus.
pamoja_event_bus_subscribe⚠
Takes another endpoint on the same bus.
pamoja_event_publisher_clone⚠
Takes another publisher on the same bus, for another part that announces.
pamoja_event_publisher_free⚠
Releases a publisher.
pamoja_event_publisher_new
Creates a bus with no subscribers yet, and a publisher on it.
pamoja_event_publisher_publish⚠
Hands an event to every current subscriber.
pamoja_event_publisher_subscribe⚠
Subscribes to the bus a publisher publishes on.