storj/satellite/nodeselection/node.go
Egon Elbre 08692aef90 satellite/nodeselection: node selection with proper bias
Currently node selection cache is biased towards the same subnet. This
implements static node selection for distinct such that it selects with
equal probability subnets rather than id-s.

This is mostly a copy paste + modifications from previous node selection
state.

Change-Id: Ia5c0aaf68e7feca78fbbd7352ad369fcb77c3a05
2020-05-18 18:09:15 +00:00

31 lines
624 B
Go

// Copyright (C) 2020 Storj Labs, Incache.
// See LICENSE for copying information.
package nodeselection
import (
"storj.io/common/pb"
"storj.io/common/storj"
)
// Node defines necessary information for node-selection.
type Node struct {
ID storj.NodeID
Address *pb.NodeAddress
LastNet string
LastIPPort string
}
// Clone returns a deep clone of the selected node.
func (node *Node) Clone() *Node {
return &Node{
ID: node.ID,
Address: &pb.NodeAddress{
Transport: node.Address.Transport,
Address: node.Address.Address,
},
LastNet: node.LastNet,
LastIPPort: node.LastIPPort,
}
}