httk.serve.optimade.backend.stores¶
Build an OPTIMADE adapter over lazy SQL-backed entry federation.
The durable layout, SQL translation, collision policy, and bounded global
pagination live in httk.store.db. This module owns only the serving
boundary: the advertised OPTIMADE schema, request-error translation, public
response-field projection, and ResultRow
objects consumed by the endpoint envelope code.
Imports from httk.store.db deliberately remain inside call sites. Importing
httk.serve.optimade therefore does not initialize a database backend or
load optional SQL dialects.
Classes¶
Serve one data federation per OPTIMADE entry type. |
Functions¶
|
Build a lazy store-backed adapter from durable entry sources. |
|
Build a lazy OPTIMADE adapter from every described family in one store. |
Module Contents¶
- class httk.serve.optimade.backend.stores.StoredBackendAdapter[source]¶
Serve one data federation per OPTIMADE entry type.
- Parameters:
federations – Durable federations keyed by entry endpoint.
schema – Schema describing the federations’ served entries.
- federations: collections.abc.Mapping[str, Any][source]¶
- snapshot_cutoff_ns(entry_type, now_ns)[source]¶
Return the resolution-aware snapshot cutoff for one entry type.
- httk.serve.optimade.backend.stores.adapter_from_stores(sources, **options)[source]¶
Build a lazy store-backed adapter from durable entry sources.
Sources with the same exact logical family are federated under one entry endpoint. The data layer owns all source/backing traversal and global pagination; this adapter advertises the family’s definition and turns only the returned page into OPTIMADE result rows.
- Parameters:
sources (collections.abc.Sequence[httk.store.db.StoredEntrySource]) – Durable entry sources to federate by entry type.
**options (Any) – Schema options forwarded to
build_served_schema().
- Returns:
Lazy adapter over the supplied durable sources.
- Raises:
ValueError – If sources conflict or expose incomplete sort mappings.
TypeError – If a source is not a stored entry source.
- Return type:
- httk.serve.optimade.backend.stores.adapter_from_store(store, **options)[source]¶
Build a lazy OPTIMADE adapter from every described family in one store.
Families declared without an entry-type definition are deliberately ignored. This lets application-specific records, such as DSP publication declarations, coexist with OPTIMADE records in one durable layout.
- Parameters:
store (httk.store.EntryStore) – Entry store whose configured layout is discovered.
**options (Any) – Schema options forwarded to
adapter_from_stores().
- Returns:
Lazy adapter over all configured OPTIMADE families.
- Raises:
TypeError – If
storedoes not implementEntryStore.ValueError – If the store contains no OPTIMADE-described family.
- Return type: