database module¶
Class |
Description |
---|---|
|
|
|
|
|
- class Database[source]
Bases:
object
class Database
provides lower level access to raw snapshot data used to construct analysis data- __init__(handle)[source]
- 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[source]
Bases:
object
class KeyValueStore
maintains access to the raw data stored in Snapshots and various other Database-related structures.- __init__(buffer: DataBuffer | None = None, handle=None)[source]
- Parameters:
buffer (DataBuffer | None) –
- end_namespace()[source]
End storing new keys into a namespace
- 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 data_size: int
Length of serialized data (read-only)
- property empty: bool
If the kvs is empty (read-only)
- property keys
Get a list of all keys stored in the kvs (read-only)
- property namespace_size: int
Number of namespaces pushed with begin_namespace (read-only)
- property serialized_data: DataBuffer
Get the stored representation of the kvs (read-only)
- property value_size: int
Number of values in the kvs (read-only)
- property value_storage_size: int
Size of all data in storage (read-only)
- class Snapshot[source]
Bases:
object
class Snapshot
is a model of an individual database snapshot, created on save.- __init__(handle)[source]
- property data: KeyValueStore
Get the backing kvs data with snapshot fields (read-only)
- property database: Database
Get the owning database (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 has_contents: bool
If the snapshot has contents, and has not been trimmed (read-only)
- property has_undo: bool
If the snapshot has undo data (read-only)
- property id: int
Get the numerical id (read-only)
- property is_auto_save: bool
If the snapshot was the result of an auto-save (read-only)
- property name: str
Get the displayed snapshot name
- property undo_entries
Get a list of undo entries at the time of the snapshot (read-only)
Database¶
- class Database[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)
KeyValueStore¶
- class KeyValueStore[source]¶
Bases:
object
class KeyValueStore
maintains access to the raw data stored in Snapshots and various other Database-related structures.- __init__(buffer: DataBuffer | None = None, handle=None)[source]¶
- 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)
Snapshot¶
- class Snapshot[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)