Type Alias holochain::prelude::dependencies::kitsune_p2p_types::dht::arq::ArqLocated
pub type ArqLocated = Arq<DhtLocation>;
Expand description
Alias for Arq with an Loc start
Aliased Type§
struct ArqLocated {
pub start: DhtLocation,
pub power: u8,
pub count: SpaceOffset,
}
Fields§
§start: DhtLocation
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<DhtLocation>
impl Arq<DhtLocation>
pub fn new_full(
topo: &Topology,
start: DhtLocation,
power: u8
) -> Arq<DhtLocation>
pub fn new_full( topo: &Topology, start: DhtLocation, power: u8 ) -> Arq<DhtLocation>
Construct a full arq at the given power.
The count
is calculated accordingly.
pub fn downshift(&self) -> Arq<DhtLocation>
pub fn downshift(&self) -> Arq<DhtLocation>
Reduce the power by 1
pub fn upshift(&self, force: bool) -> Option<Arq<DhtLocation>>
pub fn upshift(&self, force: bool) -> Option<Arq<DhtLocation>>
Increase the power by 1. If this results in rounding, return None,
unless force
is true, in which case always return Some.
pub fn to_bounds(&self, topo: &Topology) -> Arq<SpaceOffset>
pub fn to_bounds(&self, topo: &Topology) -> Arq<SpaceOffset>
pub fn start_loc(&self) -> DhtLocation
pub fn start_loc(&self) -> DhtLocation
Get a reference to the arq’s left edge in absolute coordinates.
pub fn to_dht_arc(&self, topo: &Topology) -> DhtArc
pub fn to_dht_arc(&self, topo: &Topology) -> DhtArc
Convert to DhtArc
pub fn from_dht_arc_approximate(
topo: &Topology,
strat: &ArqStrat,
dht_arc: &DhtArc
) -> Arq<DhtLocation>
pub fn from_dht_arc_approximate( topo: &Topology, strat: &ArqStrat, dht_arc: &DhtArc ) -> Arq<DhtLocation>
Computes the Arq which most closely matches the given DhtArc
pub fn equivalent(
topo: &Topology,
a: &Arq<DhtLocation>,
b: &Arq<DhtLocation>
) -> bool
pub fn equivalent( topo: &Topology, a: &Arq<DhtLocation>, b: &Arq<DhtLocation> ) -> bool
The two arqs represent the same interval despite having potentially different terms