synology_apm_repo.sdk.units.saas.objectdb module¶
Embedded ObjectDB: object_id -> (offset, length) inside a
saas_obj. It has no file_map path of its own: it is a small
SQLite file embedded in the stream’s dedup content.
It is located only by an object_db_id string
("<streamUuid>_<offset>_<length>"), normally read from the version’s
object-name index (object_name_index.py); a caller may also pass one
by hand (the CLI’s --object-db-id).
- synology_apm_repo.sdk.units.saas.objectdb.parse_object_db_id(object_db_id)¶
Parse an
object_db_idstring ("<streamUuid>_<offset>_<length>") into(stream_uuid, offset, length).- Raises:
NotFoundError –
object_db_idisn’t shaped like<text>_<int>_<int>, each<int>ASCII digits only.
- synology_apm_repo.sdk.units.saas.objectdb.name_object_id_pairs(items)¶
The
(name, object_id)pairs in a parseddb_objectsJSON array ([{"name": str, "object_id": str}, ...]), silently dropping malformed entries;[]whenitemsisn’t a list.
- class synology_apm_repo.sdk.units.saas.objectdb.ObjectDb¶
Bases:
AsyncClosingobject_id -> (offset, length)lookup backed by one embedded ObjectDB slice, materialized viaSqliteSource. Build one withfrom_bytesorload.- async classmethod from_bytes(data)¶
Open
data(one ObjectDB slice) as SQLite.- Raises:
DataCorruptError –
datadoesn’t decode or has no validobject_table.sqlite3.DatabaseError –
datais not SQLite.ResourceLimitExceededError – Its temporary copy doesn’t fit in free disk space with the reserve left free.
- async classmethod load(dedup_file, offset, length)¶
- async close()¶
- async get(object_id)¶
- async get_many(object_ids)¶
object_id -> (offset, length)for every id inobject_idsthat has a row, in one query; ids without a row are left out.
- async object_map()¶
The full
object_id -> (offset, length)mapping, ordered byobject_idso pagination over it is stable.
- async synology_apm_repo.sdk.units.saas.objectdb.read_object(object_db, dedup_file, object_id, *, expected_size=None)¶
Read one object’s bytes eagerly, for a caller that parses them (META JSON, mail fragments). Content handed back unmodified should stay a lazy
dedup_file.view()instead.- Raises:
NotFoundError –
object_idhas noobject_tablerow.DataCorruptError –
expected_sizeis given and the read length differs.