httk.store.backend.mongo.entry_provider¶
Serve MongoDB-backed records through the neutral entry-provider contract.
Mongo entry identities are the store-managed physical id values carried
by the hydrated records.
Configured entry families are rendered through their Mongo stored-property plan;
configured backing records are also accepted for the schema-derived provider
surface used by the SQL provider’s parity tests.
Classes¶
Serve configured Mongo entry families or their concrete backings. |
Functions¶
|
Return the served |
|
Build a definition for the JSON-able fields of one backing class. |
Module Contents¶
- httk.store.backend.mongo.entry_provider.served_specs(schema, prefix)¶
Return the served
(name, field spec, fulltype)triples.- Parameters:
schema (httk.store.backend.schema.TableSchema) – The resolved schema whose fields are inspected.
prefix (str) – The registered prefix used for served property names.
- Returns:
One triple for every non-intrinsic schema field with an OPTIMADE value type. The store-managed
idandimmutable_idfields are intentionally omitted because serving layers expose them intrinsically.- Return type:
- httk.store.backend.mongo.entry_provider.auto_definition(entry_type, schema, prefix)¶
Build a definition for the JSON-able fields of one backing class.
- class httk.store.backend.mongo.entry_provider.StoreEntryProvider(store, classes, *, definitions=None, prefix='_httk_', id_of=None, only_latest=True)¶
Bases:
httk.core.EntryProviderServe configured Mongo entry families or their concrete backings.
classesmaps public entry-type names to either configured entry-family classes or configured concrete backing classes. Family classes use the family’sMongoStoredPropertyPlan; backing classes use the same schema-derived property contract as the SQL provider.id_ofreceives(entry_type, sid, hydrated_record)and defaults to the record’s storedidfield.only_latestrestricts served searchers’ root variables to the latest document of each lineage.- entry_types()¶
Return definitions for all served entry types.
This provider is an OPTIMADE serving edge, so each definition is returned in its wire form via
EntryTypeDefinition.served_form()(idempotent for the already-prefixed supplied and auto-generated definitions).- Returns:
The served entry-type definitions keyed by entry type.
- Return type:
- property_keys(entry_type)¶
Return public property names mapped to Mongo response keys.
- records(entry_type)¶
Yield JSON-able records for one served entry type.
- relationships(entry_type)¶
Return relationships grouped by source id, including provenance edges.
Related entries come from stored reference fields, child fields, exposed weak links, and StrongLink provenance edges in both directions: a run’s own edges under their forward wire key, and the derived reverse edges naming the runs pointing at each served target under their reverse wire key. The reverse view is store-scoped; it is lineage-level (latest main run revisions only), matching the SQL provider, under the default
only_latest=True(see_reverse_edge_indexfor theonly_latest=Falsecaveat).- Parameters:
entry_type (str) – The served entry type whose relationships are read.
- Returns:
Related entries keyed by source entry id.
- Raises:
KeyError – If
entry_typeis not served.- Return type:
collections.abc.Mapping[str, tuple[httk.core.RelatedEntry, Ellipsis]]