retain

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Error is the default error class for retain errors.
	Error = errs.Class("retain")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxTimeSkew time.Duration `help:"allows for small differences in the satellite and storagenode clocks" default:"72h0m0s"`
	Status      Status        `` /* 143-byte string literal not displayed */
	Concurrency int           `help:"how many concurrent retain requests can be processed at the same time." default:"5"`
}

Config defines parameters for the retain service.

type Request

type Request struct {
	SatelliteID   storj.NodeID
	CreatedBefore time.Time
	Filter        *bloomfilter.Filter
}

Request contains all the info necessary to process a retain request.

type Service

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

Service queues and processes retain requests from satellites.

architecture: Worker

func NewService

func NewService(log *zap.Logger, store *pieces.Store, config Config) *Service

NewService creates a new retain service.

func (*Service) Close added in v0.20.0

func (s *Service) Close() error

Close causes any pending Run to exit and waits for any retain requests to clean up.

func (*Service) Queue

func (s *Service) Queue(req Request) bool

Queue adds a retain request to the queue. It discards a request for a satellite that already has a queued request. true is returned if the request is queued and false is returned if it is discarded.

func (*Service) Run

func (s *Service) Run(ctx context.Context) (err error)

Run listens for queued retain requests and processes them as they come in.

func (*Service) Status

func (s *Service) Status() Status

Status returns the retain status.

func (*Service) TestWaitUntilEmpty added in v0.20.0

func (s *Service) TestWaitUntilEmpty()

TestWaitUntilEmpty blocks until the queue and working is empty. When Run exits, it empties the queue.

type Status

type Status uint32

Status is a type defining the enabled/disabled status of retain requests.

const (
	// Disabled means we do not do anything with retain requests.
	Disabled Status = iota + 1
	// Enabled means we fully enable retain requests and delete data not defined by bloom filter.
	Enabled
	// Debug means we partially enable retain requests, and print out pieces we should delete, without actually deleting them.
	Debug
)

func (*Status) Set

func (v *Status) Set(s string) error

Set implements pflag.Value.

func (*Status) String

func (v *Status) String() string

String implements pflag.Value.

func (*Status) Type

func (*Status) Type() string

Type implements pflag.Value.

Jump to

Keyboard shortcuts

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