pub enum ChainQueryFilterRange {
Unbounded,
ActionSeqRange(u32, u32),
ActionHashRange(HoloHash<Action>, HoloHash<Action>),
ActionHashTerminated(HoloHash<Action>, u32),
}
Expand description
Defines several ways that queries can be restricted to a range. Notably hash bounded ranges disambiguate forks whereas sequence indexes do not as the same position can be found in many forks. The reason that this does NOT use native rust range traits is that the hash bounded queries MUST be inclusive otherwise the integrity and fork disambiguation logic is impossible. An exclusive range bound that does not include the final action tells us nothing about which fork to select between N forks of equal length that proceed it. With an inclusive hash bounded range the final action always points unambiguously at the “correct” fork that the range is over. Start hashes are not needed to provide this property so ranges can be hash terminated with a length of preceeding records to return only. Technically the seq bounded ranges do not imply any fork disambiguation and so could be a range but for simplicity we left the API symmetrical in boundedness across all enum variants. @TODO It may be possible to provide/implement RangeBounds in the case that a full sequence of records/actions is provided but it would need to be handled as inclusive first, to enforce the integrity of the query, then the exclusiveness achieved by simply removing the final record after the fact.
Variants§
Unbounded
Do NOT apply any range filtering for this query.
ActionSeqRange(u32, u32)
A range over source chain sequence numbers. This is ambiguous over forking histories and so should NOT be used in validation logic. Inclusive start, inclusive end.
ActionHashRange(HoloHash<Action>, HoloHash<Action>)
A range over source chain action hashes. This CAN be used in validation logic as forks are disambiguated. Inclusive start and end (unlike std::ops::Range).
ActionHashTerminated(HoloHash<Action>, u32)
The terminating action hash and N preceeding records.
N = 0 returns only the record with this ActionHash
.
This CAN be used in validation logic as forks are not possible when
“looking up” towards genesis from some ActionHash
.
Trait Implementations§
source§impl Clone for ChainQueryFilterRange
impl Clone for ChainQueryFilterRange
source§fn clone(&self) -> ChainQueryFilterRange
fn clone(&self) -> ChainQueryFilterRange
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ChainQueryFilterRange
impl Debug for ChainQueryFilterRange
source§impl Default for ChainQueryFilterRange
impl Default for ChainQueryFilterRange
source§fn default() -> ChainQueryFilterRange
fn default() -> ChainQueryFilterRange
source§impl<'de> Deserialize<'de> for ChainQueryFilterRange
impl<'de> Deserialize<'de> for ChainQueryFilterRange
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ChainQueryFilterRange, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<ChainQueryFilterRange, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl PartialEq<ChainQueryFilterRange> for ChainQueryFilterRange
impl PartialEq<ChainQueryFilterRange> for ChainQueryFilterRange
source§fn eq(&self, other: &ChainQueryFilterRange) -> bool
fn eq(&self, other: &ChainQueryFilterRange) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ChainQueryFilterRange
impl Serialize for ChainQueryFilterRange
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
impl StructuralPartialEq for ChainQueryFilterRange
Auto Trait Implementations§
impl RefUnwindSafe for ChainQueryFilterRange
impl Send for ChainQueryFilterRange
impl Sync for ChainQueryFilterRange
impl Unpin for ChainQueryFilterRange
impl UnwindSafe for ChainQueryFilterRange
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.