Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cleanup ¶
type Cleanup struct {
// contains filtered or unexported fields
}
Cleanup is a service, which combines retain,TTL,trash, and runs only once (if load is not too high).
func NewCleanup ¶
func NewCleanup(log *zap.Logger, loop *SafeLoop, deleteEmpty *DeleteEmpty, blobs blobstore.Blobs, store *pieces.PieceExpirationStore, ps *pieces.Store, rc retain.Config, config Config) *Cleanup
NewCleanup creates a new Cleanup.
type Config ¶ added in v1.120.1
type Config struct {
Trash bool `help:"enable/disable trash cleanup phase" default:"true"`
Expire bool `help:"enable/disable TTL expired pieces collection phase" default:"true"`
DeleteEmpty bool `help:"enable/disable deletion of empty directories and zero sized files" default:"false"`
Retain bool `help:"enable/disable garbage collection phase" default:"true"`
}
Config is the config for the Cleanup.
type CoreLoad ¶
type CoreLoad struct {
// contains filtered or unexported fields
}
CoreLoad is an availability check which is false if load/core is high.
func NewCoreLoad ¶
func NewCoreLoad(config CoreLoadConfig) *CoreLoad
NewCoreLoad creates a new CoreLoad.
type CoreLoadConfig ¶
type CoreLoadConfig struct {
MaxCoreLoad float64 `help:"max Linux load / core for executing background jobs. Jobs will be cancelled if load is higher" default:"10"`
}
CoreLoadConfig is the configuration for core load.
type DeleteEmpty ¶ added in v1.122.1
type DeleteEmpty struct {
// contains filtered or unexported fields
}
DeleteEmpty chore deletes the remaining empty blobstore directories.
func NewDeleteEmpty ¶ added in v1.122.1
func NewDeleteEmpty(log *zap.Logger, config piecestore.OldConfig, blobs blobstore.Blobs) *DeleteEmpty
NewDeleteEmpty creates a new DeleteEmpty.
type Enablement ¶
type Enablement interface {
Enabled() (bool, error)
}
Enablement checks if we have free resources to run background jobs.
type FileExists ¶
type FileExists struct {
Path string
}
FileExists is an availability check which is false if file exists.
func NewFileExists ¶
func NewFileExists(config FileExistsConfig) *FileExists
NewFileExists creates a new FileExists.
type FileExistsConfig ¶
type FileExistsConfig struct {
Path string `help:"path to the file. Cleanup will be stopped if file exists" default:"/tmp/storj.chore.disable"`
}
FileExistsConfig contains the configuration for FileExists.
type Period ¶
type Period struct {
// contains filtered or unexported fields
}
Period is an availability check which is false if the current time is outside the configured period.
type PeriodConfig ¶
type PeriodConfig struct {
FromHour int `help:"hour to start cleanup" default:"0"`
ToHour int `help:"hour to stop cleanup" default:"24"`
}
PeriodConfig contains the configuration for Period.
type SafeLoop ¶
type SafeLoop struct {
// contains filtered or unexported fields
}
SafeLoop is an execution.
func NewSafeLoop ¶
func NewSafeLoop(log *zap.Logger, availability []Enablement, cfg SafeLoopConfig) *SafeLoop
NewSafeLoop creates a new SafeLoop.
func (*SafeLoop) RunSafe ¶
func (s *SafeLoop) RunSafe(ctx context.Context, do func(ctx context.Context) error) (err error)
RunSafe runs the given function in a loop until it returns an error or the context is done. If stops the function, with context cancellation, if condition is false (for example: if load is high).
type SafeLoopConfig ¶
type SafeLoopConfig struct {
CheckingPeriod time.Duration `help:"time period to check the availability condition" default:"1m"`
RunPeriod time.Duration `help:"minimum time between the execution of cleanup" default:"15m"`
}
SafeLoopConfig is the configuration for SafeLoop.