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>>
Sourcepub fn deliver(
&mut self,
mailbox_id: &str,
packet: &Packet,
now: i64,
) -> Result<DeliveryResult>
pub fn deliver( &mut self, mailbox_id: &str, packet: &Packet, now: i64, ) -> Result<DeliveryResult>
Packets are asynchronous signed objects: no live-write window or nonce maximum applies.
Sourcepub fn set_sender_blocked(
&mut self,
mailbox: &str,
sender: AgentId,
blocked: bool,
) -> Result<()>
pub fn set_sender_blocked( &mut self, mailbox: &str, sender: AgentId, blocked: bool, ) -> Result<()>
Owner sender policy for new packets. Mail defines no management endpoint: the host authenticates the mailbox owner before calling this.
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.