pub struct Collection<K, V> { /* private fields */ }Expand description
An encrypted, typed collection. Rows are AEAD-sealed under a per-collection DEK; see the module docs for the trust model.
Implementations§
Source§impl<K, V> Collection<K, V>
impl<K, V> Collection<K, V>
Sourcepub fn open<E: KvEngine>(
engine: &E,
key_provider: Arc<dyn KeyProvider>,
name: impl Into<String>,
schema_version: u32,
) -> StoreResult<Self>
pub fn open<E: KvEngine>( engine: &E, key_provider: Arc<dyn KeyProvider>, name: impl Into<String>, schema_version: u32, ) -> StoreResult<Self>
Open an existing collection. Errors with
StoreError::CollectionNotFound if no DEK wrapping has been provisioned.
Sourcepub fn open_or_create<E: KvEngine>(
engine: &E,
key_provider: Arc<dyn KeyProvider>,
name: impl Into<String>,
schema_version: u32,
) -> StoreResult<Self>
pub fn open_or_create<E: KvEngine>( engine: &E, key_provider: Arc<dyn KeyProvider>, name: impl Into<String>, schema_version: u32, ) -> StoreResult<Self>
Open a collection, provisioning a fresh DEK on first use. The check and the create happen in one write transaction, so a collection is never double-provisioned with conflicting DEKs by a concurrent opener.
Sourcepub fn schema_version(&self) -> u32
pub fn schema_version(&self) -> u32
The schema version bound into every row’s AAD.
Sourcepub fn get(&self, tx: &impl Readable, key: &K) -> StoreResult<Option<V>>
pub fn get(&self, tx: &impl Readable, key: &K) -> StoreResult<Option<V>>
Fetch and decrypt the value for key, or None if absent. A missing row
returns None without touching the vault — only a present row requires
an unlock to decrypt.
Sourcepub fn put(&self, tx: &mut impl WriteTx, key: &K, value: &V) -> StoreResult<()>
pub fn put(&self, tx: &mut impl WriteTx, key: &K, value: &V) -> StoreResult<()>
Encrypt and store value under key.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !RefUnwindSafe for Collection<K, V>
impl<K, V> !UnwindSafe for Collection<K, V>
impl<K, V> Freeze for Collection<K, V>
impl<K, V> Send for Collection<K, V>
impl<K, V> Sync for Collection<K, V>
impl<K, V> Unpin for Collection<K, V>
impl<K, V> UnsafeUnpin for Collection<K, V>
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