clean

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2025 License: BSD-3-Clause Imports: 8 Imported by: 2

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(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