netsize

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEnoughData   = fmt.Errorf("not enough data")
	ErrWrongNumOfPeers = fmt.Errorf("expected bucket size number of peers")
)
View Source
var (
	MaxMeasurementAge        = 2 * time.Hour
	MinMeasurementsThreshold = 5
	MaxMeasurementsThreshold = 150
)

Functions

func NormedDistance

func NormedDistance(p peer.ID, k ks.Key) float64

NormedDistance 计算给定键的标准化 XOR 距离(从 0 到 1)。

Types

type Estimator

type Estimator struct {
	// contains filtered or unexported fields
}

func NewEstimator

func NewEstimator(localID peer.ID, rt *kbucket.RoutingTable, bucketSize int) *Estimator

func (*Estimator) NetworkSize

func (e *Estimator) NetworkSize() (int32, error)

NetworkSize 指示估计器计算当前网络大小估计。

func (*Estimator) Track

func (e *Estimator) Track(key string, peers []peer.ID) error

Track 跟踪给定密钥的对等点列表,以合并到下一个网络大小估计中。 key 预计 **不** 位于 kademlia 键空间中,并且对等点预计是与给定键最接近的对等点的排序列表(最接近的第一个)。 该函数期望对等点的长度与路由表桶大小相同。 它还剥离旧数据并限制数据点的数量(有利于新数据)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL