pub struct DynamoDbKvStore { /* private fields */ }Expand description
DynamoDB-backed KvStore implementation
Uses a separate DynamoDB table per namespace with:
- Partition Key (PK): user_id:key (format: user_id:actual_key)
- Sort Key (SK): actual_key
- Value: binary data
The user_id:key format ensures all tables use consistent partition key structure. This design enables efficient Query operations instead of expensive Scans.
Implementations§
Source§impl DynamoDbKvStore
impl DynamoDbKvStore
Sourcepub fn new(
client: Arc<Client>,
table_name: String,
user_id: Option<String>,
) -> Self
pub fn new( client: Arc<Client>, table_name: String, user_id: Option<String>, ) -> Self
Create a new DynamoDB KvStore for a specific table
table_name: The DynamoDB table name (typically namespace-specific)user_id: Optional user_id that will be used as the partition key (for multi-tenant isolation)
Trait Implementations§
Source§impl KvStore for DynamoDbKvStore
impl KvStore for DynamoDbKvStore
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<Option<Vec<u8>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a value by key
Source§fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
value: Vec<u8>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Put a key-value pair
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a key
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a key exists
Source§fn scan_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(Vec<u8>, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn scan_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = StorageResult<Vec<(Vec<u8>, Vec<u8>)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Scan keys with a given prefix
Source§fn batch_put<'life0, 'async_trait>(
&'life0 self,
items: Vec<(Vec<u8>, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_put<'life0, 'async_trait>(
&'life0 self,
items: Vec<(Vec<u8>, Vec<u8>)>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Batch put operations (atomic if backend supports it)
Source§fn batch_delete<'life0, 'async_trait>(
&'life0 self,
keys: Vec<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn batch_delete<'life0, 'async_trait>(
&'life0 self,
keys: Vec<Vec<u8>>,
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Batch delete operations
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 operations to storage (no-op for backends that auto-flush)
Source§fn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Get storage backend name (for debugging/metrics)
Source§fn execution_model(&self) -> ExecutionModel
fn execution_model(&self) -> ExecutionModel
Get the execution model of this backend Read more
Source§fn flush_behavior(&self) -> FlushBehavior
fn flush_behavior(&self) -> FlushBehavior
Get the flush behavior of this backend Read more
Auto Trait Implementations§
impl Freeze for DynamoDbKvStore
impl !RefUnwindSafe for DynamoDbKvStore
impl Send for DynamoDbKvStore
impl Sync for DynamoDbKvStore
impl Unpin for DynamoDbKvStore
impl !UnwindSafe for DynamoDbKvStore
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> 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 moreCreates a shared type from an unshared type.