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