Struct kitsune_p2p_dht::spacetime::Topology
source · pub struct Topology {
pub space: Dimension,
pub time: Dimension,
pub time_origin: Timestamp,
pub time_cutoff: Duration,
}
Expand description
Topology defines the structure of spacetime, in particular how space and time are quantized.
Any calculation which requires converting from absolute coordinates to quantized coordinates must refer to the topology. Therefore, this type is ubiquitous! More functions than not take it as a parameter. This may seem cumbersome, but there are a few reasons why this is helpful:
- We currently use a “standard” quantization for all networks, but we may find it beneficial in the future to let each network specify its own quantization levels, based on its own traffic and longevity needs.
- It is confusing to be working with three different coordinate systems in
this codebase, and the presence of a
&topo
param in a function is a helpful reminder to be extra mindful about the unit conversions that are happening
Fields§
§space: Dimension
The quantization of space
time: Dimension
The quantization of time
time_origin: Timestamp
The origin of time, meaning the 0th quantum contains this Timestamp.
time_cutoff: Duration
Ignore any data which lies after Timestamp::now() - time_cutoff
.
This is so that historical quantized gossip does not overlap with
recent gossip.
Implementations§
source§impl Topology
impl Topology
sourcepub fn standard(time_origin: Timestamp, time_cutoff: Duration) -> Self
pub fn standard(time_origin: Timestamp, time_cutoff: Duration) -> Self
Standard dimensions with the given time origin
sourcepub fn standard_epoch(time_cutoff: Duration) -> Self
pub fn standard_epoch(time_cutoff: Duration) -> Self
Standard dimensions with the HOLOCHAIN_EPOCH
as the time origin
sourcepub fn standard_epoch_full() -> Self
pub fn standard_epoch_full() -> Self
Standard dimensions with the HOLOCHAIN_EPOCH
as the time origin
sourcepub fn standard_zero() -> Self
pub fn standard_zero() -> Self
Standard dimensions with a zero time origin
sourcepub fn space_quantum(&self, x: Loc) -> SpaceQuantum
pub fn space_quantum(&self, x: Loc) -> SpaceQuantum
Returns the space quantum which contains this location
sourcepub fn time_quantum(&self, t: Timestamp) -> TimeQuantum
pub fn time_quantum(&self, t: Timestamp) -> TimeQuantum
Returns the time quantum which contains this timestamp
sourcepub fn time_quantum_duration(&self, d: Duration) -> TimeQuantum
pub fn time_quantum_duration(&self, d: Duration) -> TimeQuantum
Returns the time quantum which contains this timestamp
sourcepub fn min_space_power(&self) -> u8
pub fn min_space_power(&self) -> u8
The minimum power to use in “exponentional coordinates”.
sourcepub fn max_space_power(&self, strat: &ArqStrat) -> u8
pub fn max_space_power(&self, strat: &ArqStrat) -> u8
The maximum power to use in “exponentional coordinates”. This is 17 for standard space topology. (32 - 12 - 3)
Trait Implementations§
source§impl PartialEq<Topology> for Topology
impl PartialEq<Topology> for Topology
impl Eq for Topology
impl StructuralEq for Topology
impl StructuralPartialEq for Topology
Auto Trait Implementations§
impl RefUnwindSafe for Topology
impl Send for Topology
impl Sync for Topology
impl Unpin for Topology
impl UnwindSafe for Topology
Blanket Implementations§
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<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.