database module¶
Class | Description |
|---|---|
| |
| |
|
Database¶
- classDatabase[source]¶
Bases:
objectclassDatabaseprovides lower level access to raw snapshot data used to construct analysis data- get_snapshot(id:int)→Snapshot|None[source]¶
Get a snapshot by its id, or None if no snapshot with that id exists
- read_global_data(key:str)→DataBuffer[source]¶
Get a specific global by key, as a binary buffer
- Parameters:
key (str) –
- Return type:
- remove_snapshot(id:int)[source]¶
Remove a snapshot in the database by id, deleting its contents and references.Attempting to remove a snapshot with children will raise an exception.
- Parameters:
id (int) –
- trim_snapshot(id:int)[source]¶
Trim a snapshot’s contents in the database by id, but leave the parent/childhierarchy intact. Future references to this snapshot will return False for has_contents
- Parameters:
id (int) –
- write_global_data(key:str,value:DataBuffer)[source]¶
Write a binary buffer into a global in the database
- Parameters:
key (str) –
value (DataBuffer) –
- propertyanalysis_cache:KeyValueStore¶
Get the backing analysis cache kvs (read-only)
- propertyfile:FileMetadata¶
Get the owning FileMetadata (read-only)
KeyValueStore¶
- classKeyValueStore[source]¶
Bases:
objectclassKeyValueStoremaintains access to the raw data stored in Snapshots and variousother Database-related structures.- __init__(buffer:DataBuffer|None=None,handle=None)[source]¶
- Parameters:
buffer (DataBuffer |None) –
- get_value(key:str)→DataBuffer[source]¶
Get the value for a single key
- Parameters:
key (str) –
- Return type:
- set_value(key:str,value:DataBuffer)[source]¶
Set the value for a single key
- Parameters:
key (str) –
value (DataBuffer) –
- propertykeys¶
Get a list of all keys stored in the kvs (read-only)
- propertyserialized_data:DataBuffer¶
Get the stored representation of the kvs (read-only)
Snapshot¶
- classSnapshot[source]¶
Bases:
objectclassSnapshotis a model of an individual database snapshot, created on save.- propertydata:KeyValueStore¶
Get the backing kvs data with snapshot fields (read-only)
- propertyfile_contents:DataBuffer¶
Get a buffer of the raw data at the time of the snapshot (read-only)
- propertyfile_contents_hash:DataBuffer¶
Get a hash of the data at the time of the snapshot (read-only)
- propertyfirst_parent:Snapshot|None¶
Get the first parent of the snapshot, or None if it has no parents (read-only)
- propertyundo_entries¶
Get a list of undo entries at the time of the snapshot (read-only)