pub trait StorageExtension: Extension {
// Required methods
fn get(
&self,
table_id: TableId,
key: &[u8],
) -> KernelResult<Option<Vec<u8>>>;
fn put(
&self,
table_id: TableId,
key: &[u8],
value: &[u8],
txn_id: TransactionId,
) -> KernelResult<()>;
fn delete(
&self,
table_id: TableId,
key: &[u8],
txn_id: TransactionId,
) -> KernelResult<()>;
fn scan(
&self,
table_id: TableId,
start: &[u8],
end: &[u8],
limit: usize,
) -> KernelResult<Vec<(Vec<u8>, Vec<u8>)>>;
fn flush(&self) -> KernelResult<()>;
// Provided methods
fn compact(&self) -> KernelResult<()> { ... }
fn stats(&self) -> StorageStats { ... }
}Expand description
Storage backend extension
Implement this to provide alternative storage engines (LSCS, RocksDB, etc.)
Required Methods§
Sourcefn get(&self, table_id: TableId, key: &[u8]) -> KernelResult<Option<Vec<u8>>>
fn get(&self, table_id: TableId, key: &[u8]) -> KernelResult<Option<Vec<u8>>>
Read data for a key
Sourcefn put(
&self,
table_id: TableId,
key: &[u8],
value: &[u8],
txn_id: TransactionId,
) -> KernelResult<()>
fn put( &self, table_id: TableId, key: &[u8], value: &[u8], txn_id: TransactionId, ) -> KernelResult<()>
Write data for a key
Sourcefn delete(
&self,
table_id: TableId,
key: &[u8],
txn_id: TransactionId,
) -> KernelResult<()>
fn delete( &self, table_id: TableId, key: &[u8], txn_id: TransactionId, ) -> KernelResult<()>
Delete a key
Sourcefn scan(
&self,
table_id: TableId,
start: &[u8],
end: &[u8],
limit: usize,
) -> KernelResult<Vec<(Vec<u8>, Vec<u8>)>>
fn scan( &self, table_id: TableId, start: &[u8], end: &[u8], limit: usize, ) -> KernelResult<Vec<(Vec<u8>, Vec<u8>)>>
Scan a range of keys
Sourcefn flush(&self) -> KernelResult<()>
fn flush(&self) -> KernelResult<()>
Flush pending writes
Provided Methods§
Sourcefn compact(&self) -> KernelResult<()>
fn compact(&self) -> KernelResult<()>
Compact storage (if applicable)
Sourcefn stats(&self) -> StorageStats
fn stats(&self) -> StorageStats
Get storage statistics