Skip to main content

Module executors

Module executors 

Source
Expand description

Per-mode count-query executors on impl Drive. One file per super::DocumentCountMode variant — the dispatcher (super::drive_dispatcher) calls into the right one based on the detected mode.

Each executor:

  1. Picks the right covering index for its mode (returns Error::Query(QuerySyntaxError::WhereClauseOnNonIndexedProperty) if no index covers the where clauses).
  2. Builds the appropriate DriveDocumentCountQuery.
  3. Runs the matching method on it (execute_no_proof, execute_range_count_no_proof, execute_aggregate_count_with_proof, execute_distinct_count_with_proof, or execute_point_lookup_count_with_proof).
  4. Returns Vec<SplitCountEntry> (no-proof modes) or Vec<u8> proof bytes (proof modes).

Splitting along mode boundaries — one file per mode — keeps each executor’s index-picking + clause-handling logic local and lets the dispatcher’s match arms stay one line each. No re-exports are needed: each file adds methods directly to impl Drive, so callers (the dispatcher) just see them on the Drive type.

Modules§

per_in_value
Per-In-value executor for super::super::DocumentCountMode::PerInValue dispatch — prove = false count queries with exactly one In clause and no range clause.
point_lookup_proof
Point-lookup count proof executor for super::super::DocumentCountMode::PointLookupProof dispatch — prove = true count queries with no range clause (Equal/In against a countable: true index, OR the documents_countable: true fast path on empty where).
range_aggregate_carrier_proof
Carrier-ACOR proof executor for super::super::DocumentCountMode::RangeAggregateCarrierProof dispatch — prove = true count queries where the caller asks for one aggregate per outer-key branch via group_by = [outer_field]. The outer dimension is either:
range_distinct_proof
Distinct-range-count proof executor for super::super::DocumentCountMode::RangeDistinctProof dispatch — prove = true count queries with a range clause and non-empty group_by. Emits per-distinct-value KVCount ops the client verifies via [drive_proof_verifier::verify_distinct_count_proof].
range_no_proof
Range-count executor for super::super::DocumentCountMode::RangeNoProof dispatch — prove = false count queries with a range clause. Returns a summed entry when options.distinct = false or per-distinct- value entries when options.distinct = true.
range_proof
Range-count proof executor for super::super::DocumentCountMode::RangeProof dispatch — prove = true count queries with a range clause and empty group_by. Uses grovedb’s AggregateCountOnRange primitive to emit a single u64 verified out of the proof.
total
Total-count executor for super::super::DocumentCountMode::Total dispatch — prove = false count queries without a range clause.