Struct rustdb::atomfile::AtomicFile[][src]

pub struct AtomicFile {
    pub map: Mutex<BTreeMap<u64, DataSlice>>,
    pub stg: Box<dyn Storage>,
    pub upd: Box<dyn Storage>,
}
Expand description

AtomicFile makes sure that database updates are all-or-nothing. Keeps a list of outstanding writes which have not yet been written to the underlying file.

Fields

map: Mutex<BTreeMap<u64, DataSlice>>

Map of existing outstanding writes. Note the key is the file address of the last byte written.

stg: Box<dyn Storage>upd: Box<dyn Storage>

Implementations

Construct a new AtomicFle. stg is the main underlying storage, upd is temporary storage for updates during commit.

Trait Implementations

Finish write transaction, size is new size of underlying storage.

Get the size of the underlying storage. Note : this is valid initially and after a commit but is no updated by write operations. Read more

Read data from storage.

Write Data slice to storage.

Write byte slice to storage.

Write byte Vec to storage.

Write u64 to storage.

Read u64 from storage.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.