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

Get the range of the 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.

The percentage of the full circle that is covered by this arc.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.