pub enum ChainQueryFilterRange {
Unbounded,
HeaderSeqRange(u32, u32),
HeaderHashRange(HoloHash<Header>, HoloHash<Header>),
HeaderHashTerminated(HoloHash<Header>, 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 header 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 header 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 elements 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 elements/headers 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 element after the fact.
Variants
Unbounded
Do NOT apply any range filtering for this query.
HeaderSeqRange(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.
HeaderHashRange(HoloHash<Header>, HoloHash<Header>)
A range over source chain header hashes. This CAN be used in validation logic as forks are disambiguated. Inclusive start and end (unlike std::ops::Range).
HeaderHashTerminated(HoloHash<Header>, u32)
The terminating header hash and N preceeding elements.
N = 0 returns only the element with this HeaderHash
.
This CAN be used in validation logic as forks are not possible when
“looking up” towards genesis from some HeaderHash
.
Trait Implementations
sourceimpl Clone for ChainQueryFilterRange
impl Clone for ChainQueryFilterRange
sourcefn clone(&self) -> ChainQueryFilterRange
fn clone(&self) -> ChainQueryFilterRange
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ChainQueryFilterRange
impl Debug for ChainQueryFilterRange
sourceimpl Default for ChainQueryFilterRange
impl Default for ChainQueryFilterRange
sourcefn default() -> ChainQueryFilterRange
fn default() -> ChainQueryFilterRange
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for ChainQueryFilterRange
impl<'de> Deserialize<'de> for ChainQueryFilterRange
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<ChainQueryFilterRange> for ChainQueryFilterRange
impl PartialEq<ChainQueryFilterRange> for ChainQueryFilterRange
sourcefn eq(&self, other: &ChainQueryFilterRange) -> bool
fn eq(&self, other: &ChainQueryFilterRange) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &ChainQueryFilterRange) -> bool
fn ne(&self, other: &ChainQueryFilterRange) -> bool
This method tests for !=
.
sourceimpl Serialize for ChainQueryFilterRange
impl Serialize for ChainQueryFilterRange
sourcefn 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,
Serialize this value into the given Serde serializer. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more