Documentation
¶
Index ¶
- Variables
- type Command
- type CommandReturn
- type DropAddr
- type DropNode
- type FilterKnownAddrs
- type GetClosestPeers
- type GetHashOrClosestNodes
- type GetHashOrClosestNodesResult
- type GetNodesForSampleInfoHashes
- type GetOldestPeers
- type Hash
- type HashOption
- type HashPeer
- type ID
- type Node
- type NodeOption
- type Params
- type PutHash
- type PutNode
- type Query
- type Result
- type SampleHashesAndNodes
- type SampleHashesAndNodesResult
- type Table
- type TableCommand
- type TableOrigin
- type TableQuery
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDropReasonNotProvided = errors.New("drop reason not provided")
Functions ¶
This section is empty.
Types ¶
type CommandReturn ¶
type FilterKnownAddrs ¶
type GetClosestPeers ¶
type GetClosestPeers struct {
ID ID
}
type GetHashOrClosestNodes ¶
type GetHashOrClosestNodes struct {
ID ID
}
type GetNodesForSampleInfoHashes ¶
type GetNodesForSampleInfoHashes struct {
N int
}
type GetOldestPeers ¶
type HashOption ¶
type HashOption interface {
// contains filtered or unexported methods
}
type Node ¶
type NodeOption ¶
type NodeOption interface {
// contains filtered or unexported methods
}
func NodeBep51Support ¶
func NodeBep51Support(supported bool) NodeOption
func NodeResponded ¶
func NodeResponded() NodeOption
func NodeSampleInfoHashesRes ¶
func NodeSampleInfoHashesRes(discoveredNum int, totalNum int, nextSampleTime time.Time) NodeOption
type PutHash ¶
type PutHash struct {
ID ID
Peers []HashPeer
Options []HashOption
}
type Result ¶
type Result struct {
fx.Out
Table Table
NodesCountGauge prometheus.Collector `group:"prometheus_collectors"`
NodesAddedCounter prometheus.Collector `group:"prometheus_collectors"`
NodesDroppedCounter prometheus.Collector `group:"prometheus_collectors"`
HashesCountGauge prometheus.Collector `group:"prometheus_collectors"`
HashesAddedCounter prometheus.Collector `group:"prometheus_collectors"`
HashesDroppedCounter prometheus.Collector `group:"prometheus_collectors"`
}
type SampleHashesAndNodes ¶
type SampleHashesAndNodes struct{}
type Table ¶
type Table interface {
TableOrigin
TableCommand
TableQuery
BatchCommand(commands ...Command)
}
type TableCommand ¶
type TableOrigin ¶
type TableOrigin interface {
Origin() ID
}
type TableQuery ¶
type TableQuery interface {
GetClosestNodes(id ID) []Node
GetOldestNodes(cutoff time.Time, n int) []Node
GetNodesForSampleInfoHashes(n int) []Node
FilterKnownAddrs(addrs []netip.Addr) []netip.Addr
GetHashOrClosestNodes(id ID) GetHashOrClosestNodesResult
// SampleHashesAndNodes returns a random sample of up to 8 hashes and nodes, and the total hashes count.
SampleHashesAndNodes() SampleHashesAndNodesResult
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.