2019-05-22 15:50:22 +01:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package audit
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
|
2019-12-27 11:48:47 +00:00
|
|
|
"storj.io/common/pb"
|
2019-05-22 15:50:22 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2020-08-11 15:50:01 +01:00
|
|
|
// ContainError is the containment errs class.
|
2021-04-28 09:06:17 +01:00
|
|
|
ContainError = errs.Class("containment")
|
2019-05-22 15:50:22 +01:00
|
|
|
|
2020-08-11 15:50:01 +01:00
|
|
|
// ErrContainedNotFound is the errs class for when a pending audit isn't found.
|
2019-05-22 15:50:22 +01:00
|
|
|
ErrContainedNotFound = errs.Class("pending audit not found")
|
|
|
|
|
2020-08-11 15:50:01 +01:00
|
|
|
// ErrContainDelete is the errs class for when a pending audit can't be deleted.
|
2019-05-22 15:50:22 +01:00
|
|
|
ErrContainDelete = errs.Class("unable to delete pending audit")
|
|
|
|
)
|
|
|
|
|
2022-11-23 15:24:30 +00:00
|
|
|
// Containment holds information about pending audits for contained nodes.
|
2022-11-23 15:14:27 +00:00
|
|
|
//
|
|
|
|
// architecture: Database
|
2022-11-23 15:24:30 +00:00
|
|
|
type Containment interface {
|
2022-11-22 16:59:04 +00:00
|
|
|
Get(ctx context.Context, nodeID pb.NodeID) (*ReverificationJob, error)
|
|
|
|
Insert(ctx context.Context, job *PieceLocator) error
|
|
|
|
Delete(ctx context.Context, job *PieceLocator) (wasDeleted, nodeStillContained bool, err error)
|
2023-01-25 22:34:40 +00:00
|
|
|
GetAllContainedNodes(ctx context.Context) ([]pb.NodeID, error)
|
2022-11-22 16:59:04 +00:00
|
|
|
}
|