pub struct Database { /* private fields */ }
Expand description
Append-only database. Can be safely cloned and used from different threads.
Implementations§
Source§impl Database
impl Database
Sourcepub fn file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Open the database. Will create one if not exists.
Sourcepub fn append(&self, records: &[&[u8]]) -> Result<(), Error>
pub fn append(&self, records: &[&[u8]]) -> Result<(), Error>
Write an array of records to the database. This function will block if another write is still in progress.
Sourcepub fn get_by_seqno(&self, seqno: usize) -> Option<SharedMmap>
pub fn get_by_seqno(&self, seqno: usize) -> Option<SharedMmap>
Get a record by its sequential number.
Sourcepub fn iter_from_seqno(&self, seqno: usize) -> Option<SeqNoIter>
pub fn iter_from_seqno(&self, seqno: usize) -> Option<SeqNoIter>
Iterate records in the order they were added starting form the given sequential number.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
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