fedimint_core::db

Trait DatabaseKey

Source
pub trait DatabaseKey: Sized {
    const NOTIFY_ON_MODIFY: bool = false;

    // Required method
    fn from_bytes(
        data: &[u8],
        modules: &ModuleDecoderRegistry,
    ) -> Result<Self, DecodingError>;
}
Expand description

DatabaseKey that represents the lookup structure for retrieving key/value pairs from the database.

Provided Associated Constants§

Source

const NOTIFY_ON_MODIFY: bool = false

Send a notification to tasks waiting to be notified if the value of DatabaseKey is modified

For instance, this can be used to be notified when a key in the database is created. It is also possible to run a closure with the value of the DatabaseKey as parameter to verify some changes to that value.

Required Methods§

Source

fn from_bytes( data: &[u8], modules: &ModuleDecoderRegistry, ) -> Result<Self, DecodingError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> DatabaseKey for T

Source§

const NOTIFY_ON_MODIFY: bool = <T as DatabaseRecord>::NOTIFY_ON_MODIFY