pub trait Database: Send + Sync {
// Required methods
fn get(
&self,
column_family: &str,
key: &[u8],
) -> Result<Option<Vec<u8>>, DatabaseError>;
fn put(
&self,
column_family: &str,
key: &[u8],
value: &[u8],
) -> Result<(), DatabaseError>;
fn delete(
&self,
column_family: &str,
key: &[u8],
) -> Result<(), DatabaseError>;
fn iter_prefix(
&self,
column_family: &str,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, DatabaseError>;
}Expand description
Database trait for abstracting storage operations Implementations can use RocksDB, in-memory storage, or other backends
Required Methods§
Sourcefn get(
&self,
column_family: &str,
key: &[u8],
) -> Result<Option<Vec<u8>>, DatabaseError>
fn get( &self, column_family: &str, key: &[u8], ) -> Result<Option<Vec<u8>>, DatabaseError>
Get a value from the database
Sourcefn put(
&self,
column_family: &str,
key: &[u8],
value: &[u8],
) -> Result<(), DatabaseError>
fn put( &self, column_family: &str, key: &[u8], value: &[u8], ) -> Result<(), DatabaseError>
Put a key-value pair into the database