sweeper

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SweepInterval determines how often we perform our regular sweeps.
	SweepInterval = 24 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Status

type Status struct {
	InProgress bool
	Error      error
	StartTime  time.Time
	EndTime    time.Time
}

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

type Sweeper

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

Sweeper takes care of sweeping the files pinned by the local skyd server and marks them as pinned by the local server.

func New

func New(db *database.DB, skydc skyd.Client, serverName string, logger logger.Logger) *Sweeper

New returns a new Sweeper.

func (*Sweeper) Close

func (s *Sweeper) Close() bool

Close any running Sweeper thread. Return true if a thread was closed.

func (*Sweeper) Status

func (s *Sweeper) Status() Status

Status returns a copy of the status of the current sweep.

func (*Sweeper) Sweep

func (s *Sweeper) Sweep()

Sweep starts a new skyd sweep, unless one is already underway.

func (*Sweeper) UpdateSchedule

func (s *Sweeper) UpdateSchedule(period time.Duration)

UpdateSchedule schedules a new series of sweeps to be run. If there are already scheduled sweeps, that schedule is cancelled (running sweeps are not interrupted) and a new schedule is established.

Jump to

Keyboard shortcuts

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