pub trait Stash: Debug + Send {
Show 17 methods fn collection<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        name: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<StashCollection<K, V>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn iter<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<((K, V), Timestamp, Diff)>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn iter_key<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>,
        key: &'life1 K
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(V, Timestamp, Diff)>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn update_many<'life0, 'async_trait, K, V, I>(
        &'life0 mut self,
        collection: StashCollection<K, V>,
        entries: I
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        I: IntoIterator<Item = ((K, V), Timestamp, Diff)> + Send,
        I::IntoIter: Send,
        K: 'async_trait,
        V: 'async_trait,
        I: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn seal<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>,
        upper: AntichainRef<'life1, Timestamp>
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn compact<'a, 'async_trait, K, V>(
        &'a mut self,
        collection: StashCollection<K, V>,
        since: AntichainRef<'a, Timestamp>
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        'a: 'async_trait,
        K: 'async_trait,
        V: 'async_trait,
        Self: 'async_trait
; fn consolidate<'a, 'async_trait, K, V>(
        &'a mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        'a: 'async_trait,
        K: 'async_trait,
        V: 'async_trait,
        Self: 'async_trait
; fn since<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<Antichain<Timestamp>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn upper<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<Antichain<Timestamp>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn peek_timestamp<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<Timestamp, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn peek<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(K, V, Diff)>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn peek_one<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>
    ) -> Pin<Box<dyn Future<Output = Result<BTreeMap<K, V>, StashError>> + Send + 'async_trait>>
    where
        K: Data + Hash,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn peek_key_one<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>,
        key: &'life1 K
    ) -> Pin<Box<dyn Future<Output = Result<Option<V>, StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } fn update<'life0, 'async_trait, K, V>(
        &'life0 mut self,
        collection: StashCollection<K, V>,
        data: (K, V),
        time: Timestamp,
        diff: Diff
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } fn seal_batch<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        seals: &'life1 [(StashCollection<K, V>, Antichain<Timestamp>)]
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } fn compact_batch<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        compactions: &'life1 [(StashCollection<K, V>, Antichain<Timestamp>)]
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } fn consolidate_batch<'life0, 'life1, 'async_trait, K, V>(
        &'life0 mut self,
        collections: &'life1 [StashCollection<K, V>]
    ) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>
    where
        K: Data,
        V: Data,
        K: 'async_trait,
        V: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
}
Expand description

A durable metadata store.

A stash manages any number of named StashCollections.

A stash is designed to store only a small quantity of data. Think megabytes, not gigabytes.

The API of a stash intentionally mimics the API of a STORAGE collection. You can think of stash as a stable but very low performance STORAGE collection. When the STORAGE layer is stable enough to serve as a source of truth, the intent is to swap all stashes for STORAGE collections.

Required methods

Loads or creates the named collection.

If the collection with the specified name does not yet exist, it is created with no entries, a zero since frontier, and a zero upper frontier. Otherwise the existing durable state is loaded.

It is the callers responsibility to keep K and V fixed for a given collection in a given stash for the lifetime of the stash.

It is valid to construct multiple handles to the same named collection and use them simultaneously.

Iterates over all entries in the stash.

Entries are iterated in (key, value, time) order and are guaranteed to be consolidated.

Each entry’s time is guaranteed to be greater than or equal to the since frontier. The time may also be greater than the upper frontier, indicating data that has not yet been made definite.

Iterates over entries in the stash for the given key.

Entries are iterated in (value, timestamp) order and are guaranteed to be consolidated.

Each entry’s time is guaranteed to be greater than or equal to the since frontier. The time may also be greater than the upper frontier, indicating data that has not yet been made definite.

Atomically adds multiple entries to the arrangement.

Each entry’s time must be greater than or equal to the upper frontier.

If this method returns Ok, the entries have been made durable.

Atomically advances the upper frontier to the specified value.

The provided upper must be greater than or equal to the current upper frontier.

Intuitively, this method declares that all times less than upper are definite.

Atomically advances the since frontier to the specified value.

The provided since must be greater than or equal to the current since frontier but less than or equal to the current upper frontier.

Intuitively, this method performs logical compaction. Existing entries whose time is less than since are fast-forwarded to since.

Atomically consolidates entries less than the since frontier.

Intuitively, this method performs physical compaction. Existing key–value pairs whose time is less than the since frontier are consolidated together when possible.

Reports the current since frontier.

Reports the current upper frontier.

Provided methods

Returns the most recent timestamp at which sealed entries can be read.

Returns the current value of sealed entries.

Entries are iterated in (key, value) order and are guaranteed to be consolidated.

Sealed entries are those with timestamps less than the collection’s upper frontier.

Returns the current k,v pairs of sealed entries, erroring if there is more than one entry for a given key or the multiplicity is not 1 for each key.

Sealed entries are those with timestamps less than the collection’s upper frontier.

Returns the current sealed value for the given key, erroring if there is more than one entry for the key or its multiplicity is not 1.

Sealed entries are those with timestamps less than the collection’s upper frontier.

Atomically adds a single entry to the arrangement.

The entry’s time must be greater than or equal to the upper frontier.

If this method returns Ok, the entry has been made durable.

Performs multiple seals at once, potentially in a more performant way than performing the individual seals one by one.

See Stash::seal

Performs multiple compactions at once, potentially in a more performant way than performing the individual compactions one by one.

Each application of compacting a single collection must be atomic. However, there is no guarantee that Stash impls apply all compactions atomically, so it is possible that only some compactions are applied if a crash or error occurs.

See Stash::compact

Performs multiple consolidations at once, potentially in a more performant way than performing the individual consolidations one by one.

See Stash::consolidate

Implementors