rename VetNode to IsVetted (#2097)

* rename VetNode to IsVetted
This commit is contained in:
Cameron 2019-06-03 10:53:30 -04:00 committed by GitHub
parent b8e0ac6377
commit e077b0d380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View File

@ -48,8 +48,8 @@ type DB interface {
KnownUnreliableOrOffline(context.Context, *NodeCriteria, storj.NodeIDList) (storj.NodeIDList, error)
// Paginate will page through the database nodes
Paginate(ctx context.Context, offset int64, limit int) ([]*NodeDossier, bool, error)
// VetNode returns whether or not the node reaches reputable thresholds
VetNode(ctx context.Context, id storj.NodeID, criteria *NodeCriteria) (bool, error)
// IsVetted returns whether or not the node reaches reputable thresholds
IsVetted(ctx context.Context, id storj.NodeID, criteria *NodeCriteria) (bool, error)
// CreateStats initializes the stats for node.
CreateStats(ctx context.Context, nodeID storj.NodeID, initial *NodeStats) (stats *NodeStats, err error)
// Update updates node address
@ -284,8 +284,8 @@ func (cache *Cache) Create(ctx context.Context, nodeID storj.NodeID, initial *No
return cache.db.CreateStats(ctx, nodeID, initial)
}
// VetNode returns whether or not the node reaches reputable thresholds
func (cache *Cache) VetNode(ctx context.Context, nodeID storj.NodeID) (reputable bool, err error) {
// IsVetted returns whether or not the node reaches reputable thresholds
func (cache *Cache) IsVetted(ctx context.Context, nodeID storj.NodeID) (reputable bool, err error) {
defer mon.Task()(&ctx)(&err)
criteria := &NodeCriteria{
AuditCount: cache.preferences.AuditCount,
@ -293,7 +293,7 @@ func (cache *Cache) VetNode(ctx context.Context, nodeID storj.NodeID) (reputable
UptimeCount: cache.preferences.UptimeCount,
UptimeSuccessRatio: cache.preferences.UptimeRatio,
}
reputable, err = cache.db.VetNode(ctx, nodeID, criteria)
reputable, err = cache.db.IsVetted(ctx, nodeID, criteria)
if err != nil {
return false, err
}

View File

@ -177,7 +177,7 @@ func TestRandomizedSelection(t *testing.T) {
})
}
func TestVetNode(t *testing.T) {
func TestIsVetted(t *testing.T) {
testplanet.Run(t, testplanet.Config{
SatelliteCount: 1, StorageNodeCount: 2, UplinkCount: 0,
Reconfigure: testplanet.Reconfigure{
@ -200,11 +200,11 @@ func TestVetNode(t *testing.T) {
})
assert.NoError(t, err)
reputable, err := service.VetNode(ctx, planet.StorageNodes[0].ID())
reputable, err := service.IsVetted(ctx, planet.StorageNodes[0].ID())
require.NoError(t, err)
assert.True(t, reputable)
reputable, err = service.VetNode(ctx, planet.StorageNodes[1].ID())
reputable, err = service.IsVetted(ctx, planet.StorageNodes[1].ID())
require.NoError(t, err)
assert.False(t, reputable)
})

View File

@ -700,11 +700,11 @@ func (m *lockedOverlayCache) Paginate(ctx context.Context, offset int64, limit i
return m.db.Paginate(ctx, offset, limit)
}
// VetNode returns whether or not the node reaches reputable thresholds
func (m *lockedOverlayCache) VetNode(ctx context.Context, id storj.NodeID, criteria *overlay.NodeCriteria) (bool, error) {
// IsVetted returns whether or not the node reaches reputable thresholds
func (m *lockedOverlayCache) IsVetted(ctx context.Context, id storj.NodeID, criteria *overlay.NodeCriteria) (bool, error) {
m.Lock()
defer m.Unlock()
return m.db.VetNode(ctx, id, criteria)
return m.db.IsVetted(ctx, id, criteria)
}
// SelectNewStorageNodes looks up nodes based on new node criteria

View File

@ -339,8 +339,8 @@ func (cache *overlaycache) Get(ctx context.Context, id storj.NodeID) (*overlay.N
return convertDBNode(node)
}
// VetNode returns whether or not the node reaches reputable thresholds
func (cache *overlaycache) VetNode(ctx context.Context, id storj.NodeID, criteria *overlay.NodeCriteria) (bool, error) {
// IsVetted returns whether or not the node reaches reputable thresholds
func (cache *overlaycache) IsVetted(ctx context.Context, id storj.NodeID, criteria *overlay.NodeCriteria) (bool, error) {
row := cache.db.QueryRow(cache.db.Rebind(`SELECT id
FROM nodes
WHERE id = ?

View File

@ -52,7 +52,7 @@ func (service *Service) Request(ctx context.Context, req *pb.VoucherRequest) (*p
return &pb.Voucher{}, Error.Wrap(err)
}
reputable, err := service.cache.VetNode(ctx, peer.ID)
reputable, err := service.cache.IsVetted(ctx, peer.ID)
if err != nil {
return &pb.Voucher{}, Error.Wrap(err)
}