Module kitsune_p2p_dht::arq
source · Expand description
The Quantized DHT Arc type
Arq coordinates are expressed in terms of powers-of-two, representing
the “chunk” or “segment” size to work with. The actual extent of the Arq
is expressed as a start
and an offset
, in terms of the chunk size.
So, Arq boundaries can only ever fall on a quantized grid which is determined
by the power
setting.
Modules
- Methods to help with ascii representations of Arqs
Structs
- A quantized DHT arc.
- A collection of ArqBounds. All bounds are guaranteed to be quantized to the same power (the lowest common power).
- “Arq Resizing Strategy”. Defines all parameters necessary to run the arq resizing algorithm.
- Configure settings for arc storage.
- The Quantized PeerView
- Statistics about the power levels of all arqs in a view. Used to make inferences about what your neighbors are up to.
- A summary of what happened while updating an Arq
Enums
- Instructions to clamp all arqs to a certain size, regardless of network conditions. This allows the user to either be the ultimate freeloader, or the ultimate benefactor.
- A Strategy for generating PeerViews. The enum allows us to add new strategies over time.
- A “view” of the peers in a neighborhood. The view consists of a few observations about the distribution of peers within a particular arc, used to make inferences about the rest of the (out-of-view) DHT, ultimately enabling the calculation of the target arc size for the agent who has this View.
Traits
- Represents the start point or “left edge” of an Arq.
Functions
- The actual coverage provided by these peers. Assumes that this is the entire view of the DHT, all peers are accounted for here.
- Given a center and a length, give Arq which matches most closely given the provided strategy
- Calculate whether a given combination of power and count corresponds to full DHT coverage.
- Convenience method for taking the power of 2 in u32
- Convenience method for taking the power of 2 in f64
- Calculate the unique pairing of power and count implied by a given length and max number of chunks. Gives the nearest value that satisfies the constraints, but may not be exact.
- Calculate the highest power and lowest count such that the given length is represented exactly. If the length is not representable even at the quantum level (power==0), return None.
- Print ascii for arq bounds
- Print a collection of arqs
Type Definitions
- Alias for Arq with an SpaceOffset start
- Alias for Arq with an Loc start