Struct PathQuery
pub struct PathQuery {
pub path: Vec<Vec<u8>>,
pub query: SizedQuery,
}Expand description
Path query
Represents a path to a specific GroveDB tree and a corresponding query to apply to the given tree.
Fields§
§path: Vec<Vec<u8>>Path
query: SizedQueryQuery
Implementations§
§impl PathQuery
impl PathQuery
pub fn new_single_key(path: Vec<Vec<u8>>, key: Vec<u8>) -> PathQuery
pub fn new_single_key(path: Vec<Vec<u8>>, key: Vec<u8>) -> PathQuery
New path query with a single key
pub fn new_single_query_item(
path: Vec<Vec<u8>>,
query_item: QueryItem,
) -> PathQuery
pub fn new_single_query_item( path: Vec<Vec<u8>>, query_item: QueryItem, ) -> PathQuery
New path query with a single query item
pub fn new_aggregate_count_on_range(
path: Vec<Vec<u8>>,
range: QueryItem,
) -> PathQuery
pub fn new_aggregate_count_on_range( path: Vec<Vec<u8>>, range: QueryItem, ) -> PathQuery
Construct a PathQuery for an aggregate-count-on-range query against
the subtree at path. range is the inner QueryItem describing the
keys to count over; see Query::new_aggregate_count_on_range for the
allowed range variants.
pub fn new_aggregate_sum_on_range(
path: Vec<Vec<u8>>,
range: QueryItem,
) -> PathQuery
pub fn new_aggregate_sum_on_range( path: Vec<Vec<u8>>, range: QueryItem, ) -> PathQuery
Mirror of Self::new_aggregate_count_on_range for
AggregateSumOnRange. Builds a PathQuery whose underlying query
asks for the cryptographically-verifiable sum of children with keys
in range against the ProvableSumTree rooted at path.
pub fn new_aggregate_count_and_sum_on_range(
path: Vec<Vec<u8>>,
range: QueryItem,
) -> PathQuery
pub fn new_aggregate_count_and_sum_on_range( path: Vec<Vec<u8>>, range: QueryItem, ) -> PathQuery
Mirror of Self::new_aggregate_count_on_range /
Self::new_aggregate_sum_on_range for the combined
AggregateCountAndSumOnRange variant. Builds a PathQuery whose
underlying query asks for BOTH the count AND the signed sum of
children with keys in range against the
ProvableCountProvableSumTree (PCPS) rooted at path — both
values come from a single proof.
pub fn validate_aggregate_count_on_range(&self) -> Result<&QueryItem, Error>
pub fn validate_aggregate_count_on_range(&self) -> Result<&QueryItem, Error>
Validates that this PathQuery is a well-formed
AggregateCountOnRange query in either the leaf or carrier shape.
On success, returns a reference to the leaf inner range item.
Empty-path handling is shape-aware. The GroveDB root merk is
always a NormalTree by API construction (never a
ProvableCountTree), so a leaf aggregate-count query at the
root has no valid target and is rejected up front. A carrier
query, by contrast, may legitimately fan out across the root’s
top-level keys and descend (via subquery_path or directly) to
leaf count merks at lower depths; empty-path carriers are
permitted and the per-key verifier handles depth-0 execution.
Forwards to SizedQuery::validate_aggregate_count_on_range.
pub fn validate_aggregate_sum_on_range(&self) -> Result<&QueryItem, Error>
pub fn validate_aggregate_sum_on_range(&self) -> Result<&QueryItem, Error>
Validates that this PathQuery is a well-formed
AggregateSumOnRange query in either the leaf or carrier shape.
On success, returns a reference to the leaf inner range item.
Empty-path handling is shape-aware. The GroveDB root merk is
always a NormalTree, never a ProvableSumTree, so a leaf
aggregate-sum query at the root has no valid target and is
rejected up front. A carrier query may legitimately fan out
across the root’s top-level keys and descend (via subquery_path
or directly) to leaf sum merks at lower depths; empty-path
carriers are permitted and the per-key verifier handles depth-0
execution. Forwards to SizedQuery::validate_aggregate_sum_on_range.
pub fn validate_aggregate_count_and_sum_on_range(
&self,
) -> Result<&QueryItem, Error>
pub fn validate_aggregate_count_and_sum_on_range( &self, ) -> Result<&QueryItem, Error>
Validates that this PathQuery is a well-formed
AggregateCountAndSumOnRange query in either the leaf or carrier
shape. On success, returns a reference to the leaf inner range
item.
Empty-path handling is shape-aware. The GroveDB root merk is
always a NormalTree, never a ProvableCountProvableSumTree, so
a leaf combined aggregate at the root has no valid target and
is rejected up front. A carrier query may legitimately fan
out across the root’s top-level keys and descend (via
subquery_path or directly) to a PCPS leaf merk at a lower
depth; empty-path carriers are permitted and the per-key verifier
handles depth-0 execution. Forwards to
SizedQuery::validate_aggregate_count_and_sum_on_range.
pub fn validate_leaf_aggregate_count_on_range(
&self,
) -> Result<&QueryItem, Error>
pub fn validate_leaf_aggregate_count_on_range( &self, ) -> Result<&QueryItem, Error>
Strict variant of Self::validate_aggregate_count_on_range that
only accepts the leaf shape (single AggregateCountOnRange(_)
item, no subqueries). Always rejects empty paths — the GroveDB
root is always a NormalTree, never a count tree.
pub fn validate_leaf_aggregate_sum_on_range(&self) -> Result<&QueryItem, Error>
pub fn validate_leaf_aggregate_sum_on_range(&self) -> Result<&QueryItem, Error>
Strict variant of Self::validate_aggregate_sum_on_range that
only accepts the leaf shape (single AggregateSumOnRange(_)
item, no subqueries). Used by
[crate::GroveDb::verify_aggregate_sum_query] which produces a
single i64 and needs to reject the carrier shape up front.
Always rejects empty paths.
pub fn validate_leaf_aggregate_count_and_sum_on_range(
&self,
) -> Result<&QueryItem, Error>
pub fn validate_leaf_aggregate_count_and_sum_on_range( &self, ) -> Result<&QueryItem, Error>
Strict variant of
Self::validate_aggregate_count_and_sum_on_range that only
accepts the leaf shape (single
AggregateCountAndSumOnRange(_) item, no subqueries). Used by
[crate::GroveDb::verify_aggregate_count_and_sum_query] which
produces a single (u64, i64) and needs to reject the carrier
shape up front. Always rejects empty paths.
pub fn validate_count_offset_paginated(&self) -> Result<&QueryItem, Error>
pub fn validate_count_offset_paginated(&self) -> Result<&QueryItem, Error>
Validates that this PathQuery is an offset-paginated range query
against a ProvableCountTree / ProvableCountSumTree /
ProvableCountProvableSumTree. Returns the single range
QueryItem on success.
The tree-type check happens later when the leaf merk is opened.
This function is purely syntactic — it gates the query shape
(single range, no subqueries, offset > 0). Forwards to
SizedQuery::validate_count_offset_paginated.
Rejects empty paths up-front for the same reason as
Self::validate_aggregate_count_on_range: the GroveDB root
merk is always a NormalTree, never a count tree, so a
root-level offset-paginated query has no valid target.
pub fn has_non_zero_offset(&self) -> bool
pub fn has_non_zero_offset(&self) -> bool
Returns true if this PathQuery has a non-zero offset set.
Used to detect “the caller wants pagination” before deciding
whether the query is eligible for the count-offset paginated
proof flow.
pub fn has_aggregate_count_on_range(&self) -> bool
pub fn has_aggregate_count_on_range(&self) -> bool
Returns true if this PathQuery’s underlying query carries an
AggregateCountOnRange item (whether well-formed or not). Use
Self::validate_aggregate_count_on_range when you also need
well-formedness.
pub fn has_aggregate_sum_on_range(&self) -> bool
pub fn has_aggregate_sum_on_range(&self) -> bool
Mirror of Self::has_aggregate_count_on_range for the sum variant.
pub fn has_aggregate_count_and_sum_on_range(&self) -> bool
pub fn has_aggregate_count_and_sum_on_range(&self) -> bool
Mirror of Self::has_aggregate_count_on_range for the combined
AggregateCountAndSumOnRange variant.
pub fn max_depth(&self) -> Option<u16>
pub fn max_depth(&self) -> Option<u16>
The max depth of the query, this is the maximum layers we could get back from grovedb If the max depth can not be calculated we get None This would occur if the recursion level was too high
pub fn terminal_keys(
&self,
max_results: usize,
grove_version: &GroveVersion,
) -> Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, Error>
pub fn terminal_keys( &self, max_results: usize, grove_version: &GroveVersion, ) -> Result<Vec<(Vec<Vec<u8>>, Vec<u8>)>, Error>
Gets the path of all terminal keys
pub fn merge(
path_queries: Vec<&PathQuery>,
grove_version: &GroveVersion,
) -> Result<PathQuery, Error>
pub fn merge( path_queries: Vec<&PathQuery>, grove_version: &GroveVersion, ) -> Result<PathQuery, Error>
Combines multiple path queries into one equivalent path query
pub fn should_add_parent_tree_at_path(
&self,
path: &[&[u8]],
grove_version: &GroveVersion,
) -> Result<bool, Error>
pub fn should_add_parent_tree_at_path( &self, path: &[&[u8]], grove_version: &GroveVersion, ) -> Result<bool, Error>
Returns whether the parent tree element should be included in results at the given path.
pub fn query_items_at_path(
&self,
path: &[&[u8]],
grove_version: &GroveVersion,
) -> Result<Option<SinglePathSubquery<'_>>, Error>
pub fn query_items_at_path( &self, path: &[&[u8]], grove_version: &GroveVersion, ) -> Result<Option<SinglePathSubquery<'_>>, Error>
Returns the query items applicable at the given path, if any.
Trait Implementations§
§impl<'__de, __Context> BorrowDecode<'__de, __Context> for PathQuery
impl<'__de, __Context> BorrowDecode<'__de, __Context> for PathQuery
§fn borrow_decode<__D>(decoder: &mut __D) -> Result<PathQuery, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
fn borrow_decode<__D>(decoder: &mut __D) -> Result<PathQuery, DecodeError>where
__D: BorrowDecoder<'__de, Context = __Context>,
Source§impl TryFromPlatformVersioned<SingleDocumentDriveQuery> for PathQuery
impl TryFromPlatformVersioned<SingleDocumentDriveQuery> for PathQuery
Source§fn try_from_platform_versioned(
value: SingleDocumentDriveQuery,
platform_version: &PlatformVersion,
) -> Result<Self, Self::Error>
fn try_from_platform_versioned( value: SingleDocumentDriveQuery, platform_version: &PlatformVersion, ) -> Result<Self, Self::Error>
impl StructuralPartialEq for PathQuery
Auto Trait Implementations§
impl Freeze for PathQuery
impl RefUnwindSafe for PathQuery
impl Send for PathQuery
impl Sync for PathQuery
impl Unpin for PathQuery
impl UnsafeUnpin for PathQuery
impl UnwindSafe for PathQuery
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
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.Source§impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
fn borrow_decode<D>(decoder: &mut D) -> Result<Self, DecodeError>
Source§impl<T> DefaultDecode for T
impl<T> DefaultDecode for T
§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).
Source§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
Source§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> 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.