storj/satellite/audit/containment.go
Egon Elbre 5d0816430f
rename all the things (#2531)
* rename pkg/linksharing to linksharing
* rename pkg/httpserver to linksharing/httpserver
* rename pkg/eestream to uplink/eestream
* rename pkg/stream to uplink/stream
* rename pkg/metainfo/kvmetainfo to uplink/metainfo/kvmetainfo
* rename pkg/auth/signing to pkg/signing
* rename pkg/storage to uplink/storage
* rename pkg/accounting to satellite/accounting
* rename pkg/audit to satellite/audit
* rename pkg/certdb to satellite/certdb
* rename pkg/discovery to satellite/discovery
* rename pkg/overlay to satellite/overlay
* rename pkg/datarepair to satellite/repair
2019-07-28 08:55:36 +03:00

46 lines
1.4 KiB
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package audit
import (
"context"
"github.com/zeebo/errs"
"storj.io/storj/pkg/pb"
"storj.io/storj/pkg/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")
// ErrAlreadyExists is the errs class for when a pending audit with the same nodeID but different share data already exists
ErrAlreadyExists = errs.Class("pending audit already exists for nodeID")
)
// 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
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)
}