pub struct MailRelayStore { /* private fields */ }Expand description
Framework-neutral in-memory relay model, NOT a hosted or durable service. All outputs are owned copies. Save/restore snapshots atomically in a real service; enforce admission limits and serialized access outside this model. The short-lived Identity nonce cache is not part of the snapshot.
Implementations§
Source§impl MailRelayStore
impl MailRelayStore
pub fn new(origin: impl Into<String>) -> Result<Self>
Sourcepub fn with_limits(
origin: impl Into<String>,
max_packets: usize,
max_bytes: usize,
) -> Result<Self>
pub fn with_limits( origin: impl Into<String>, max_packets: usize, max_bytes: usize, ) -> Result<Self>
Per-mailbox limits on retained packets.
pub fn origin(&self) -> &str
pub fn discovery(&self) -> Value
pub fn publish( &mut self, value: &Value, now: i64, ) -> Result<AcceptedRecord<MailboxCardPayload>>
Sourcepub fn publish_with_nonce_store<S: NonceStore + ?Sized>(
&mut self,
value: &Value,
now: i64,
nonces: &mut S,
) -> Result<AcceptedRecord<MailboxCardPayload>>
pub fn publish_with_nonce_store<S: NonceStore + ?Sized>( &mut self, value: &Value, now: i64, nonces: &mut S, ) -> Result<AcceptedRecord<MailboxCardPayload>>
Inject the origin-wide Identity nonce store when several protocols share a service. All other checks precede nonce consumption.
pub fn card( &self, mailbox_id: &str, ) -> Result<AcceptedRecord<MailboxCardPayload>>
pub fn deliver( &mut self, mailbox_id: &str, packet: &Packet, now: i64, ) -> Result<DeliveryResult>
Sourcepub fn list(
&self,
mailbox: &str,
jwt: &str,
now: i64,
limit: usize,
cursor: Option<&str>,
) -> Result<ListResponse<PacketRecord>>
pub fn list( &self, mailbox: &str, jwt: &str, now: i64, limit: usize, cursor: Option<&str>, ) -> Result<ListResponse<PacketRecord>>
The cursor is the decimal seq of the last returned record.
pub fn delete( &mut self, mailbox: &str, id: &str, jwt: &str, now: i64, ) -> Result<()>
Sourcepub fn prune(&mut self, now: i64) -> Result<()>
pub fn prune(&mut self, now: i64) -> Result<()>
Drop expired packets and tombstones, then forget mailboxes whose
current card’s receive_until passed; a later card is a new registration.
pub fn snapshot(&self) -> Result<Value>
Auto Trait Implementations§
impl Freeze for MailRelayStore
impl RefUnwindSafe for MailRelayStore
impl Send for MailRelayStore
impl Sync for MailRelayStore
impl Unpin for MailRelayStore
impl UnsafeUnpin for MailRelayStore
impl UnwindSafe for MailRelayStore
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