pub struct Database(/* private fields */);Implementations§
Source§impl Database
impl Database
pub fn open(path: &Path) -> Result<Database, Error>
pub fn open_with_min_len(path: &Path, min_len: u64) -> Result<Database, Error>
pub fn file_len(&self) -> Result<u64, Error>
pub fn set_min_len(&self, len: u64) -> Result<(), Error>
pub fn set_min_regions(&self, regions: usize) -> Result<(), Error>
pub fn get_region(&self, id: &str) -> Option<Region>
pub fn create_region_if_needed(&self, id: &str) -> Result<Region, Error>
pub fn write_all_to_region( &self, region: &Region, data: &[u8], ) -> Result<(), Error>
pub fn write_all_to_region_at( &self, region: &Region, data: &[u8], at: u64, ) -> Result<(), Error>
pub fn truncate_write_all_to_region( &self, region: &Region, at: u64, data: &[u8], ) -> Result<(), Error>
Sourcepub fn truncate_region(&self, region: &Region, from: u64) -> Result<(), Error>
pub fn truncate_region(&self, region: &Region, from: u64) -> Result<(), Error>
From relative to start
Non destructive
pub fn remove_region_with_id(&self, id: &str) -> Result<Option<Region>, Error>
pub fn remove_region(&self, region: Region) -> Result<Option<Region>, Error>
pub fn retain_regions(&self, ids: HashSet<String>) -> Result<(), Error>
pub fn mmap(&self) -> RwLockReadGuard<'_, RawRwLock, MmapMut>
pub fn regions(&self) -> RwLockReadGuard<'_, RawRwLock, Regions>
pub fn layout(&self) -> RwLockReadGuard<'_, RawRwLock, Layout>
Sourcepub fn open_read_only_file(&self) -> Result<File, Error>
pub fn open_read_only_file(&self) -> Result<File, Error>
Open a dedicated file handle for sequential reading This enables optimal kernel readahead for iteration
pub fn disk_usage(&self) -> String
pub fn flush(&self) -> Result<(), Error>
pub fn compact(&self) -> Result<(), Error>
pub fn path(&self) -> &Path
pub fn weak_clone(&self) -> WeakDatabase
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more