cadb435d25
Since we increased the number of concurrent audit workers to two, there are going to be instances of a single node being audited simultaneously for different segments. If the node times out for both, we will try to write them both to the pending audits table, and the second will return an error since the path is not the same as what already exists. Since with concurrent workers this is expected, we will log the occurrence rather than return an error. Since the release default audit concurrency is 2, update testplanet default to run with concurrent workers as well. Change-Id: I4e657693fa3e825713a219af3835ae287bb062cb
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package audit
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
"storj.io/common/pb"
|
|
"storj.io/common/storj"
|
|
)
|
|
|
|
var (
|
|
// ContainError is the containment errs class
|
|
ContainError = errs.Class("containment error")
|
|
|
|
// ErrContainedNotFound is the errs class for when a pending audit isn't found
|
|
ErrContainedNotFound = errs.Class("pending audit not found")
|
|
|
|
// ErrContainDelete is the errs class for when a pending audit can't be deleted
|
|
ErrContainDelete = errs.Class("unable to delete pending audit")
|
|
)
|
|
|
|
// PendingAudit contains info needed for retrying an audit for a contained node
|
|
type PendingAudit struct {
|
|
NodeID storj.NodeID
|
|
PieceID storj.PieceID
|
|
StripeIndex int64
|
|
ShareSize int32
|
|
ExpectedShareHash []byte
|
|
ReverifyCount int32
|
|
Path storj.Path
|
|
}
|
|
|
|
// Containment holds information about pending audits for contained nodes
|
|
//
|
|
// architecture: Database
|
|
type Containment interface {
|
|
Get(ctx context.Context, nodeID pb.NodeID) (*PendingAudit, error)
|
|
IncrementPending(ctx context.Context, pendingAudit *PendingAudit) error
|
|
Delete(ctx context.Context, nodeID pb.NodeID) (bool, error)
|
|
}
|