Documentation ¶
Overview ¶
Package nodeselection implements node selection logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotEnoughNodes = errs.Class("not enough nodes")
ErrNotEnoughNodes is when selecting nodes failed with the given parameters.
View Source
var ( // Error represents an nodeselection error Error = errs.Class("nodeselection") )
Functions ¶
Types ¶
type SelectByID ¶
type SelectByID []*Node
SelectByID implements selection from nodes with every node having equal probability.
func (SelectByID) Count ¶
func (nodes SelectByID) Count() int
Count returns the number of maximum number of nodes that it can return.
type SelectBySubnet ¶
type SelectBySubnet []Subnet
SelectBySubnet implements selection from nodes with every subnet having equal probability.
func SelectBySubnetFromNodes ¶
func SelectBySubnetFromNodes(nodes []*Node) SelectBySubnet
SelectBySubnetFromNodes creates SelectBySubnet selector from nodes.
func (SelectBySubnet) Count ¶
func (subnets SelectBySubnet) Count() int
Count returns the number of maximum number of nodes that it can return.
type Selector ¶
type Selector interface { // Count returns the number of maximum number of nodes that it can return. Count() int // Select selects up-to n nodes and excluding the IDs. // When excludedNets is non-nil it will ensure that selected network is unique. Select(n int, excludedIDs []storj.NodeID, excludeNets map[string]struct{}) []*Node }
Selector defines interface for selecting nodes.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State defines a node selector state that allows for selection.
Click to show internal directories.
Click to hide internal directories.