Skip to main content

KeysDatabase

Trait KeysDatabase 

Source
pub trait KeysDatabase {
    type Err: Into<Error> + From<Error>;

    // Required methods
    fn begin_transaction<'a, 'async_trait>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn KeysDatabaseTransaction<'a, Self::Err> + Send + Sync + 'a>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn keysets_epoch<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Mint Keys Database trait

Required Associated Types§

Source

type Err: Into<Error> + From<Error>

Mint Keys Database Error

Required Methods§

Source

fn begin_transaction<'a, 'async_trait>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn KeysDatabaseTransaction<'a, Self::Err> + Send + Sync + 'a>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Begins a transaction

All keyset reads and writes go through a transaction: it takes the global keyset advisory lock, so the signatory’s reload sees a consistent snapshot. The autocommit reads that once existed here are gone; use the transaction’s read methods instead.

Source

fn keysets_epoch<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An opaque epoch for the current keyset set.

It must change whenever the set changes, both when a keyset is added and when the active pointer is reassigned. Callers only compare it for equality to decide whether to reload their in-memory view, so an epoch that misses reactivations would leave peers serving a stale active keyset. The storage decides how to compute it cheaply (e.g. a counter bumped inside every keyset-writing transaction); there is deliberately no default, since a count-based fallback would not move on reactivation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§