clean

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: BSD-3-Clause Imports: 9 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartCleanTimer

func StartCleanTimer(ctx context.Context, data *TimerData) (<-chan struct{}, error)

StartCleanTimer starts timer in loop for doing clean tasks

Types

type Cleaner

type Cleaner interface {
	Clean(ctx context.Context, ID string) error
}

Cleaner interface for one Clean job

type CleanerGroup

type CleanerGroup struct {
	Jobs []Cleaner
}

CleanerGroup is a list of cleaners

func (*CleanerGroup) Clean

func (c *CleanerGroup) Clean(ctx context.Context, ID string) error

Clean runs all cleaners in the group

type LocalFile

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

LocalFile is a struct for local file cleaner

func NewFileCleaners

func NewFileCleaners(fs string, patterns []string) ([]*LocalFile, error)

NewFileCleaners creates file cleaners based on provided paths

func NewLocalFile

func NewLocalFile(storagePath string, pattern string) (*LocalFile, error)

NewLocalFile creates file cleaner

func (*LocalFile) Clean

func (fs *LocalFile) Clean(ctx context.Context, ID string) error

Clean removes files matching the pattern

type OldIDsProvider

type OldIDsProvider interface {
	GetExpired(ctx context.Context) ([]string, error)
}

OldIDsProvider return old ids for cleaning service

type TimerData

type TimerData struct {
	RunEvery    time.Duration
	Cleaner     Cleaner
	IDsProvider OldIDsProvider
}

TimerData keeps clean timer info

Jump to

Keyboard shortcuts

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