Skip to main content

StoredDatabase

Trait StoredDatabase 

Source
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§

Source

fn load(&self) -> Result<StoredClients, LoadError>

The client groups and clients, read once when the database opens.

Source

fn load_group(&self, id: &str) -> Result<StoredGroup, LoadError>

The snapshot and pending mutations of group id; an empty group when it has none.

Source

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.

Source

fn flush(&self) -> Result<(), StorageFailure>

Waits for the writes so far.

Source

fn close(&self) -> Result<(), StorageFailure>

Closes the database once the writes so far are done.

Source

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".

Implementors§