scanner

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AlwaysPinThreshold sets a limit on the contract data of the server. If
	// the server is below that limit, it will repin underpinned files even if it
	// is not in the bottom X% in the cluster.
	AlwaysPinThreshold = build.Select(
		build.Var{
			Standard: 50 * database.TiB,
			Dev:      1 * database.MiB,
			Testing:  1 * database.MiB,
		}).(int)
	// PinningRangeThresholdPercent defines the cutoff line in the list of
	// servers, ordered by how much data they are pinning, below which a server
	// will pin underpinned skylinks.
	PinningRangeThresholdPercent = 0.30
	// RepairDataPinningThreshold sets a limit on the amount of repair data skyd
	// needs to handle. If skyd needs to repair more than this amount, it won't
	// pin underpinned skylinks.
	RepairDataPinningThreshold = uint64(database.TiB)
	// SleepBetweenHealthChecks defines the wait time between calls to skyd to
	// check the current health of a given file.
	SleepBetweenHealthChecks = build.Select(
		build.Var{
			Standard: 5 * time.Second,
			Dev:      time.Second,
			Testing:  time.Millisecond,
		}).(time.Duration)
)

Functions

This section is empty.

Types

type Scanner

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

Scanner is a background worker that periodically scans the database for underpinned skylinks. Once an underpinned skylink is found (and it's not being pinned by the local server already), Scanner pins it to the local skyd.

func New

func New(db *database.DB, logger logger.Logger, minPinners int, threads int, serverName string, customSleepBetweenScans time.Duration, skydClient skyd.Client) *Scanner

New creates a new Scanner instance.

func (*Scanner) Close

func (s *Scanner) Close() error

Close stops the background worker thread.

func (*Scanner) Start

func (s *Scanner) Start() error

Start launches the background worker thread that scans the DB for underpinned skylinks.

func (*Scanner) Status

func (s *Scanner) Status() Status

Status returns the status of the current scan.

type Status

type Status struct {
	InProgress bool      `json:"inProgress"`
	StartTime  time.Time `json:"startTime"`
	EndTime    time.Time `json:"endTime"`
	NumPinned  int       `json:"numPinned"`
	NumFailed  int       `json:"numFailed"`
	Failed     []string  `json:"failed,omitempty"`
}

Status represents the status of a sweep. All times are UTC-based in order to simplify handling and comparison.

Jump to

Keyboard shortcuts

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