Skip to main content

DelegateInbox

Trait DelegateInbox 

Source
pub trait DelegateInbox: Send + Sync {
    // Required methods
    fn persist(&self, address: &str, bytes: &[u8]) -> Result<()>;
    fn load(&self, address: &str) -> Result<Option<Vec<u8>>>;
    fn addresses(&self) -> Result<Vec<String>>;
    fn remove(&self, address: &str) -> Result<()>;
    fn quarantine(&self, address: &str, note: &Quarantine) -> Result<()>;
    fn quarantined(&self) -> Result<Vec<(String, Quarantine)>>;
    fn load_quarantined(&self, address: &str) -> Result<Option<Vec<u8>>>;
    fn discard(&self, address: &str) -> Result<Option<Quarantine>>;
}
Expand description

Where a delegate keeps the hand-offs it accepted until custody is confirmed. Never a library: a delegate copy is not an asset of the delegate’s.

A copy is either held (listed by addresses and uploaded on every run) or quarantined (kept byte for byte with its Quarantine note, never retried, and deleted only by discard).

Required Methods§

Source

fn persist(&self, address: &str, bytes: &[u8]) -> Result<()>

Persist bytes under address durably — written and synced, its directory entry too — before returning. An acknowledgement follows only after this returns.

Source

fn load(&self, address: &str) -> Result<Option<Vec<u8>>>

The bytes held under address.

Source

fn addresses(&self) -> Result<Vec<String>>

Every address held. A quarantined copy is not held.

Source

fn remove(&self, address: &str) -> Result<()>

Delete the copy under address. Removing an absent one is not an error.

Source

fn quarantine(&self, address: &str, note: &Quarantine) -> Result<()>

Move the held copy under address to quarantine with note, durably, keeping its bytes. Quarantining an absent copy is not an error.

Source

fn quarantined(&self) -> Result<Vec<(String, Quarantine)>>

Every quarantined copy’s address and note, each once.

Source

fn load_quarantined(&self, address: &str) -> Result<Option<Vec<u8>>>

The bytes of the quarantined copy under address.

Source

fn discard(&self, address: &str) -> Result<Option<Quarantine>>

Delete the quarantined copy under address, returning its note, or None when no copy under address is quarantined (a held copy is left alone).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§