httk.store.backend.mongo.evaluator

Exact three-valued evaluation for Mongo stored-property predicates.

The Mongo query path deliberately evaluates this small, frozen AST over hydrated records. That is important for child records: document storage keeps their content-addressed SID links, while MongoStore.fetch gives the evaluator their exact Python values.

Classes

MongoScope

A root, child, reference, or filtered record-object scope.

MongoValue

A field, aggregate, null, or literal value in the neutral AST.

MongoPredicate

A frozen three-valued predicate in the neutral stored-property AST.

Functions

evaluate(predicate, record[, ...])

Evaluate predicate exactly over a hydrated backing object.

canonical_predicate(predicate)

Return canonical JSON used as the verifier identity and cursor input.

Module Contents

class httk.store.backend.mongo.evaluator.MongoScope

A root, child, reference, or filtered record-object scope.

identifier: int
schema: httk.store.backend.schema.TableSchema
parent: MongoScope | None = None
relationship: httk.store.backend.schema.FieldSpec | None = None
filter_predicate: MongoPredicate | None = None
scalar_child: bool = False
context: Any = None
field(name)

Select a scalar field from this scope.

scope(name)

Follow one child or reference relationship from this scope.

class httk.store.backend.mongo.evaluator.MongoValue

A field, aggregate, null, or literal value in the neutral AST.

kind: Literal['field', 'store_timestamp', 'logical_id', 'alt_kind', 'alternative_id', 'present', 'constant', 'null', 'count', 'distinct_count']
scope: MongoScope | None = None
field: str | None = None
spec: httk.store.backend.schema.FieldSpec | None = None
literal: object
value: MongoValue | None = None
class httk.store.backend.mongo.evaluator.MongoPredicate

A frozen three-valued predicate in the neutral stored-property AST.

kind: Literal['constant', 'compare', 'is_null', 'exists', 'and', 'or', 'not', 'when_known', 'scaled']
operands: tuple[object, Ellipsis] = ()
httk.store.backend.mongo.evaluator.evaluate(predicate, record, store_timestamp_resolver=None, logical_id_resolver=None, alt_kind_resolver=None)

Evaluate predicate exactly over a hydrated backing object.

Parameters:
  • predicate (MongoPredicate) – Frozen predicate produced by _MongoQueryContext.

  • record (object) – Hydrated backing record for the candidate SID.

  • store_timestamp_resolver (collections.abc.Callable[[], object] | None) – Optional resolver for the candidate’s store timestamp.

  • logical_id_resolver (collections.abc.Callable[[], object] | None) – Optional resolver for the candidate’s store-managed lineage id.

  • alt_kind_resolver (collections.abc.Callable[[], object] | None) – Optional resolver for the candidate’s store-managed alternative kind.

Returns:

True, False, or None for SQL UNKNOWN.

Return type:

bool | None

httk.store.backend.mongo.evaluator.canonical_predicate(predicate)

Return canonical JSON used as the verifier identity and cursor input.