pub trait Diskwhere
for<'a> Self: 'a,{
type C<'a>: Cursor;
// Required methods
fn initialize(&mut self, conf: DbConf) -> Result<(), LsmErrorCode>;
fn connect(&mut self) -> Result<(), LsmErrorCode>;
fn disconnect(&mut self) -> Result<(), LsmErrorCode>;
fn persist(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>;
fn update(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>;
fn delete(&mut self, key: &[u8]) -> Result<(), LsmErrorCode>;
fn delete_range(
&mut self,
begin: &[u8],
end: &[u8],
) -> Result<(), LsmErrorCode>;
fn optimize(&mut self) -> Result<(), LsmErrorCode>;
fn begin_transaction(&mut self) -> Result<(), LsmErrorCode>;
fn commit_transaction(&mut self) -> Result<(), LsmErrorCode>;
fn rollback_transaction(&mut self) -> Result<(), LsmErrorCode>;
fn cursor_open(&self) -> Result<Self::C<'_>, LsmErrorCode>;
}Expand description
Primary set of methods of a database.
Required Associated Types§
Required Methods§
Sourcefn initialize(&mut self, conf: DbConf) -> Result<(), LsmErrorCode>
fn initialize(&mut self, conf: DbConf) -> Result<(), LsmErrorCode>
Initializes a database with a given configuration (of type DbConf).
Sourcefn connect(&mut self) -> Result<(), LsmErrorCode>
fn connect(&mut self) -> Result<(), LsmErrorCode>
Connects to a database on disk.
Sourcefn disconnect(&mut self) -> Result<(), LsmErrorCode>
fn disconnect(&mut self) -> Result<(), LsmErrorCode>
Disconnects from a database on disk.
Sourcefn persist(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>
fn persist(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>
Persists a given value under the given key. Observe that both fields
are given as a set of bytes.
Sourcefn update(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>
fn update(&mut self, key: &[u8], value: &[u8]) -> Result<(), LsmErrorCode>
Updates the value stored under key to the given value.
Sourcefn delete(&mut self, key: &[u8]) -> Result<(), LsmErrorCode>
fn delete(&mut self, key: &[u8]) -> Result<(), LsmErrorCode>
Deletes the value stored under key.
Sourcefn delete_range(&mut self, begin: &[u8], end: &[u8]) -> Result<(), LsmErrorCode>
fn delete_range(&mut self, begin: &[u8], end: &[u8]) -> Result<(), LsmErrorCode>
Deletes all stored values in the open interval (begin, end).
Sourcefn optimize(&mut self) -> Result<(), LsmErrorCode>
fn optimize(&mut self) -> Result<(), LsmErrorCode>
Optimizes the database in certain way. This is implementation-defined. For
example, currently lsmlite-rs optimizes the database for write-once, read-many
workloads (for space and read efficiency). Other underlying implementations
might have different optimization opportunities.
Sourcefn begin_transaction(&mut self) -> Result<(), LsmErrorCode>
fn begin_transaction(&mut self) -> Result<(), LsmErrorCode>
Opens a transaction explicitly.
Sourcefn commit_transaction(&mut self) -> Result<(), LsmErrorCode>
fn commit_transaction(&mut self) -> Result<(), LsmErrorCode>
Commits the operations contained in the current transaction.
Sourcefn rollback_transaction(&mut self) -> Result<(), LsmErrorCode>
fn rollback_transaction(&mut self) -> Result<(), LsmErrorCode>
Rollbacks the operations contained in the current transaction.
Sourcefn cursor_open(&self) -> Result<Self::C<'_>, LsmErrorCode>
fn cursor_open(&self) -> Result<Self::C<'_>, LsmErrorCode>
Opens a database cursor.
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.