pub struct SledStorage { /* private fields */ }Expand description
Sled storage backend implementation
Implementations§
Source§impl SledStorage
impl SledStorage
Sourcepub async fn new(config: SledConfig) -> StorageResult<Self>
pub async fn new(config: SledConfig) -> StorageResult<Self>
Create a new Sled storage backend
Trait Implementations§
Source§impl Debug for SledStorage
impl Debug for SledStorage
Source§impl KeyValueStorage for SledStorage
impl KeyValueStorage for SledStorage
Source§fn get_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get value by key as bytes
Source§fn set_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_bytes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Set value as bytes
Source§fn iter_prefix<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn iter_prefix<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Iterate over all keys with prefix
Source§fn get_range<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table: &'life1 str,
start: &'life2 str,
end: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn get_range<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
table: &'life1 str,
start: &'life2 str,
end: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(String, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Get range of keys
Source§fn merge<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn merge<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Merge value (append for log-structured merge trees)
Source§impl Storage for SledStorage
impl Storage for SledStorage
Source§fn backend(&self) -> StorageBackend
fn backend(&self) -> StorageBackend
Get backend type
Source§fn metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageMetadata>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get storage metadata
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageHealth>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageHealth>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check
Source§fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get statistics
Source§fn insert<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: &'life3 T,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
fn insert<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, table: &'life1 str, key: &'life2 str, value: &'life3 T, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
Insert a new entry
Source§fn insert_with_ttl<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: &'life3 T,
ttl_seconds: i64,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
fn insert_with_ttl<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, table: &'life1 str, key: &'life2 str, value: &'life3 T, ttl_seconds: i64, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
Insert entry with TTL (time-to-live in seconds)
Source§fn get<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Option<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Get an entry by key
Source§fn update<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: &'life3 T,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
fn update<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, table: &'life1 str, key: &'life2 str, value: &'life3 T, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
Update an existing entry
Source§fn update_versioned<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
value: &'life3 T,
expected_version: u64,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
fn update_versioned<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, table: &'life1 str, key: &'life2 str, value: &'life3 T, expected_version: u64, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
Update entry with optimistic locking (version check)
Source§fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Delete an entry
Source§fn exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check if entry exists
Source§fn execute_batch<'life0, 'async_trait>(
&'life0 self,
batch: Batch,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute_batch<'life0, 'async_trait>(
&'life0 self,
batch: Batch,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute batch operations
Source§fn query<'life0, 'async_trait, T>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
fn query<'life0, 'async_trait, T>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
Query entries matching criteria
Source§fn count<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count<'life0, 'async_trait>(
&'life0 self,
query: Query,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Count entries matching criteria
Source§fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<Transaction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin a transaction
Source§fn commit_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Commit a transaction
Source§fn rollback_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn rollback_transaction<'life0, 'async_trait>(
&'life0 self,
transaction: Transaction,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Rollback a transaction
Source§fn scan_prefix<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn scan_prefix<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
table: &'life1 str,
prefix: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Scan keys with prefix
Source§fn get_multi<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Option<StorageEntry<T>>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_multi<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Option<StorageEntry<T>>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get multiple entries by keys
Source§fn delete_multi<'life0, 'life1, 'async_trait>(
&'life0 self,
table: &'life1 str,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_multi<'life0, 'life1, 'async_trait>(
&'life0 self,
table: &'life1 str,
keys: Vec<String>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete multiple entries
Source§fn compare_and_swap<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
key: &'life2 str,
expected_version: u64,
new_value: &'life3 T,
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
fn compare_and_swap<'life0, 'life1, 'life2, 'life3, 'async_trait, T>( &'life0 self, table: &'life1 str, key: &'life2 str, expected_version: u64, new_value: &'life3 T, ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
Atomic compare-and-swap
Source§fn get_modified_since<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
since: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_modified_since<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
since: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get entries modified after timestamp
Source§fn get_expiring_before<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
before: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_expiring_before<'life0, 'life1, 'async_trait, T>(
&'life0 self,
table: &'life1 str,
before: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageEntry<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get entries that expire before timestamp
Source§fn cleanup_expired<'life0, 'life1, 'async_trait>(
&'life0 self,
table: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cleanup_expired<'life0, 'life1, 'async_trait>(
&'life0 self,
table: &'life1 str,
) -> Pin<Box<dyn Future<Output = StorageResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cleanup expired entries
Source§fn compact<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn compact<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Compact storage (if supported)
Source§fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush pending writes
Source§fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize storage
Auto Trait Implementations§
impl !RefUnwindSafe for SledStorage
impl !UnwindSafe for SledStorage
impl Freeze for SledStorage
impl Send for SledStorage
impl Sync for SledStorage
impl Unpin for SledStorage
impl UnsafeUnpin for SledStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.