Trait dkg_gadget::db::DKGDbBackend
source · 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§
sourcefn get_local_key(
&self,
session_id: SessionId
) -> Result<Option<LocalKeyType>, DKGError>
fn get_local_key( &self, session_id: SessionId ) -> Result<Option<LocalKeyType>, DKGError>
Returns the DKG [LocalKey<Secp256k1>
] at specific session, if any.
sourcefn store_local_key(
&self,
session_id: SessionId,
local_key: LocalKeyType
) -> Result<(), DKGError>
fn store_local_key( &self, session_id: SessionId, local_key: LocalKeyType ) -> Result<(), DKGError>
Stores the [LocalKey<Secp256k1>
] at a specified session.