Struct kitsune_p2p_dht_arc::DhtArc [−][src]
pub struct DhtArc { pub center_loc: DhtLocation, pub half_length: u32, }
Expand description
Represents how much of a dht arc is held center_loc is where the hash is. The center_loc is the center of the arc The half length is the length of items held from the center in both directions half_length 0 means nothing is held half_length 1 means just the center_loc is held half_length n where n > 1 will hold those positions out half_length u32::MAX / 2 + 1 covers all positions on either side of center_loc. Imagine an bidirectional array:
[4][3][2][1][0][1][2][3][4]
[2][1][0][1][2]
Fields
center_loc: DhtLocation
The center location of this dht arc
half_length: u32
The “half-length” of this dht arc
Implementations
Create an Arc from a hash location plus a length on either side half length is (0..(u32::Max / 2 + 1))
Update the half length based on a density reading. This will converge on a new target instead of jumping directly to the new target and is designed to be called at a given rate with more recent peer density readings.
Check if a location is contained in this arc
Represent an arc as an optional range of inclusive endpoints. If none, the arc length is 0
Same as primitive_range, but with the return type “inside-out”
The absolute length that this arc will hold.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for DhtArc
impl UnwindSafe for DhtArc
Blanket Implementations
Mutably borrows from an owned value. Read more