Struct rustdb::atomfile::AtomicFile
source · pub struct AtomicFile {
pub stg: Box<dyn Storage>,
pub upd: Box<dyn Storage>,
/* private fields */
}
Expand description
AtomicFile makes sure that database updates are all-or-nothing. Keeps a map of outstanding writes which have not yet been written to the underlying file.
Fields§
§stg: Box<dyn Storage>
The main underlying storage.
upd: Box<dyn Storage>
Temporary storage for updates during commit.
Implementations§
source§impl AtomicFile
impl AtomicFile
sourcepub fn new(stg: Box<dyn Storage>, upd: Box<dyn Storage>) -> Box<Self>
pub fn new(stg: Box<dyn Storage>, upd: Box<dyn Storage>) -> Box<Self>
Construct a new AtomicFle. stg is the main underlying storage, upd is temporary storage for updates during commit.
sourcepub fn commit_phase(&mut self, size: u64, phase: u8)
pub fn commit_phase(&mut self, size: u64, phase: u8)
Perform the specified phase ( 1 or 2 ) of a two-phase commit.
Trait Implementations§
source§impl Storage for AtomicFile
impl Storage for AtomicFile
source§fn commit(&mut self, size: u64)
fn commit(&mut self, size: u64)
Finish write transaction, size is new size of underlying storage.
source§fn size(&self) -> u64
fn size(&self) -> u64
Get the size of the underlying storage.
Note : this is valid initially and after a commit but is not defined after write is called.
Auto Trait Implementations§
impl !RefUnwindSafe for AtomicFile
impl Send for AtomicFile
impl Sync for AtomicFile
impl Unpin for AtomicFile
impl !UnwindSafe for AtomicFile
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more