Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBadParams = errors.New("bad parameters")
ErrBadParams bad parameters
Functions ¶
This section is empty.
Types ¶
type NoSharder ¶ added in v1.0.71
type NoSharder struct { }
NoSharder default sharder, only uses Kademlia distance in sorting
func (*NoSharder) GetDistance ¶ added in v1.0.71
GetDistance Kademlia XOR distance
func (*NoSharder) IsInterfaceNil ¶ added in v1.0.71
IsInterfaceNil returns true if there is no value under the interface
type Sharder ¶
type Sharder interface { // GetShard get the shard id of the peer GetShard(id peer.ID) uint32 // GetDistance get the distance between a and b GetDistance(a, b sortingID) *big.Int // SortList sort the provided peers list SortList(peers []peer.ID, ref peer.ID) ([]peer.ID, bool) IsInterfaceNil() bool }
Sharder - Main sharder interface
func NewKadSharder ¶ added in v1.0.40
func NewKadSharder(prioBits uint32, kgs p2p.PeerShardResolver) (Sharder, error)
NewKadSharder kadSharder constructor prioBits - Number of reseted bits. f - Callback used to get the shard id for a given peer.ID
Click to show internal directories.
Click to hide internal directories.