Trait holochain::prelude::dependencies::kitsune_p2p_types::dht::prelude::Offset
pub trait Offset: Sized + Copy + Clone + Deref<Target = u32> + From<u32> {
type Quantum: Quantum;
fn to_absolute(
&self,
topo: &Topology,
power: u8
) -> <Self::Quantum as Quantum>::Absolute;
fn to_quantum(&self, power: u8) -> Self::Quantum;
fn from_absolute_rounded(loc: DhtLocation, topo: &Topology, power: u8) -> Self;
}
Expand description
An Offset represents the position of the left edge of some Segment. Offsets must be paired with a power to map to quantum coordinates. The absolute DhtLocation of the offset is determined by the “power” of its context, and topology of the space, by:
dht_location = offset * 2^pow * quantum_size
Required Associated Types
Required Methods
fn to_absolute(
&self,
topo: &Topology,
power: u8
) -> <Self::Quantum as Quantum>::Absolute
fn to_absolute(
&self,
topo: &Topology,
power: u8
) -> <Self::Quantum as Quantum>::Absolute
Get the absolute coordinate for this Offset
fn to_quantum(&self, power: u8) -> Self::Quantum
fn to_quantum(&self, power: u8) -> Self::Quantum
Get the quantum coordinate for this Offset
fn from_absolute_rounded(loc: DhtLocation, topo: &Topology, power: u8) -> Self
fn from_absolute_rounded(loc: DhtLocation, topo: &Topology, power: u8) -> Self
Get the nearest rounded-down Offset for the given Loc