httk.store.store_common

Backend-neutral save-path machinery shared by storage backends.

Exceptions

EntryIdConflictError

An entry id is already owned by a different lineage or alternative group.

EntryMetadataConflictError

Stored identity-excluded metadata differs from a repeated save.

EntryReplacementError

A replacement deduplicated onto a row from a different lineage.

EntryDispatchIntegrityError

A persisted entry dispatch row does not name exactly its expected backing.

Classes

EntryIdScheme

Configuration used to mint human-readable entry identifiers.

EntryStore

The store surface consumed by httk.store.backend.sql.stored_federation.

SaveProjection

One-save projection cache shared by core identity and SQL encoding.

IdentityCaches

Weak identity caches shared by storage backends.

Functions

reject_cursor_proxy(obj)

Reject a lazy cursor row before a backend attempts to save it.

Module Contents

class httk.store.store_common.EntryIdScheme[source]

Configuration used to mint human-readable entry identifiers.

Parameters:
  • base – Dot-separated database namespace.

  • series – Campaign-series token.

  • type_in_base – Whether the served entry type is appended to base.

base: str[source]
series: str[source]
type_in_base: bool = False[source]
exception httk.store.store_common.EntryIdConflictError(table_name, entry_id, existing_logical_id, requested_logical_id)[source]

Bases: ValueError

An entry id is already owned by a different lineage or alternative group.

Parameters:
  • table_name (str) – The table containing the conflicting identifier.

  • entry_id (str) – The conflicting entry identifier.

  • existing_logical_id (int | None) – The lineage or group already owning the identifier.

  • requested_logical_id (int | None) – The lineage or group requesting it, when known.

table_name[source]
entry_id[source]
existing_logical_id[source]
requested_logical_id[source]
class httk.store.store_common.EntryStore[source]

Bases: Protocol

The store surface consumed by httk.store.backend.sql.stored_federation.

This protocol deliberately describes the small backend seam used by the federation. The stored-property plan and candidate-stream objects remain backend-specific; their SQL implementations use searcher().

property entry_layout: tuple[httk.store.storage_layout.EntryFamilyLayout, ...][source]

Return the configured entry-family layouts in stable order.

searcher(*, as_of=None)[source]

Return a backend searcher used to build candidate ID streams.

fetch(cls, sid, *, eager=False)[source]

Fetch the stored record of cls identified by sid.

Parameters:
  • cls (type[_StoredRecord]) – The storable record class.

  • sid (int) – The stored row identifier to fetch.

  • eager (bool) – Whether to fully materialize the record instead of returning a lazy row.

Returns:

The reconstructed instance.

Return type:

_StoredRecord

fetch_many(cls, sids, *, eager=False)[source]

Fetch the stored records of cls identified by sids.

Batched counterpart of fetch().

Parameters:
  • cls (type[_StoredRecord]) – The storable record class.

  • sids (collections.abc.Sequence[int]) – The stored row identifiers to fetch.

  • eager (bool) – Whether to fully materialize each record instead of returning lazy rows.

Returns:

The reconstructed instances in sids order.

Raises:

KeyError – When any requested row is absent.

Return type:

list[_StoredRecord]

stored_property_plan(family)[source]

Return the backend-specific stored-property plan for one family.

Parameters:

family (type) – The logical entry-family class to plan.

Returns:

The validated stored-property plan consumed by federation.

Return type:

Any

exception httk.store.store_common.EntryMetadataConflictError[source]

Bases: ValueError

Stored identity-excluded metadata differs from a repeated save.

exception httk.store.store_common.EntryReplacementError(table_name, predecessor_logical_id, conflicting_logical_id)[source]

Bases: ValueError

A replacement deduplicated onto a row from a different lineage.

Parameters:
  • table_name (str) – The table (or collection) whose replacement failed.

  • predecessor_logical_id (int) – The logical_id of the intended predecessor.

  • conflicting_logical_id (int) – The logical_id of the row actually hit.

table_name[source]
predecessor_logical_id[source]
conflicting_logical_id[source]
exception httk.store.store_common.EntryDispatchIntegrityError[source]

Bases: RuntimeError

A persisted entry dispatch row does not name exactly its expected backing.

class httk.store.store_common.SaveProjection(*, store_timestamp=None)[source]

One-save projection cache shared by core identity and SQL encoding.

store_timestamp = None[source]
values_by_source: dict[tuple[type, int], collections.abc.Mapping[str, object]][source]
validated: set[tuple[type, int]][source]
metadata_rows: dict[tuple[type, int], collections.abc.Mapping[str, Any]][source]
metadata_children: dict[tuple[type, int, str], Any][source]
metadata_content_ids: dict[tuple[type, int], str][source]
active: set[tuple[type, int]][source]
inserted: list[tuple[type, int]] = [][source]
projector(record_type, source)[source]
content_id(record_type, source, *, extras=None)[source]
httk.store.store_common.reject_cursor_proxy(obj)[source]

Reject a lazy cursor row before a backend attempts to save it.

class httk.store.store_common.IdentityCaches[source]

Weak identity caches shared by storage backends.