pub trait Bucket: Send + Sync {
// Required methods
fn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
value: Bytes,
revision: u64,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn compare_and_replace<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
expected: Bytes,
value: Bytes,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = WatchEvent> + Send + '_>>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Key, Bytes>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An online storage for key-value config values.
Required Methods§
Sourcefn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
value: Bytes,
revision: u64,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
value: Bytes,
revision: u64,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A bucket is a collection of key/value pairs. Insert a value into a bucket, if it doesn’t exist already The Key should be the name of the item, not including the bucket name.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch an item from the key-value storage The Key should be the name of the item, not including the bucket name.
Sourcefn compare_and_replace<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
expected: Bytes,
value: Bytes,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn compare_and_replace<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
expected: Bytes,
value: Bytes,
) -> Pin<Box<dyn Future<Output = Result<StoreOutcome, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replace an existing item only if its current value matches expected.
Implementations must perform the comparison and replacement atomically.
A missing key returns StoreError::MissingKey and must never be created;
a value changed by another writer returns StoreError::Retry.
A successful StoreOutcome revision is backend-specific and must not be
compared across backends or treated as a globally monotonic version.
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Key,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete an item from the bucket The Key should be the name of the item, not including the bucket name.
Sourcefn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = WatchEvent> + Send + '_>>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = WatchEvent> + Send + '_>>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
An atomic initial snapshot followed by changes newer than that snapshot.
Implementations must establish the snapshot and incremental watch without a gap and must never emit an incremental value older than a value already emitted in the initial snapshot. Existing entries may be emitted as individual WatchEvent::Put events or as one WatchEvent::Resync.
Sourcefn entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Key, Bytes>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn entries<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Key, Bytes>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The entries in this bucket.
The Key includes the full path including the bucket name.
That means you cannot directory get a Key from entries and pass it to get or delete.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".