Skip to main content

Module drive_dispatcher

Module drive_dispatcher 

Source
Expand description

Average-query dispatcher entry point.

Routes a DocumentAverageRequest to one of two backends:

§Joint dispatch

The no-prove dispatcher at crate::query::drive_document_count_and_sum_query reads (count, sum) together — via grovedb’s combined query_aggregate_count_and_sum accumulator on the aggregate range branch, and via a single PCPS walk on the distinct-grouped branch. Routing reuses sum’s versioned mode-detection table so the (where_clauses × mode) → executor decision has a single source of truth shared with the count and sum surfaces.

§Prove path shapes (unchanged)

The prove-path routing table at [Self::execute_document_average_prove] picks one of: - empty-where + documentsCountable + documentsSummable doctype → primary-key count-sum tree direct read - range AVG on a rangeAverageable index → PCPS AggregateCountAndSumOnRange proof - In + range AVG on a rangeAverageable index → carrier-PCPS proof - GroupByRange / GroupByCompound + range on a rangeAverageable index → per-distinct-key count-and-sum proof (walks ProvableCountProvableSumTree terminators) - Equal/In + no range on a summable + countable index → point-lookup count-and-sum proof (walks count-sum-bearing terminator elements) The client verifies with the matching verify_*_count_and_sum_proof helpers in drive-proof-verifier.