checker

package
v0.15.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2019 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Error = errs.Class("checker error")
)

Error is a standard error class for this package.

Functions

This section is empty.

Types

type Checker

type Checker struct {
	Loop            sync2.Cycle
	IrreparableLoop sync2.Cycle
	// contains filtered or unexported fields
}

Checker contains the information needed to do checks for missing pieces

func NewChecker

func NewChecker(metainfo *metainfo.Service, repairQueue queue.RepairQueue, overlay *overlay.Cache, irrdb irreparable.DB, limit int, logger *zap.Logger, config Config) *Checker

NewChecker creates a new instance of checker

func (*Checker) Close

func (checker *Checker) Close() error

Close halts the Checker loop

func (*Checker) IdentifyInjuredSegments

func (checker *Checker) IdentifyInjuredSegments(ctx context.Context) (err error)

IdentifyInjuredSegments checks for missing pieces off of the metainfo and overlay cache

func (*Checker) IrreparableProcess added in v0.13.0

func (checker *Checker) IrreparableProcess(ctx context.Context) (err error)

IrreparableProcess picks items from irreparabledb and add them to the repair worker queue if they, now, can be repaired.

func (*Checker) RefreshReliabilityCache added in v0.14.9

func (checker *Checker) RefreshReliabilityCache(ctx context.Context) error

RefreshReliabilityCache forces refreshing node online status cache.

func (*Checker) Run

func (checker *Checker) Run(ctx context.Context) (err error)

Run the checker loop

type Config

type Config struct {
	Interval            time.Duration `help:"how frequently checker should check for bad segments" releaseDefault:"30s" devDefault:"0h0m10s"`
	IrreparableInterval time.Duration `help:"how frequently irrepairable checker should check for lost pieces" releaseDefault:"30m" devDefault:"0h0m5s"`

	ReliabilityCacheStaleness time.Duration `help:"how stale reliable node cache can be" releaseDefault:"5m" devDefault:"5m"`
}

Config contains configurable values for checker

type ReliabilityCache added in v0.14.9

type ReliabilityCache struct {
	// contains filtered or unexported fields
}

ReliabilityCache caches the reliable nodes for the specified staleness duration and updates automatically from overlay.

func NewReliabilityCache added in v0.14.9

func NewReliabilityCache(overlay *overlay.Cache, staleness time.Duration) *ReliabilityCache

NewReliabilityCache creates a new reliability checking cache.

func (*ReliabilityCache) LastUpdate added in v0.14.9

func (cache *ReliabilityCache) LastUpdate() time.Time

LastUpdate returns when the cache was last updated.

func (*ReliabilityCache) MissingPieces added in v0.14.9

func (cache *ReliabilityCache) MissingPieces(ctx context.Context, created time.Time, pieces []*pb.RemotePiece) (_ []int32, err error)

MissingPieces returns piece indices that are unreliable with the given staleness period.

func (*ReliabilityCache) Refresh added in v0.14.9

func (cache *ReliabilityCache) Refresh(ctx context.Context) (err error)

Refresh refreshes the cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL