pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
Sourcepub fn snapshot_by_id(&self, id: SnapshotId) -> Option<Ref<Snapshot>>
pub fn snapshot_by_id(&self, id: SnapshotId) -> Option<Ref<Snapshot>>
Get a snapshot by its id, or None if no snapshot with that id exists
Sourcepub fn current_snapshot(&self) -> Option<Ref<Snapshot>>
pub fn current_snapshot(&self) -> Option<Ref<Snapshot>>
Get the current snapshot
Sourcepub fn set_current_snapshot(&self, value: &Snapshot)
pub fn set_current_snapshot(&self, value: &Snapshot)
Equivalent to Self::set_current_snapshot_id.
Sourcepub fn set_current_snapshot_id(&self, id: SnapshotId)
pub fn set_current_snapshot_id(&self, id: SnapshotId)
Sets the current snapshot to the SnapshotId.
No validation is done to ensure that the id is valid.
pub fn write_snapshot_data( &self, parents: &[SnapshotId], file: &BinaryView, name: &str, data: &KeyValueStore, auto_save: bool, ) -> SnapshotId
pub fn write_snapshot_data_with_progress<P>(
&self,
parents: &[SnapshotId],
file: &BinaryView,
name: &str,
data: &KeyValueStore,
auto_save: bool,
progress: P,
) -> SnapshotIdwhere
P: ProgressCallback,
Sourcepub fn trim_snapshot(&self, id: SnapshotId) -> Result<(), ()>
pub fn trim_snapshot(&self, id: SnapshotId) -> Result<(), ()>
Trim a snapshot’s contents in the database by id, but leave the parent/child hierarchy intact. Future references to this snapshot will return False for has_contents
Sourcepub fn remove_snapshot(&self, id: SnapshotId) -> Result<(), ()>
pub fn remove_snapshot(&self, id: SnapshotId) -> Result<(), ()>
Remove a snapshot in the database by id, deleting its contents and references. Attempting to remove a snapshot with children will raise an exception.
pub fn has_global(&self, key: &str) -> bool
Sourcepub fn global_keys(&self) -> Array<BnString>
pub fn global_keys(&self) -> Array<BnString>
Get a list of keys for all globals in the database
Sourcepub fn read_global(&self, key: &str) -> Option<BnString>
pub fn read_global(&self, key: &str) -> Option<BnString>
Get a specific global by key
Sourcepub fn write_global(&self, key: &str, value: &str) -> bool
pub fn write_global(&self, key: &str, value: &str) -> bool
Write a global into the database
Sourcepub fn read_global_data(&self, key: &str) -> Option<DataBuffer>
pub fn read_global_data(&self, key: &str) -> Option<DataBuffer>
Get a specific global by key, as a binary buffer
Sourcepub fn write_global_data(&self, key: &str, value: &DataBuffer) -> bool
pub fn write_global_data(&self, key: &str, value: &DataBuffer) -> bool
Write a binary buffer into a global in the database
Sourcepub fn file(&self) -> Ref<FileMetadata>
pub fn file(&self) -> Ref<FileMetadata>
Get the owning FileMetadata
Sourcepub fn analysis_cache(&self) -> Ref<KeyValueStore>
pub fn analysis_cache(&self) -> Ref<KeyValueStore>
Get the backing analysis cache kvs
pub fn reload_connection(&self)
pub fn write_analysis_cache(&self, val: &KeyValueStore) -> Result<(), ()>
pub fn snapshot_has_data(&self, id: SnapshotId) -> bool
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
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>
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>
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