Documentation ¶
Index ¶
- Variables
- func GetRandomStripe(ctx context.Context, pointer *pb.Pointer) (index int64, err error)
- type Chore
- type Config
- type Containment
- type PathCollector
- func (collector *PathCollector) InlineSegment(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
- func (collector *PathCollector) Object(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
- func (collector *PathCollector) RemoteSegment(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
- type PendingAudit
- type Queue
- type Report
- type Reporter
- type Reservoir
- type Share
- type Verifier
- func (verifier *Verifier) DownloadShares(ctx context.Context, limits []*pb.AddressedOrderLimit, ...) (shares map[int]Share, err error)
- func (verifier *Verifier) GetShare(ctx context.Context, limit *pb.AddressedOrderLimit, ...) (share Share, err error)
- func (verifier *Verifier) Reverify(ctx context.Context, path storj.Path) (report Report, err error)
- func (verifier *Verifier) Verify(ctx context.Context, path storj.Path, skip map[storj.NodeID]bool) (report Report, err error)
- type Worker
Constants ¶
This section is empty.
Variables ¶
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") )
var ( errs.Class("not enough shares for successful audit") // ErrSegmentDeleted is the errs class when the audited segment was deleted during the audit ErrSegmentDeleted = errs.Class("segment deleted during audit") // ErrSegmentExpired is the errs class used when a segment to audit has already expired. ErrSegmentExpired = errs.Class("segment expired before audit") // ErrSegmentModified is the errs class used when a segment has been changed in any way ErrSegmentModified = errs.Class("segment has been modified") )ErrNotEnoughShares =
var ErrEmptyQueue = errs.Class("empty audit queue")
ErrEmptyQueue is used to indicate that the queue is empty.
var Error = errs.Class("audit error")
Error is the default audit errs class.
Functions ¶
Types ¶
type Chore ¶ added in v0.21.0
Chore populates reservoirs and the audit queue.
architecture: Chore
type Config ¶
type Config struct { MaxRetriesStatDB int `help:"max number of times to attempt updating a statdb batch" default:"3"` MinBytesPerSecond memory.Size `help:"the minimum acceptable bytes that storage nodes can transfer per second to the satellite" default:"128B"` MinDownloadTimeout time.Duration `help:"the minimum duration for downloading a share from storage nodes before timing out" default:"5m0s"` MaxReverifyCount int `help:"limit above which we consider an audit is failed" default:"3"` ChoreInterval time.Duration `help:"how often to run the reservoir chore" releaseDefault:"24h" devDefault:"1m"` QueueInterval time.Duration `help:"how often to recheck an empty audit queue" releaseDefault:"1h" devDefault:"1m"` Slots int `help:"number of reservoir slots allotted for nodes, currently capped at 3" default:"3"` WorkerConcurrency int `help:"number of workers to run audits on paths" default:"1"` }
Config contains configurable values for audit chore and workers.
type Containment ¶
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) }
Containment holds information about pending audits for contained nodes
architecture: Database
type PathCollector ¶ added in v0.19.0
type PathCollector struct { Reservoirs map[storj.NodeID]*Reservoir // contains filtered or unexported fields }
PathCollector uses the metainfo loop to add paths to node reservoirs
architecture: Observer
func NewPathCollector ¶ added in v0.19.0
func NewPathCollector(reservoirSlots int, r *rand.Rand) *PathCollector
NewPathCollector instantiates a path collector
func (*PathCollector) InlineSegment ¶ added in v0.19.0
func (collector *PathCollector) InlineSegment(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
InlineSegment returns nil because we're only auditing for storage nodes for now
func (*PathCollector) Object ¶ added in v0.21.0
func (collector *PathCollector) Object(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
Object returns nil because the audit service does not interact with objects
func (*PathCollector) RemoteSegment ¶ added in v0.19.0
func (collector *PathCollector) RemoteSegment(ctx context.Context, path metainfo.ScopedPath, pointer *pb.Pointer) (err error)
RemoteSegment takes a remote segment found in metainfo and creates a reservoir for it if it doesn't exist already
type PendingAudit ¶
type PendingAudit struct { NodeID storj.NodeID PieceID storj.PieceID StripeIndex int64 ReverifyCount int32 Path storj.Path }
PendingAudit contains info needed for retrying an audit for a contained node
type Queue ¶ added in v0.21.0
type Queue struct {
// contains filtered or unexported fields
}
Queue is a list of paths to audit, shared between the reservoir chore and audit workers.
type Report ¶
type Report struct { Successes storj.NodeIDList Fails storj.NodeIDList Offlines storj.NodeIDList PendingAudits []*PendingAudit Unknown storj.NodeIDList }
Report contains audit result lists for nodes that succeeded, failed, were offline, have pending audits, or failed for unknown reasons
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter records audit reports in overlay and implements the reporter interface
architecture: Service
func NewReporter ¶
func NewReporter(log *zap.Logger, overlay *overlay.Service, containment Containment, maxRetries int, maxReverifyCount int32) *Reporter
NewReporter instantiates a reporter
func (*Reporter) RecordAudits ¶
func (reporter *Reporter) RecordAudits(ctx context.Context, req Report, path storj.Path) (_ Report, err error)
RecordAudits saves audit results to overlay. When no error, it returns nil for both return values, otherwise it returns the report with the fields set to the values which have been saved and the error.
type Reservoir ¶ added in v0.19.0
type Reservoir struct { Paths [maxReservoirSize]storj.Path // contains filtered or unexported fields }
Reservoir holds a certain number of segments to reflect a random sample
func NewReservoir ¶ added in v0.19.0
NewReservoir instantiates a Reservoir
type Verifier ¶
type Verifier struct { OnTestingCheckSegmentAlteredHook func() // contains filtered or unexported fields }
Verifier helps verify the correctness of a given stripe
architecture: Worker
func NewVerifier ¶
func NewVerifier(log *zap.Logger, metainfo *metainfo.Service, dialer rpc.Dialer, overlay *overlay.Service, containment Containment, orders *orders.Service, id *identity.FullIdentity, minBytesPerSecond memory.Size, minDownloadTimeout time.Duration) *Verifier
NewVerifier creates a Verifier
func (*Verifier) DownloadShares ¶
func (verifier *Verifier) DownloadShares(ctx context.Context, limits []*pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, stripeIndex int64, shareSize int32) (shares map[int]Share, err error)
DownloadShares downloads shares from the nodes where remote pieces are located
func (*Verifier) GetShare ¶
func (verifier *Verifier) GetShare(ctx context.Context, limit *pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, stripeIndex int64, shareSize int32, pieceNum int) (share Share, err error)
GetShare use piece store client to download shares from nodes