pub struct ArqStrat {
    pub min_coverage: f64,
    pub buffer: f64,
    pub max_power_diff: u8,
    pub slacker_ratio: f64,
    pub power_std_dev_threshold: f64,
}
Expand description

“Arq Resizing Strategy”. Defines all parameters necessary to run the arq resizing algorithm.

Fields

min_coverage: f64

The minimum coverage the DHT seeks to maintain.

This is the whole purpose for arc resizing.

buffer: f64

A multiplicative factor of the min coverage which defines a max. coverage. We want coverage to be between the min and max coverage. This is expressed in terms of a value > 0 and < 1. For instance, a min coverage of 50 with a buffer of 0.2 implies a max coverage of 60.

max_power_diff: u8

If the difference between the arq’s power and the median power of all peer arqs (including this one) is greater than this diff, then don’t requantize: just keep growing or shrinking past the min/max chunks value.

This parameter determines how likely it is for there to be a difference in chunk sizes between two agents’ arqs. It establishes the tradeoff between the size of payloads that must be sent and the extra coordination or computation that must be performed to accomodate agents whose power is lower than ours.

This parameter is also what allows an arq to shrink to zero in a reasonable number of steps. Without this limit on power diff, we would keep requantizing until the power was 0 before shrinking to the empty arc. We may shrink to zero if our neighborhood is significantly over-covered, which can happen if a number of peers decide to keep their coverage higher than the ideal equilibrium value.

Note that this parameter does not guarantee that any agent’s arq will have a power +/- this diff from our power, but we may decide to choose not to gossip with agents whose power falls outside the range defined by this diff. TODO: do this.

slacker_ratio: f64

If at any time the number of peers seen by a node is less than the extrapolated coverage scaled by this factor, then we assume that we need to grow our arc so that we can see more peers. In other words, we are “slacking” if at any time: num_peers < extrapolated_coverage * slack_factor

If this is set too high, it may prevent arcs from legitimately shrinking. If set too low, it will hamper the ability for extremely small arcs to reach a proper size

power_std_dev_threshold: f64

If the standard deviation of the powers of each arq in this view is greater than this threshold, then we might do something different when it comes to our decision to requantize. For now, just print a warning.

TODO: this can probably be expressed in terms of max_power_diff.

Implementations

Constructor

The midline between min and max coverage

The max coverage as expressed by the min coverage and the buffer

The width of the buffer range

The lower bound of number of chunks to maintain in an arq. When the chunk count falls below this number, halve the chunk size.

The upper bound of number of chunks to maintain in an arq. When the chunk count exceeds this number, double the chunk size.

This is expressed in terms of min_chunks because we want this value to always be odd – this is because when growing the arq, we need to downshift the power, and we can only downshift losslessly if the count is even, and the most common case of exceeding the max_chunks is is to exceed the max_chunks by 1, which would be an even number.

The floor of the log2 of the max_chunks. For the default of 15, floor(log2(15)) = 3

Get a summary report of this strat in string format

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

Returns the “default value” for a type. Read more

Converts to this type from the input type.

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

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

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

Uses borrowed data to replace owned data, usually by cloning. 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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more