cadrumo.domain.calculations.registry.authority_store module

Read-only SQLite storage for generation-pinned authority components.

exception AuthorityStoreError(message=None, *, context=None, translated_message=None)[source]

Bases: CadrumoError

A published SQLite authority cannot be admitted or queried safely.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception AuthorityStoreCutoverError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthorityStoreError

A pin names another legitimate reader generation or incarnation.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
exception AuthorityStoreCorruptionError(message=None, *, context=None, translated_message=None)[source]

Bases: AuthorityStoreError

Content-addressed bytes or their declared component closure changed.

Parameters:
  • message (str | None)

  • context (Mapping[str, object] | None)

  • translated_message (str | None)

Return type:

None

code
class AuthorityDescriptor(database, database_size, database_sha256, logical_generation, format='cadrumo-authority-descriptor-v1')[source]

Bases: object

Small control record selecting one exact content-addressed database.

Parameters:
  • database (str)

  • database_size (int)

  • database_sha256 (str)

  • logical_generation (str)

  • format (str)

database: str
database_size: int
database_sha256: str
logical_generation: str
format: str
classmethod read(path)[source]

Read a closed canonical descriptor and confine its target to one directory.

Return type:

AuthorityDescriptor

Parameters:

path (Path)

to_bytes()[source]

Return canonical descriptor bytes containing no registry records.

Return type:

bytes

require_authority_store_available(descriptor_path)[source]

Quickly validate the descriptor-selected database dependency.

This startup probe validates the canonical descriptor and requires the confined database to be a regular file of the published size. Full digest, SQLite manifest, and component checks remain owned by SQLiteAuthorityReader when an authority operation is admitted.

Return type:

None

Parameters:

descriptor_path (Path)

class SQLiteAuthorityReader(descriptor_path, *, max_connections=4)[source]

Bases: object

Admitted reader with bounded connection checkout and generation-pinned loads.

Parameters:
  • descriptor_path (Path)

  • max_connections (int)

pin()[source]

Return this reader’s immutable logical-generation/incarnation identity.

Return type:

AuthorityGenerationPin

lease()[source]

Keep this reader resource alive for one top-level operation.

Return type:

Generator[AuthorityGenerationPin]

load(query, *, pin)[source]

Load and decode one component from exactly this admitted generation.

Identity is verified wherever this reader touches the database: when the lease takes its pin, and inside every uncached load. A cache hit reads no file and is served under the pin the lease already verified, so it does not re-stat the database. That is what keeps a command that loads thousands of components from paying a metadata query for each one.

Return type:

object

Parameters:
telemetry()[source]

Return retained component accounting, excluding connections and leases.

Return type:

AuthorityCacheTelemetry

component_queries()[source]

Iterate the complete component directory without hydrating payloads.

The directory is read once per admitted database: an admitted generation is immutable, and identity verification still runs on every call so a swapped file is refused rather than served from memory.

Return type:

tuple[TypeAliasType, ...]

property active_leases: int

Return the separately accounted number of top-level operation leases.

close()[source]

Close an unleased reader deterministically.

Return type:

None