pub struct Cache<S> { /* private fields */ }
Expand description
An in-memory Stash that is backed by another Stash but serves read requests from its memory. Write requests are propogated to the other Stash.
Implementations§
Trait Implementations§
source§impl<S: Append> Append for Cache<S>
impl<S: Append> Append for Cache<S>
source§fn append_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
batches: &'life1 [AppendBatch]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
batches: &'life1 [AppendBatch]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Same as
append
, but does not consolidate batches.source§fn append<'life0, 'life1, 'async_trait>(
&'life0 mut self,
batches: &'life1 [AppendBatch]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 mut self,
batches: &'life1 [AppendBatch]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically adds entries, seals, compacts, and consolidates multiple
collections. Read more
source§impl<S: Stash> Stash for Cache<S>
impl<S: Stash> Stash for Cache<S>
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads or creates the named collection. Read more
source§fn collections<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<BTreeSet<String>, StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn collections<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<BTreeSet<String>, StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the names of the collections in the stash.
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Iterates over all entries in the stash. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Iterates over entries in the stash for the given key. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
I: IntoIterator<Item = ((K, V), Timestamp, Diff)> + Send + 'async_trait,
I::IntoIter: Send,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
I: IntoIterator<Item = ((K, V), Timestamp, Diff)> + Send + 'async_trait,
I::IntoIter: Send,
Self: 'async_trait,
'life0: 'async_trait,
Atomically adds multiple entries to the arrangement. Read more
source§fn seal<'life0, 'life1, 'async_trait, K, V>(
&'life0 mut self,
collection: StashCollection<K, V>,
new_upper: AntichainRef<'life1, Timestamp>
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
K: Data + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn seal<'life0, 'life1, 'async_trait, K, V>(
&'life0 mut self,
collection: StashCollection<K, V>,
new_upper: AntichainRef<'life1, Timestamp>
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
K: Data + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically advances the upper frontier to the specified value. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Performs multiple seals at once, potentially in a more performant way than
performing the individual seals one by one. Read more
source§fn compact<'a, 'async_trait, K, V>(
&'a mut self,
collection: StashCollection<K, V>,
new_since: AntichainRef<'a, Timestamp>
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
K: Data + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
fn compact<'a, 'async_trait, K, V>(
&'a mut self,
collection: StashCollection<K, V>,
new_since: AntichainRef<'a, Timestamp>
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
K: Data + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'a: 'async_trait,
Atomically advances the since frontier to the specified value. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Performs multiple compactions at once, potentially in a more performant way than
performing the individual compactions one by one. Read more
source§fn consolidate<'life0, 'async_trait>(
&'life0 mut self,
collection: Id
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn consolidate<'life0, 'async_trait>(
&'life0 mut self,
collection: Id
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically consolidates entries less than the since frontier. Read more
source§fn consolidate_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
collections: &'life1 [Id]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn consolidate_batch<'life0, 'life1, 'async_trait>(
&'life0 mut self,
collections: &'life1 [Id]
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Performs multiple consolidations at once, potentially in a more performant way than
performing the individual consolidations one by one. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Reports the current since frontier.
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Reports the current upper frontier.
source§fn confirm_leadership<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn confirm_leadership<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), StashError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns
Ok
if this stash instance was the leader at some
point from the invocation of this method to the return of this
method. Otherwise, returns Err
.source§fn epoch(&self) -> Option<NonZeroI64>
fn epoch(&self) -> Option<NonZeroI64>
Returns the stash’s epoch number. If
Some
, it is a positive number that
increases with each start of a stash.source§fn is_readonly(&self) -> bool
fn is_readonly(&self) -> bool
Reports whether the stash is in readonly mode. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Returns the most recent timestamp at which sealed entries can be read.
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Returns the current value of sealed entries. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
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. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
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. Read more
source§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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: '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 + 'async_trait,
V: Data + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
Atomically adds a single entry to the arrangement. Read more
Auto Trait Implementations§
impl<S> RefUnwindSafe for Cache<S>where
S: RefUnwindSafe,
impl<S> Send for Cache<S>where
S: Send,
impl<S> Sync for Cache<S>where
S: Sync,
impl<S> Unpin for Cache<S>where
S: Unpin,
impl<S> UnwindSafe for Cache<S>where
S: UnwindSafe,
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request