httk.store.backend.mongo.stored_properties

Stored-property plans and exact query contexts for MongoDB.

The context builds the frozen neutral AST in httk.store.backend.mongo.evaluator. MongoDB supplies a conservative candidate stream and the existing verified iterator evaluates that AST over hydrated backing records.

Exceptions

MongoStoredPropertyConfigurationError

A Mongo entry family cannot realize its stored-property declaration.

Classes

MongoStoredPropertyCandidateStream

An ID-only Mongo candidate stream for a configured concrete backing.

MongoStoredPropertyPlan

Stored-property responses and verified Mongo candidate plans for one family.

Functions

stored_property_mongo_plan(store, family, *[, served])

Validate and return the Mongo property plan for one configured logical family.

Module Contents

exception httk.store.backend.mongo.stored_properties.MongoStoredPropertyConfigurationError

Bases: ValueError

A Mongo entry family cannot realize its stored-property declaration.

class httk.store.backend.mongo.stored_properties.MongoStoredPropertyCandidateStream

An ID-only Mongo candidate stream for a configured concrete backing.

backing: type
backing_name: str
searcher: Any
sort_count: int
timestamp_output: bool = False
class httk.store.backend.mongo.stored_properties.MongoStoredPropertyPlan(store, family, layout, entry_type, definition, backings)

Stored-property responses and verified Mongo candidate plans for one family.

property backings: tuple[type, Ellipsis]
records()
filter_searchers(filter_string, *, sort=(), public_id_prefix='', as_of=None, only_latest=False, revisions=False, alternatives=False)
candidate_searchers(filter_string=None, *, sort=(), public_id_prefix='', as_of=None, only_latest=False, revisions=False, alternatives=False)
response_row(backing, record, *, public_id=None, httk_id=None, revisions=False, kind=None, store_timestamp=None, fields=None)

Render one hydrated backing record at the protocol boundary.

Parameters:
  • backing (type) – The configured concrete record class.

  • record (object) – The hydrated backing record.

  • public_id (str | None) – The public id, or the record’s canonical id when omitted.

  • httk_id (str | None) – The plain group entry id rendered for _httk_id when serving revisions or alternatives.

  • revisions (bool) – Whether the row is served from a revision stream (synthesizes _httk_id).

  • kind (str | None) – The alternative kind rendered for _httk_kind when serving alternatives, else None.

  • store_timestamp (int | None) – An already-normalized candidate timestamp; otherwise the fallback lookup is used.

  • fields (collections.abc.Sequence[str] | None) – The response property names to render, or None to render every configured property.

Returns:

The protocol response row.

Return type:

collections.abc.Mapping[str, Any]

Candidate/federation rows carry this value; records() and entry-provider paths may use the fallback lookup.

httk.store.backend.mongo.stored_properties.stored_property_mongo_plan(store, family, *, served=None)

Validate and return the Mongo property plan for one configured logical family.

The family’s internal definition establishes identity only (that the family and its records agree on one durable definition). Everything the plan then serves — the entry type, the property set response and filter/sort validation run against, and the projection names backings must match — is taken from served: the OPTIMADE wire form of that definition (see EntryTypeDefinition.served_form()). A prefixed family declares its __httk_stored_properties__ projections under those served names, so it MUST be planned with served= set; without it the bare internal definition rejects the prefixed projection keys as unknown. When served is omitted the internal definition serves itself, which is byte-identical for standard (unprefixed) families.

Parameters:
  • store (Any) – The MongoStore containing the configured family.

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

  • served (httk.core.EntryTypeDefinition | None) – The served (wire) definition to serve, or None for the internal definition.

Returns:

The validated Mongo property plan.

Raises:

MongoStoredPropertyConfigurationError – If the family or any backing is inconsistent with its definition.

Return type:

MongoStoredPropertyPlan