Documentation ¶
Overview ¶
Package uploadselection implements node selection logic for uploads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotEnoughNodes = errs.Class("not enough nodes")
ErrNotEnoughNodes is when selecting nodes failed with the given parameters.
var ( // Error represents an uploadselection error. Error = errs.Class("uploadselection") )
Functions ¶
Types ¶
type Criteria ¶ added in v1.42.2
type Criteria struct { ExcludeNodeIDs []storj.NodeID AutoExcludeSubnets map[string]struct{} // initialize it with empty map to keep only one node per subnet. }
Criteria to filter nodes.
func (*Criteria) MatchInclude ¶ added in v1.42.2
MatchInclude returns with true if node is selected.
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 which are included by the criteria. // empty criteria includes all the nodes Select(n int, criteria Criteria) []*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.