pub trait StoredDatabase {
// Required methods
fn load(&self) -> Result<StoredClients, LoadError>;
fn load_group(&self, id: &str) -> Result<StoredGroup, LoadError>;
fn write(&self, ops: &[StorageOp]) -> Result<(), StorageFailure>;
fn flush(&self) -> Result<(), StorageFailure>;
fn close(&self) -> Result<(), StorageFailure>;
fn drop_database(&self);
}Expand description
An open database of a StorageBackend.
Writes may be done later, such as on another thread, but in order. A
failed write stops the writes after it, and is returned by the next
call that can return it; the client then runs on what it has in memory
and calls ZeroOptions::on_storage_failure.
Required Methods§
Sourcefn load(&self) -> Result<StoredClients, LoadError>
fn load(&self) -> Result<StoredClients, LoadError>
The client groups and clients, read once when the database opens.
Sourcefn load_group(&self, id: &str) -> Result<StoredGroup, LoadError>
fn load_group(&self, id: &str) -> Result<StoredGroup, LoadError>
The snapshot and pending mutations of group id; an empty group
when it has none.
Sourcefn write(&self, ops: &[StorageOp]) -> Result<(), StorageFailure>
fn write(&self, ops: &[StorageOp]) -> Result<(), StorageFailure>
Writes ops, in order, after the writes before, as one transaction.
Returns the failure of an earlier write.
Sourcefn flush(&self) -> Result<(), StorageFailure>
fn flush(&self) -> Result<(), StorageFailure>
Waits for the writes so far.
Sourcefn close(&self) -> Result<(), StorageFailure>
fn close(&self) -> Result<(), StorageFailure>
Closes the database once the writes so far are done.
Sourcefn drop_database(&self)
fn drop_database(&self)
Deletes the database, after the writes before. Later writes do nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".