synology_apm_repo.sdk.units.saas.object_name_index module¶
The per-version object-name index the connector records in
copy_target_version’s additional_meta: which object holds each
named service DB, and the ObjectDB location
(<stream_uuid>_<offset>_<length>) that maps them. Plus the shared
lookup helpers SaaS providers’ secondary-table reads build on.
Every function here returns None rather than raising when the index
isn’t recorded or a lookup can’t be completed; a store failure still
raises.
- synology_apm_repo.sdk.units.saas.object_name_index.DEGRADABLE_OPEN_ERRORS: tuple[type[Exception], ...] = (<class 'sqlite3.DatabaseError'>, <class 'synology_apm_repo.sdk.errors.DataCorruptError'>, <class 'synology_apm_repo.sdk.errors.ResourceLimitExceededError'>)¶
The errors meaning “this candidate isn’t a safely-openable service DB/ObjectDB”, caught wherever a SaaS provider reads and opens one speculatively: corruption, or a size over a safety ceiling or over the free disk space above the reserve.
- class synology_apm_repo.sdk.units.saas.object_name_index.ObjectNameIndex(stream_uuid, offset, length, object_ids)¶
Bases:
objectOne version’s object-name index: indexed db name -> object_id (
object_ids), resolved through the ObjectDB atoffset/lengthin streamstream_uuid.
- async synology_apm_repo.sdk.units.saas.object_name_index.resolve_object_name_index(repo, version)¶
version’s object-name index, orNonewhen none is recorded (nocopy_target_versionrow, an unreadableversion_spec, or a missing/malformedadditional_meta, e.g. an older connector; a field of the wrong JSON type counts as missing). Doesn’t validate the ObjectDB it points at.
- class synology_apm_repo.sdk.units.saas.object_name_index.ResolvedServiceDb(object_id, source)¶
Bases:
NamedTupleA service DB
resolve_service_dbopened: the indexobject_idit came from, and its opensource(the caller closes it).- source: SqliteSource¶
Alias for field number 1
- async synology_apm_repo.sdk.units.saas.object_name_index.resolve_service_db(dedup_file, object_db, object_name_index, object_names, table_name)¶
Open the service DB defining
table_name: tries eachobject_namesalias in order againstobject_db(the index’s loaded ObjectDB), returning the first that exists, opens, and definestable_name; one whose DB can’t be opened or whose schema can’t be read (DEGRADABLE_OPEN_ERRORS) is skipped.Nonewhen no alias resolves.
- async synology_apm_repo.sdk.units.saas.object_name_index.read_indexed_table(dedup_file, object_name_index, object_names, table_name, reader, *, object_db=None)¶
Best-effort one-shot read of a secondary table (folder, label and group name tables): opens it via
resolve_service_db, hands its connection toreader, and closes it.Nonewhen there’s no index, no alias resolves, or the read hits corruption or schema drift — callers treat the result as optional enrichment and show less without it.object_dbis the index’s ObjectDB if the caller already holds it; otherwise one is loaded and closed here.
- async synology_apm_repo.sdk.units.saas.object_name_index.read_id_to_name_map(dedup_file, object_name_index, object_names, table_name, *, id_column, name_column, object_db=None)¶
read_indexed_tablefor a folder/label/group definitions table:{str(id_column): str(name_column)}, orNone.
- async synology_apm_repo.sdk.units.saas.object_name_index.read_grouped_names(dedup_file, object_name_index, *, definition_names, definition_table, id_column, name_column, membership_names, membership_table, item_column, group_column, object_db=None, membership_connection=None)¶
Best-effort
item_id -> [group/label names]map joining a definitions table (id_column -> name_column) with a membership table (item_column,group_column) — GWS’s mail labels and contact groups.Noneif either half is unavailable; a group id with no definition shows as the raw id.membership_connection, themembership_namesDB when the caller already holds it open, is queried in place of opening it again, if it definesmembership_table.