pub struct PeerViewQ {
    pub topo: Topology,
    pub skip_index: Option<usize>,
    /* private fields */
}
Expand description

The Quantized PeerView

Fields§

§topo: Topology

The topology of the network space

§skip_index: Option<usize>

Omit the arq at this index from all peer considerations. Useful for tests which update all arqs, without needing to construct a new PeerView for each arq needing to be updated

Implementations§

Constructor

The actual coverage of all arcs in this view. TODO: this only makes sense when the view contains all agents in the DHT. So, it’s more useful for testing. Probably want to tease out some concept of a test DHT from this.

Extrapolate the coverage of the entire network from our local view.

Return the extrapolated coverage and the number of arqs which match the filter. These two are complected together simply for efficiency’s sake, to minimize computation

TODO: this probably will be rewritten when PeerView is rewritten to have the filter baked in.

Compute the total coverage observed within the filter interval.

Mutate the arq to its ideal target

The “slacker” factor. If our observed coverage is significantly greater than the number of peers we see, it’s an indication that we may need to pick up more slack.

This check helps balance out stable but unequitable situations where all peers have a similar estimated coverage, but some peers are holding much more than others.

Take an arq and potentially resize and requantize it based on this view.

This represents an iterative step towards the ideal coverage, based on the observed coverage. This makes many assumptions, including:

  • this arc resizing algorithm is a good one, namely that the coverage at any point of the DHT is close to the target range
  • all other peers are following the same algorithm
  • if we see a change that we need to make, we assume that a number of peers are about to make a similar change, and that number is on average the same as our target coverage

More detail on these assumptions here: https://hackmd.io/@hololtd/r1IAIbr5Y/https%3A%2F%2Fhackmd.io%2FK_fkBj6XQO2rCUZRRL9n2g TODO: make the above link to something publicly available, preferably in the repo

Gather statistics about the power levels of all arqs in this view. Used to make inferences about what your neighbors are up to.

Trait Implementations§

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
TODO: once 1.33.0 is the minimum supported compiler version, remove Any::type_id_compat and use StdAny::type_id instead. https://github.com/rust-lang/rust/issues/27745
The archived version of the pointer metadata for this type.
Converts some archived metadata to the pointer metadata for itself.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Deserializes using the given deserializer

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
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
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.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type for metadata in pointers and references to Self.
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 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.
upcast ref
upcast mut ref
upcast boxed dyn
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
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