-
Notifications
You must be signed in to change notification settings - Fork 402
/
containment.go
33 lines (25 loc) · 980 Bytes
/
containment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package audit
import (
"context"
"github.com/zeebo/errs"
"storj.io/common/pb"
)
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")
)
// Containment holds information about pending audits for contained nodes.
//
// architecture: Database
type Containment interface {
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)
GetAllContainedNodes(ctx context.Context) ([]pb.NodeID, error)
}