pub trait MetadataProvider: Send {
// Required method
fn get_metadata(&self, key: &str) -> Result<Option<Vec<u8>>, ProviderError>;
// Provided methods
fn storage_settings(&self) -> Result<Option<StorageSettings>, ProviderError> { ... }
fn snap_attempt(&self) -> Result<Option<SnapAttempt>, ProviderError> { ... }
}Available on crate features
db-api and storage-api only.Expand description
Client trait for reading node metadata from the database.
Required Methods§
Sourcefn get_metadata(&self, key: &str) -> Result<Option<Vec<u8>>, ProviderError>
fn get_metadata(&self, key: &str) -> Result<Option<Vec<u8>>, ProviderError>
Get a metadata value by key
Provided Methods§
Sourcefn storage_settings(&self) -> Result<Option<StorageSettings>, ProviderError>
fn storage_settings(&self) -> Result<Option<StorageSettings>, ProviderError>
Get storage settings for this node.
If the stored metadata can’t be deserialized (e.g. the format changed),
this returns None instead of an error so commands like db clear can
still operate without requiring a compatible metadata schema.
Sourcefn snap_attempt(&self) -> Result<Option<SnapAttempt>, ProviderError>
fn snap_attempt(&self) -> Result<Option<SnapAttempt>, ProviderError>
Returns the snap synchronization attempt that owns the downloaded state.
Unlike Self::storage_settings, an unreadable record is an error: its state is already
in the canonical tables, so reporting it absent would let the node adopt it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".