Struct kitsune_p2p_dht_arc::DhtArc
source · [−]pub struct DhtArc { /* private fields */ }
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]
Implementations
Create an Arc from a hash location plus a length on either side half length is (0..(u32::Max / 2 + 1))
Create a full arc from a center location
Create an empty arc from a center location
Create an arc with a coverage.
Update the half length based on a PeerView 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 views.
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”
Get the half length of this arc.
Get the half length of this arc.
Get the center location of this arc.
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