Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadySet = errors.New("already set")
ErrAlreadySet a sharder is already set
View Source
var ErrBadParams = errors.New("bad parameters")
ErrBadParams bad parameters
View Source
var ErrNilSharder = errors.New("nil sharder")
ErrNilSharder the sharder is nil
Functions ¶
Types ¶
type KadPeerShardResolver ¶ added in v1.0.40
type KadPeerShardResolver interface { ByID(p2p.PeerID) uint32 //ByID get the shard id of the given peer.ID IsInterfaceNil() bool //IsInterfaceNil returns true if there is no value under the interface }
KadPeerShardResolver peer to shard mapping 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 }
Sharder - Main sharder interface
func NewKadSharder ¶ added in v1.0.40
func NewKadSharder(prioBits uint32, kgs KadPeerShardResolver) (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.