storj/satellite/audit/containment.go
Egon Elbre 961e841bd7 all: fix error naming
errs.Class should not contain "error" in the name, since that causes a
lot of stutter in the error logs. As an example a log line could end up
looking like:

    ERROR node stats service error: satellitedbs error: node stats database error: no rows

Whereas something like:

    ERROR nodestats service: satellitedbs: nodestatsdb: no rows

Would contain all the necessary information without the stutter.

Change-Id: I7b7cb7e592ebab4bcfadc1eef11122584d2b20e0
2021-04-29 15:38:21 +03:00

46 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"
"storj.io/storj/satellite/metabase"
)
var (
// ContainError is the containment errs class.
ContainError = errs.Class("containment")
// 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 int32
ShareSize int32
ExpectedShareHash []byte
ReverifyCount int32
Segment metabase.SegmentLocation
}
// 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)
}