database module¶
|
|
|
|
|
|
- class Database(handle)[source]¶
Bases:
object
class Database
provides 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/child hierarchy 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) –
- property analysis_cache: KeyValueStore¶
Get the backing analysis cache kvs (read-only)
- property file: FileMetadata¶
Get the owning FileMetadata (read-only)
- class KeyValueStore(buffer: DataBuffer | None = None, handle=None)[source]¶
Bases:
object
class KeyValueStore
maintains access to the raw data stored in Snapshots and various other Database-related structures.- Parameters:
buffer (DataBuffer | None) –
- begin_namespace(name: str)[source]¶
Begin storing new keys into a namespace
- Parameters:
name (str) –
- 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) –
- property keys¶
Get a list of all keys stored in the kvs (read-only)
- property serialized_data: DataBuffer¶
Get the stored representation of the kvs (read-only)
- class Snapshot(handle)[source]¶
Bases:
object
class Snapshot
is a model of an individual database snapshot, created on save.- property data: KeyValueStore¶
Get the backing kvs data with snapshot fields (read-only)
- property file_contents: DataBuffer¶
Get a buffer of the raw data at the time of the snapshot (read-only)
- property file_contents_hash: DataBuffer¶
Get a hash of the data at the time of the snapshot (read-only)
- property first_parent: Snapshot | None¶
Get the first parent of the snapshot, or None if it has no parents (read-only)
- property undo_entries¶
Get a list of undo entries at the time of the snapshot (read-only)