pub struct NatsBus { /* private fields */ }Expand description
NATS JetStream bus.
Implementations§
Trait Implementations§
Source§impl EventBus for NatsBus
impl EventBus for NatsBus
Source§fn 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.
Source§fn 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.Source§fn 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.
Source§fn 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).Source§fn partitions(&self, topic: &str) -> Result<u32, BusError>
fn partitions(&self, topic: &str) -> Result<u32, BusError>
Number of partitions configured for
topic.Source§fn maintenance(&self, _now_ms: u64) -> Result<u64, BusError>
fn maintenance(&self, _now_ms: u64) -> Result<u64, BusError>
Run backend maintenance such as hot-retention expiry. Managed brokers
may return zero when retention is enforced natively.
Source§fn 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.
Auto Trait Implementations§
impl !Freeze for NatsBus
impl !RefUnwindSafe for NatsBus
impl Send for NatsBus
impl Sync for NatsBus
impl Unpin for NatsBus
impl UnsafeUnpin for NatsBus
impl !UnwindSafe for NatsBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more