pub trait EventBus: Send + Sync {
// Required methods
fn publish(
&self,
topic: &str,
key: &str,
value: &Value,
) -> Result<PublishAck, BusError>;
fn fetch(
&self,
topic: &str,
partition: u32,
offset: u64,
max: usize,
) -> Result<Vec<StoredEvent>, BusError>;
fn partitions(&self, topic: &str) -> Result<u32, BusError>;
fn topics(&self) -> Vec<String>;
// Provided methods
fn set_control_key(&self, _key: [u8; 32]) -> Result<(), BusError> { ... }
fn publish_idempotent(
&self,
topic: &str,
key: &str,
value: &Value,
_event_uid: &str,
) -> Result<PublishAck, BusError> { ... }
fn find_event_by_uid(
&self,
topic: &str,
key: &str,
event_uid: &str,
) -> Result<Option<PublishAck>, BusError> { ... }
fn maintenance(&self, _now_ms: u64) -> Result<u64, BusError> { ... }
}Expand description
Publish/consume abstraction. Synchronous by design: the harness calls it from worker threads (never the hot path), and network backends manage their own I/O runtime internally.
Required Methods§
Sourcefn publish(
&self,
topic: &str,
key: &str,
value: &Value,
) -> Result<PublishAck, BusError>
fn publish( &self, topic: &str, key: &str, value: &Value, ) -> Result<PublishAck, BusError>
Publish value onto topic, partitioned by key. Returns the ack.
Sourcefn fetch(
&self,
topic: &str,
partition: u32,
offset: u64,
max: usize,
) -> Result<Vec<StoredEvent>, BusError>
fn fetch( &self, topic: &str, partition: u32, offset: u64, max: usize, ) -> Result<Vec<StoredEvent>, BusError>
Read up to max events from topic/partition starting at offset
(ordered replay).
Provided Methods§
Sourcefn set_control_key(&self, _key: [u8; 32]) -> Result<(), BusError>
fn set_control_key(&self, _key: [u8; 32]) -> Result<(), BusError>
Configure the signer-derived key used for authenticated local controls.
Sourcefn publish_idempotent(
&self,
topic: &str,
key: &str,
value: &Value,
_event_uid: &str,
) -> Result<PublishAck, BusError>
fn publish_idempotent( &self, topic: &str, key: &str, value: &Value, _event_uid: &str, ) -> Result<PublishAck, BusError>
Publish a stable event UID. Backends with native or local deduplication override this method; the default preserves compatibility while the UID remains embedded in the event payload for downstream deduplication.
Sourcefn find_event_by_uid(
&self,
topic: &str,
key: &str,
event_uid: &str,
) -> Result<Option<PublishAck>, BusError>
fn find_event_by_uid( &self, topic: &str, key: &str, event_uid: &str, ) -> Result<Option<PublishAck>, BusError>
Locate an already committed event by stable UID during crash recovery.