Enum kitsune_p2p_dht::region_set::RegionSet
source · pub enum RegionSet<T: RegionDataConstraints = RegionData> {
Ltcs(RegionSetLtcs<T>),
}
Expand description
The generic definition of a set of Regions.
The current representation is very specific to our current algorithm,
but this is an enum to make room for a more generic representation, e.g.
a simple Vec<Region>
, if we want a more intricate algorithm later.
Variants§
Ltcs(RegionSetLtcs<T>)
Logarithmic Time, Constant Space.
Implementations§
source§impl<D: RegionDataConstraints> RegionSet<D>
impl<D: RegionDataConstraints> RegionSet<D>
sourcepub fn query(&self, _bounds: &RegionBounds) -> !
pub fn query(&self, _bounds: &RegionBounds) -> !
The RegionSet can be used to answer questions about more regions than just the ones specified: If a larger region is queried, and this set contains a set of regions which over that larger region, then the larger region can be dynamically constructed.
This allows agents with differently computed RegionSets to still engage in gossip without needing to recompute regions.
sourcepub fn update(&self, _c: SpacetimeQuantumCoords, _d: D) -> !
pub fn update(&self, _c: SpacetimeQuantumCoords, _d: D) -> !
In order for this RegionSet to be queryable, new data needs to be integrated into it to avoid needing to recompute it from the database on each query.
sourcepub fn diff(self, other: Self) -> GossipResult<Vec<Region<D>>>
pub fn diff(self, other: Self) -> GossipResult<Vec<Region<D>>>
Find a set of Regions which represents the intersection of the two input RegionSets.
source§impl RegionSet
impl RegionSet
sourcepub fn nonzero_regions(
&self
) -> impl '_ + Iterator<Item = ((usize, usize, usize), RegionCoords, RegionData)>
pub fn nonzero_regions( &self ) -> impl '_ + Iterator<Item = ((usize, usize, usize), RegionCoords, RegionData)>
Return only the regions which have ops in them. Useful for testing sparse scenarios.
Trait Implementations§
source§impl<T: RegionDataConstraints> From<RegionSetLtcs<T>> for RegionSet<T>
impl<T: RegionDataConstraints> From<RegionSetLtcs<T>> for RegionSet<T>
source§fn from(original: RegionSetLtcs<T>) -> RegionSet<T>
fn from(original: RegionSetLtcs<T>) -> RegionSet<T>
Auto Trait Implementations§
impl<T = RegionData> !Freeze for RegionSet<T>
impl<T> RefUnwindSafe for RegionSet<T>where
T: DeserializeOwned + for<'de> Deserialize<'de> + Serialize + Debug + Sync + Send + Clone + Sub<Output = T> + AddAssign + Zero<Output = T> + Add + Eq + PartialEq + RefUnwindSafe,
impl<T> Send for RegionSet<T>
impl<T> Sync for RegionSet<T>
impl<T> Unpin for RegionSet<T>
impl<T> UnwindSafe for RegionSet<T>where
T: DeserializeOwned + for<'de> Deserialize<'de> + Serialize + Debug + Sync + Send + Clone + Sub<Output = T> + AddAssign + Zero<Output = T> + Add + Eq + PartialEq + UnwindSafe,
Blanket Implementations§
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
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§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).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.