Documentation ¶
Overview ¶
Package kademlia provides Kademlia routing-related facilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketAtDepth ¶
BucketAtDepth returns the bucket in the routing table at a given depth. A bucket at depth D holds contacts that share a prefix of exactly D bits with node.
Types ¶
type BucketHealthReport ¶
type BucketHealthReport struct { // Depth is the bucket depth, starting from zero. Depth int // MaxKnownContacts is the number of all known network nodes, // which are eligible to be in this bucket. MaxKnownContacts int // ActualKnownContacts is the number of known network nodes, // that are actually in the node's routing table. ActualKnownContacts int // ActualUnknownContacts is the number of contacts in the node's routing table, // that are not known to be in the network currently. ActualUnknownContacts int }
BucketHealth describes the discrepancy between a node's routing bucket and the theoretical ideal, given knowledge of all nodes present in the network (aka the "known" nodes).
func BucketHealth ¶
func BucketHealth(node key.Key, nodeTable, knownNodes *trie.Trie) []*BucketHealthReport
BucketHealth computes the health report for each bucket in a node's routing table, given the node's routing table and a list of all known nodes in the network currently.
func (*BucketHealthReport) String ¶
func (bh *BucketHealthReport) String() string
type TableHealthReport ¶
type TableHealthReport struct { // IdealDepth is the depth that the node's routing table should have. IdealDepth int // ActualDepth is the depth that the node's routing table has. ActualDepth int // Bucket contains the individual health reports for each of the node's routing buckets. Bucket []*BucketHealthReport }
TableHealthReport describes the discrepancy between a node's routing table from the theoretical ideal, given knowledge of all nodes present in the network. TODO: Make printable in a way easy to ingest in Python/matplotlib for viewing in a Jupyter notebook. E.g. one would like to see a histogram of (IdealDepth - ActualDepth) across all tables.
func AllTablesHealth ¶
func AllTablesHealth(tables []*Table) (report []*TableHealthReport)
AllTablesHealth computes health reports for a network of nodes, whose routing contacts are given.
func TableHealth ¶
TableHealth computes the health report for a node, given its routing contacts and a list of all known nodes in the network currently.
func TableHealthFromSets ¶
func (*TableHealthReport) String ¶
func (th *TableHealthReport) String() string