use core::fmt::Debug;
use fuel_core_storage::kv_store::StorageColumn;
pub mod off_chain;
pub mod on_chain;
pub mod relayer;
pub trait DatabaseDescription: 'static + Clone + Debug + Send + Sync {
type Column: StorageColumn + strum::EnumCount + enum_iterator::Sequence;
type Height: Default + Copy;
fn version() -> u32;
fn name() -> &'static str;
fn metadata_column() -> Self::Column;
fn prefix(column: &Self::Column) -> Option<usize>;
}
#[derive(Copy, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub enum DatabaseMetadata<Height> {
V1 { version: u32, height: Height },
}
impl<Height> DatabaseMetadata<Height> {
pub fn version(&self) -> u32 {
match self {
Self::V1 { version, .. } => *version,
}
}
pub fn height(&self) -> &Height {
match self {
Self::V1 { height, .. } => height,
}
}
}