pub struct DriveDocumentHavingQuery<'a> {
pub document_type: DocumentTypeRef<'a>,
pub contract_id: [u8; 32],
pub document_type_name: String,
pub index: &'a Index,
pub bounds: AxisRangeBounds,
pub descending: bool,
pub limit: u16,
/* private fields */
}Expand description
A resolved having-range query. Shared by the prover and the verifier —
both build the grove path through
DriveDocumentHavingQuery::indexed_property_name_tree_path and the
secondary query through AxisRangeBounds::merk_query, so the two
cannot drift on which subtree or which range the proof is about.
Fields§
§document_type: DocumentTypeRef<'a>The document type being filtered.
contract_id: [u8; 32]The contract id (32 bytes). Separate from document_type so the
verifier can build the query without the full contract.
document_type_name: StringThe document type name — a path segment.
index: &'a IndexThe covering ranked index. Its last property is the GROUP BY property and the final path segment; any leading properties
are pinned by Self::prefix_branches.
bounds: AxisRangeBoundsInclusive bounds on the aggregate. Carry the axis; the index must
declare the matching ranked_* flag.
descending: booltrue walks the secondary from the largest matching aggregate
down. Tie ordering is by group key in the direction of the walk,
exactly as on the ranked surface.
limit: u16Maximum number of matching groups to return. Fewer entries come
back when fewer groups fall inside the bounds; that is not an
error. More matching groups than limit are silently cut at
limit — the walk stops, and nothing marks the cut. A caller
can continue past distinct aggregate values by tightening the
bound, but a cut inside a tie cannot be continued (see the
module docs): groups tied at the boundary aggregate that fell
past the limit stay unreachable until a composite-key cursor
exists, so size the limit above the widest expected tie.
Implementations§
Source§impl DriveDocumentHavingQuery<'_>
impl DriveDocumentHavingQuery<'_>
Sourcepub fn execute_range_no_proof(
&self,
drive: &Drive,
transaction: TransactionArg<'_, '_>,
platform_version: &PlatformVersion,
) -> Result<Vec<RankedEntry>, Error>
pub fn execute_range_no_proof( &self, drive: &Drive, transaction: TransactionArg<'_, '_>, platform_version: &PlatformVersion, ) -> Result<Vec<RankedEntry>, Error>
Read the matching groups directly from the axis secondary: every
group whose aggregate falls inside the bounds, up to limit, in
axis order in the walk direction.
Fewer than limit entries is normal (fewer groups match) and is
not an error; exactly limit entries may mean the match set was
cut.
Missing paths follow the ranked surface’s rule. Under a single
== pin (or no pins) a missing path is an error rather than an
empty result: the indexed property-name tree is created at
contract registration, so its absence means the contract-level
state is not what the request claims. On an IN-pinned request,
an element whose branch chain is missing at ANY depth — the
branch key, or any deeper pinned segment under a present key —
contributes an empty branch instead (union semantics, exactly
as the proved envelope authenticates it), and the union is served
from one committed state (a None read runs under a grovedb
snapshot read transaction). An index with no documents has the
tree, with an empty secondary, and yields an empty entry list.
Sourcepub fn execute_range_with_proof(
&self,
drive: &Drive,
transaction: TransactionArg<'_, '_>,
platform_version: &PlatformVersion,
) -> Result<Vec<u8>, Error>
pub fn execute_range_with_proof( &self, drive: &Drive, transaction: TransactionArg<'_, '_>, platform_version: &PlatformVersion, ) -> Result<Vec<u8>, Error>
Generate the grovedb indexed-axis range proof for this query.
The envelope commits the in-range secondary entries, the
primary’s root hash, the sibling axes’ root hashes, and a
per-ancestor attestation chain up to the grovedb root — so the
client reconstructs the platform root hash from it. The bounds,
direction and limit bind by RECONSTRUCTION: the verifier rebuilds
the same Bounded axis PathQuery from the request
([AxisRangeBounds::inclusive_bounds_i128]) and re-executes the
proof against it — which is why the bounds are validated rather
than clamped upstream, and why completeness needs no extra
machinery: a Merk range proof over a sorted keyspace commits its
boundaries, so an in-range group the server omitted fails
reconstruction.
Verified by
DriveDocumentHavingQuery::verify_having_range_proof.
Source§impl DriveDocumentHavingQuery<'_>
impl DriveDocumentHavingQuery<'_>
Sourcepub fn prefix_branches(&self) -> &[Vec<Vec<u8>>]
pub fn prefix_branches(&self) -> &[Vec<Vec<u8>>]
The resolved prefix branches, in canonical order — one per IN
element (a single branch without an IN). Read-only: the field is
crate-private so the resolver’s encoder invariants cannot be
bypassed by construction or mutation.
Source§impl DriveDocumentHavingQuery<'_>
impl DriveDocumentHavingQuery<'_>
Sourcepub fn indexed_property_name_tree_path(
&self,
branch: usize,
) -> Result<Vec<Vec<u8>>, Error>
pub fn indexed_property_name_tree_path( &self, branch: usize, ) -> Result<Vec<Vec<u8>>, Error>
Path of one branch’s terminal property-name tree — identical to
the ranked surface’s path (including the pinned-prefix segments
of a compound index), because both read the same indexed
tree(s). See
DriveDocumentRankedQuery::indexed_property_name_tree_path.
Source§impl DriveDocumentHavingQuery<'_>
impl DriveDocumentHavingQuery<'_>
Sourcepub fn verify_having_range_proof(
&self,
proof: &[u8],
platform_version: &PlatformVersion,
) -> Result<(RootHash, Vec<RankedEntry>), Error>
pub fn verify_having_range_proof( &self, proof: &[u8], platform_version: &PlatformVersion, ) -> Result<(RootHash, Vec<RankedEntry>), Error>
Verifies a grovedb indexed-axis range proof and returns
(root_hash, entries).
Counterpart to the prover-side
execute_range_with_proof.
Both sides derive the proved subtree from
indexed_property_name_tree_path
and the same bounded axis PathQuery from
AxisRangeBounds::i128_bounds,
so the verifier cannot drift from the prover on which bound over
which tree it is checking.
The returned entries are in axis order in the walk direction,
exactly as the unproven
execute_range_no_proof would
return them. The caller combines root_hash with the surrounding
tenderdash signature — see rs-drive-proof-verifier for the
canonical composition.
§Arguments
proof— raw grovedb proof bytes.platform_version— selects the method version.
Trait Implementations§
Source§impl<'a> Clone for DriveDocumentHavingQuery<'a>
impl<'a> Clone for DriveDocumentHavingQuery<'a>
Source§fn clone(&self) -> DriveDocumentHavingQuery<'a>
fn clone(&self) -> DriveDocumentHavingQuery<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for DriveDocumentHavingQuery<'a>
impl<'a> RefUnwindSafe for DriveDocumentHavingQuery<'a>
impl<'a> Send for DriveDocumentHavingQuery<'a>
impl<'a> Sync for DriveDocumentHavingQuery<'a>
impl<'a> Unpin for DriveDocumentHavingQuery<'a>
impl<'a> UnsafeUnpin for DriveDocumentHavingQuery<'a>
impl<'a> UnwindSafe for DriveDocumentHavingQuery<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
CostContext object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
CostContext object with costs computed using the
value getting wrapped.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
§fn into_on_network(self, network: Network) -> U
fn into_on_network(self, network: Network) -> U
Calls U::from_on_network(self).
§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.