pub trait DKGDbBackend: Send + Sync + 'static {
    // Required methods
    fn get_local_key(
        &self,
        session_id: SessionId
    ) -> Result<Option<LocalKeyType>, DKGError>;
    fn store_local_key(
        &self,
        session_id: SessionId,
        local_key: LocalKeyType
    ) -> Result<(), DKGError>;
}
Expand description

A Database backend, specifically for the DKG to store and load important state

The backend of this database could be using a persistence store or in-memory ephemeral store, depending on the use case. For example, during the tests we can switch to an in-memory store, and in production we could use sled database or Offchain storage.

Required Methods§

source

fn get_local_key( &self, session_id: SessionId ) -> Result<Option<LocalKeyType>, DKGError>

Returns the DKG [LocalKey<Secp256k1>] at specific session, if any.

source

fn store_local_key( &self, session_id: SessionId, local_key: LocalKeyType ) -> Result<(), DKGError>

Stores the [LocalKey<Secp256k1>] at a specified session.

Implementations on Foreign Types§

source§

impl<T: DKGDbBackend + ?Sized> DKGDbBackend for Arc<T>where Arc<T>: Send + Sync + 'static,

source§

fn get_local_key( &self, session_id: SessionId ) -> Result<Option<LocalKeyType>, DKGError>

source§

fn store_local_key( &self, session_id: SessionId, local_key: LocalKeyType ) -> Result<(), DKGError>

source§

impl<'a, T: 'a + DKGDbBackend + ?Sized> DKGDbBackend for &'a Twhere &'a T: Send + Sync + 'static,

source§

fn get_local_key( &self, session_id: SessionId ) -> Result<Option<LocalKeyType>, DKGError>

source§

fn store_local_key( &self, session_id: SessionId, local_key: LocalKeyType ) -> Result<(), DKGError>

source§

impl<'a, T: 'a + DKGDbBackend + ?Sized> DKGDbBackend for &'a mut Twhere &'a mut T: Send + Sync + 'static,

source§

fn get_local_key( &self, session_id: SessionId ) -> Result<Option<LocalKeyType>, DKGError>

source§

fn store_local_key( &self, session_id: SessionId, local_key: LocalKeyType ) -> Result<(), DKGError>

Implementors§

source§

impl DKGDbBackend for DKGInMemoryDb

source§

impl<B, BE> DKGDbBackend for DKGOffchainStorageDb<B, BE>where B: Block, BE: Backend<B> + Unpin + 'static,