Type Alias holochain::prelude::kitsune_p2p::dependencies::kitsune_p2p_types::dht::prelude::ArqBounds
pub type ArqBounds = Arq<SpaceOffset>;
Expand description
Alias for Arq with an SpaceOffset start
Aliased Type§
struct ArqBounds {
pub start: SpaceOffset,
pub power: u8,
pub count: SpaceOffset,
}
Fields§
§start: SpaceOffset
The “start” defines the left edge of the arq
power: u8
The level of quantization. Total length is 2^power * count
.
The power must be between 0 and 31, inclusive (power of 32 causes overflow)
count: SpaceOffset
The number of unit lengths. We never expect the count to be less than 4 or so, and not much larger than 32.
Implementations§
§impl<S> Arq<S>where
S: ArqStart,
impl<S> Arq<S>where S: ArqStart,
pub fn new(power: u8, start: S, count: SpaceOffset) -> Arq<S>
pub fn new(power: u8, start: S, count: SpaceOffset) -> Arq<S>
Constructor from individual parts
pub fn absolute_length(&self, topo: &Topology) -> u64
pub fn absolute_length(&self, topo: &Topology) -> u64
The absolute length of the entire arq.
pub fn to_dht_arc_range(&self, topo: &Topology) -> DhtArcRange<DhtLocation>
pub fn to_dht_arc_range(&self, topo: &Topology) -> DhtArcRange<DhtLocation>
Convert to DhtArcRange
pub fn to_edge_locs(&self, topo: &Topology) -> (DhtLocation, DhtLocation)
pub fn to_edge_locs(&self, topo: &Topology) -> (DhtLocation, DhtLocation)
Determine the edges of this Arq in absolute coordinates (Loc
)
pub fn requantize(&self, new_power: u8) -> Option<Arq<S>>
pub fn requantize(&self, new_power: u8) -> Option<Arq<S>>
Requantize to a different power. If requantizing to a higher power, only requantize if there is no information loss due to rounding. Otherwise, return None.
§impl Arq<SpaceOffset>
impl Arq<SpaceOffset>
pub fn equivalent(
topo: &Topology,
a: &Arq<SpaceOffset>,
b: &Arq<SpaceOffset>
) -> bool
pub fn equivalent( topo: &Topology, a: &Arq<SpaceOffset>, b: &Arq<SpaceOffset> ) -> bool
The two arqs represent the same interval despite having potentially different terms
pub fn from_interval_rounded(
topo: &Topology,
power: u8,
interval: DhtArcRange<DhtLocation>
) -> (Arq<SpaceOffset>, bool)
pub fn from_interval_rounded( topo: &Topology, power: u8, interval: DhtArcRange<DhtLocation> ) -> (Arq<SpaceOffset>, bool)
Return the ArqBounds which most closely matches the given DhtArcRange
pub fn from_interval(
topo: &Topology,
power: u8,
interval: DhtArcRange<DhtLocation>
) -> Option<Arq<SpaceOffset>>
pub fn from_interval( topo: &Topology, power: u8, interval: DhtArcRange<DhtLocation> ) -> Option<Arq<SpaceOffset>>
Return the ArqBounds which is equivalent to the given DhtArcRange
if it exists.
pub fn to_arq<F>(&self, topo: &Topology, f: F) -> Arq<DhtLocation>where
F: FnOnce(DhtLocation) -> DhtLocation,
pub fn to_arq<F>(&self, topo: &Topology, f: F) -> Arq<DhtLocation>where F: FnOnce(DhtLocation) -> DhtLocation,
Upcast this ArqBounds to an Arq that has knowledge of its Loc
pub fn empty(topo: &Topology, power: u8) -> Arq<SpaceOffset>
pub fn empty(topo: &Topology, power: u8) -> Arq<SpaceOffset>
An arbitrary zero-coverage arq.
pub fn segments(&self) -> impl Iterator<Item = Segment<SpaceOffset>>
pub fn segments(&self) -> impl Iterator<Item = Segment<SpaceOffset>>
Iterate over each segment (chunk) in the Arq
pub fn offset(&self) -> SpaceOffset
pub fn offset(&self) -> SpaceOffset
Get a reference to the arq bounds’s offset.