pub struct Broker { /* private fields */ }Implementations§
Source§impl Broker
impl Broker
pub fn new(store: Store, cap: usize) -> Self
Sourcepub fn announce(&self, pubkey: String, announcement: Value, now: u64)
pub fn announce(&self, pubkey: String, announcement: Value, now: u64)
Record a presence announcement, keyed by its self-declared pubkey. Prunes expired entries; the announcement is stored verbatim (the bus never inspects it beyond the routing key).
Sourcepub async fn enqueue(&self, to: &str, payload: Value, ts: u64) -> Result<()>
pub async fn enqueue(&self, to: &str, payload: Value, ts: u64) -> Result<()>
Enqueue for to: persist, enforce the cap (drop oldest), wake a waiter.
Sourcepub async fn recv(
&self,
id: &str,
wait: Duration,
) -> Result<Option<(Envelope, String)>>
pub async fn recv( &self, id: &str, wait: Duration, ) -> Result<Option<(Envelope, String)>>
Wait up to wait for the oldest un-acked message for id. Returns the
envelope and its ack key; the message stays in the store until ack.
pub async fn ack(&self, key: &str) -> Result<()>
pub async fn depth(&self, id: &str) -> Result<usize>
pub fn router(self) -> Router
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Broker
impl !UnwindSafe for Broker
impl Freeze for Broker
impl Send for Broker
impl Sync for Broker
impl Unpin for Broker
impl UnsafeUnpin for Broker
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