Struct holochain::prelude::dependencies::kitsune_p2p_types::dht::prelude::Topology
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§
§impl Topology
impl Topology
pub fn standard(time_origin: Timestamp, time_cutoff: Duration) -> Topology
pub fn standard(time_origin: Timestamp, time_cutoff: Duration) -> Topology
Standard dimensions with the given time origin
pub fn standard_epoch(time_cutoff: Duration) -> Topology
pub fn standard_epoch(time_cutoff: Duration) -> Topology
Standard dimensions with the HOLOCHAIN_EPOCH
as the time origin
pub fn standard_epoch_full() -> Topology
pub fn standard_epoch_full() -> Topology
Standard dimensions with the HOLOCHAIN_EPOCH
as the time origin
pub fn standard_zero() -> Topology
pub fn standard_zero() -> Topology
Standard dimensions with a zero time origin
pub fn space_quantum(&self, x: DhtLocation) -> SpaceQuantum
pub fn space_quantum(&self, x: DhtLocation) -> SpaceQuantum
Returns the space quantum which contains this location
pub fn time_quantum(&self, t: Timestamp) -> TimeQuantum
pub fn time_quantum(&self, t: Timestamp) -> TimeQuantum
Returns the time quantum which contains this timestamp
pub 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
pub fn min_space_power(&self) -> u8
pub fn min_space_power(&self) -> u8
The minimum power to use in “exponentional coordinates”.
pub 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§
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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> ⓘ
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> ⓘ
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<T> Pointable for T
impl<T> Pointable for T
§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.