Node selection method name change (#1296)
* SelectNodes -> SelectStorageNodes
This commit is contained in:
parent
c9d00d8241
commit
f94a2e1161
@ -38,10 +38,10 @@ var OverlayError = errs.Class("Overlay Error")
|
||||
|
||||
// DB implements the database for overlay.Cache
|
||||
type DB interface {
|
||||
// SelectNodes looks up nodes based on criteria
|
||||
SelectNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error)
|
||||
// SelectNewNodes looks up nodes based on new node criteria
|
||||
SelectNewNodes(ctx context.Context, count int, criteria *NewNodeCriteria) ([]*pb.Node, error)
|
||||
// SelectStorageNodes looks up nodes based on criteria
|
||||
SelectStorageNodes(ctx context.Context, count int, criteria *NodeCriteria) ([]*pb.Node, error)
|
||||
// SelectNewStorageNodes looks up nodes based on new node criteria
|
||||
SelectNewStorageNodes(ctx context.Context, count int, criteria *NewNodeCriteria) ([]*pb.Node, error)
|
||||
|
||||
// Get looks up the node by nodeID
|
||||
Get(ctx context.Context, nodeID storj.NodeID) (*pb.Node, error)
|
||||
@ -123,7 +123,7 @@ func (cache *Cache) FindStorageNodes(ctx context.Context, req *pb.FindStorageNod
|
||||
auditCount = preferences.NewNodeAuditThreshold
|
||||
}
|
||||
|
||||
reputableNodes, err := cache.db.SelectNodes(ctx, reputableNodeCount, &NodeCriteria{
|
||||
reputableNodes, err := cache.db.SelectStorageNodes(ctx, reputableNodeCount, &NodeCriteria{
|
||||
FreeBandwidth: freeBandwidth,
|
||||
FreeDisk: freeDisk,
|
||||
|
||||
@ -139,7 +139,7 @@ func (cache *Cache) FindStorageNodes(ctx context.Context, req *pb.FindStorageNod
|
||||
}
|
||||
|
||||
newNodeCount := int64(float64(reputableNodeCount) * preferences.NewNodePercentage)
|
||||
newNodes, err := cache.db.SelectNewNodes(ctx, int(newNodeCount), &NewNodeCriteria{
|
||||
newNodes, err := cache.db.SelectNewStorageNodes(ctx, int(newNodeCount), &NewNodeCriteria{
|
||||
FreeBandwidth: freeBandwidth,
|
||||
FreeDisk: freeDisk,
|
||||
|
||||
|
@ -184,10 +184,10 @@ func testRandomizedSelection(t *testing.T, reputable bool) {
|
||||
var err error
|
||||
|
||||
if reputable {
|
||||
nodes, err = cache.SelectNodes(ctx, numNodesToSelect, &overlay.NodeCriteria{})
|
||||
nodes, err = cache.SelectStorageNodes(ctx, numNodesToSelect, &overlay.NodeCriteria{})
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
nodes, err = cache.SelectNewNodes(ctx, numNodesToSelect, &overlay.NewNodeCriteria{
|
||||
nodes, err = cache.SelectNewStorageNodes(ctx, numNodesToSelect, &overlay.NewNodeCriteria{
|
||||
AuditThreshold: 1,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
@ -489,18 +489,18 @@ func (m *lockedOverlayCache) Paginate(ctx context.Context, offset int64, limit i
|
||||
return m.db.Paginate(ctx, offset, limit)
|
||||
}
|
||||
|
||||
// SelectNewNodes looks up nodes based on new node criteria
|
||||
func (m *lockedOverlayCache) SelectNewNodes(ctx context.Context, count int, criteria *overlay.NewNodeCriteria) ([]*pb.Node, error) {
|
||||
// SelectNewStorageNodes looks up nodes based on new node criteria
|
||||
func (m *lockedOverlayCache) SelectNewStorageNodes(ctx context.Context, count int, criteria *overlay.NewNodeCriteria) ([]*pb.Node, error) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
return m.db.SelectNewNodes(ctx, count, criteria)
|
||||
return m.db.SelectNewStorageNodes(ctx, count, criteria)
|
||||
}
|
||||
|
||||
// SelectNodes looks up nodes based on criteria
|
||||
func (m *lockedOverlayCache) SelectNodes(ctx context.Context, count int, criteria *overlay.NodeCriteria) ([]*pb.Node, error) {
|
||||
// SelectStorageNodes looks up nodes based on criteria
|
||||
func (m *lockedOverlayCache) SelectStorageNodes(ctx context.Context, count int, criteria *overlay.NodeCriteria) ([]*pb.Node, error) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
return m.db.SelectNodes(ctx, count, criteria)
|
||||
return m.db.SelectStorageNodes(ctx, count, criteria)
|
||||
}
|
||||
|
||||
// Update updates node information
|
||||
|
@ -23,7 +23,7 @@ type overlaycache struct {
|
||||
db *dbx.DB
|
||||
}
|
||||
|
||||
func (cache *overlaycache) SelectNodes(ctx context.Context, count int, criteria *overlay.NodeCriteria) ([]*pb.Node, error) {
|
||||
func (cache *overlaycache) SelectStorageNodes(ctx context.Context, count int, criteria *overlay.NodeCriteria) ([]*pb.Node, error) {
|
||||
nodeType := int(pb.NodeType_STORAGE)
|
||||
return cache.queryFilteredNodes(ctx, criteria.Excluded, count, `
|
||||
WHERE node_type = ? AND free_bandwidth >= ? AND free_disk >= ?
|
||||
@ -36,7 +36,7 @@ func (cache *overlaycache) SelectNodes(ctx context.Context, count int, criteria
|
||||
)
|
||||
}
|
||||
|
||||
func (cache *overlaycache) SelectNewNodes(ctx context.Context, count int, criteria *overlay.NewNodeCriteria) ([]*pb.Node, error) {
|
||||
func (cache *overlaycache) SelectNewStorageNodes(ctx context.Context, count int, criteria *overlay.NewNodeCriteria) ([]*pb.Node, error) {
|
||||
nodeType := int(pb.NodeType_STORAGE)
|
||||
return cache.queryFilteredNodes(ctx, criteria.Excluded, count, `
|
||||
WHERE node_type = ? AND free_bandwidth >= ? AND free_disk >= ?
|
||||
|
Loading…
Reference in New Issue
Block a user