Documentation ¶
Index ¶
- Constants
- Variables
- func FileCleanup(pattern string, options ...FileCleanerOption) error
- type CompletedConfig
- type Config
- type ConfigOption
- type ConfigOptionFunc
- type DiskCleaner
- func (*DiskCleaner) Descriptor() ([]byte, []int)deprecated
- func (x *DiskCleaner) GetBaseExpired() *duration.Duration
- func (x *DiskCleaner) GetCheckInterval() *duration.Duration
- func (x *DiskCleaner) GetDiskUsage() float32
- func (x *DiskCleaner) GetEnabled() bool
- func (x *DiskCleaner) GetExts() []string
- func (x *DiskCleaner) GetMinExpired() *duration.Duration
- func (x *DiskCleaner) GetPaths() []string
- func (*DiskCleaner) ProtoMessage()
- func (x *DiskCleaner) ProtoReflect() protoreflect.Message
- func (x *DiskCleaner) Reset()
- func (x *DiskCleaner) String() string
- type DiskCleanerConfig
- type DiskCleanerConfigOption
- type DiskCleanerConfigOptionFunc
- type DiskCleanerSerivce
- type EmptyConfigOption
- type EmptyDiskCleanerConfigOption
- type EmptyFileCleanerOption
- type FileCleaner
- type FileCleanerOption
- type FileCleanerOptionFunc
- type RotatedFiles
Constants ¶
Variables ¶
var File_pkg_file_cleanup_disk_cleaner_proto protoreflect.FileDescriptor
Functions ¶
func FileCleanup ¶
func FileCleanup(pattern string, options ...FileCleanerOption) error
Types ¶
type CompletedConfig ¶ added in v0.0.75
type CompletedConfig struct {
// contains filtered or unexported fields
}
CompletedConfig ...
type Config ¶ added in v0.0.75
type Config struct { Proto DiskCleaner Validator *validator.Validate // contains filtered or unexported fields }
Config ...
func NewConfig ¶ added in v0.0.75
func NewConfig(options ...ConfigOption) *Config
NewConfig returns a Config struct with the default values
func (*Config) ApplyOptions ¶ added in v0.0.75
func (o *Config) ApplyOptions(options ...ConfigOption) *Config
func (*Config) Complete ¶ added in v0.0.75
func (c *Config) Complete() CompletedConfig
Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.
type ConfigOption ¶ added in v0.0.75
type ConfigOption interface {
// contains filtered or unexported methods
}
A ConfigOption sets options.
func WithViper ¶ added in v0.0.75
func WithViper(v *viper.Viper) ConfigOption
type ConfigOptionFunc ¶ added in v0.0.75
type ConfigOptionFunc func(*Config)
ConfigOptionFunc wraps a function that modifies Client into an implementation of the ConfigOption interface.
type DiskCleaner ¶ added in v0.0.75
type DiskCleaner struct { Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` // disk usage >= disk_usage, start to clean file, 0 means nerver clean, range // 0-100 DiskUsage float32 `protobuf:"fixed32,2,opt,name=disk_usage,json=diskUsage,proto3" json:"disk_usage,omitempty"` // clearn paths Paths []string `protobuf:"bytes,3,rep,name=paths,proto3" json:"paths,omitempty"` // ext Exts []string `protobuf:"bytes,4,rep,name=exts,proto3" json:"exts,omitempty"` CheckInterval *duration.Duration `protobuf:"bytes,5,opt,name=check_interval,json=checkInterval,proto3" json:"check_interval,omitempty"` BaseExpired *duration.Duration `protobuf:"bytes,6,opt,name=base_expired,json=baseExpired,proto3" json:"base_expired,omitempty"` MinExpired *duration.Duration `protobuf:"bytes,7,opt,name=min_expired,json=minExpired,proto3" json:"min_expired,omitempty"` // contains filtered or unexported fields }
func (*DiskCleaner) Descriptor
deprecated
added in
v0.0.75
func (*DiskCleaner) Descriptor() ([]byte, []int)
Deprecated: Use DiskCleaner.ProtoReflect.Descriptor instead.
func (*DiskCleaner) GetBaseExpired ¶ added in v0.0.75
func (x *DiskCleaner) GetBaseExpired() *duration.Duration
func (*DiskCleaner) GetCheckInterval ¶ added in v0.0.75
func (x *DiskCleaner) GetCheckInterval() *duration.Duration
func (*DiskCleaner) GetDiskUsage ¶ added in v0.0.75
func (x *DiskCleaner) GetDiskUsage() float32
func (*DiskCleaner) GetEnabled ¶ added in v0.0.75
func (x *DiskCleaner) GetEnabled() bool
func (*DiskCleaner) GetExts ¶ added in v0.0.75
func (x *DiskCleaner) GetExts() []string
func (*DiskCleaner) GetMinExpired ¶ added in v0.0.75
func (x *DiskCleaner) GetMinExpired() *duration.Duration
func (*DiskCleaner) GetPaths ¶ added in v0.0.75
func (x *DiskCleaner) GetPaths() []string
func (*DiskCleaner) ProtoMessage ¶ added in v0.0.75
func (*DiskCleaner) ProtoMessage()
func (*DiskCleaner) ProtoReflect ¶ added in v0.0.75
func (x *DiskCleaner) ProtoReflect() protoreflect.Message
func (*DiskCleaner) Reset ¶ added in v0.0.75
func (x *DiskCleaner) Reset()
func (*DiskCleaner) String ¶ added in v0.0.75
func (x *DiskCleaner) String() string
type DiskCleanerConfig ¶ added in v0.0.75
type DiskCleanerConfig struct {
// contains filtered or unexported fields
}
func (*DiskCleanerConfig) ApplyOptions ¶ added in v0.0.75
func (o *DiskCleanerConfig) ApplyOptions(options ...DiskCleanerConfigOption) *DiskCleanerConfig
type DiskCleanerConfigOption ¶ added in v0.0.75
type DiskCleanerConfigOption interface {
// contains filtered or unexported methods
}
A DiskCleanerConfigOption sets options.
func WithDiskBaseExpired ¶ added in v0.0.75
func WithDiskBaseExpired(expired time.Duration) DiskCleanerConfigOption
func WithDiskCheckInterval ¶ added in v0.0.75
func WithDiskCheckInterval(interval time.Duration) DiskCleanerConfigOption
func WithDiskMinExpired ¶ added in v0.0.75
func WithDiskMinExpired(expired time.Duration) DiskCleanerConfigOption
type DiskCleanerConfigOptionFunc ¶ added in v0.0.75
type DiskCleanerConfigOptionFunc func(*DiskCleanerConfig)
DiskCleanerConfigOptionFunc wraps a function that modifies Client into an implementation of the DiskCleanerConfigOption interface.
type DiskCleanerSerivce ¶ added in v0.0.75
type DiskCleanerSerivce struct {
// contains filtered or unexported fields
}
DiskCleanerSerivce ...
func NewDiskCleanerSerivce ¶ added in v0.0.75
func NewDiskCleanerSerivce( diskUsage float32, paths []string, exts []string, opts ...DiskCleanerConfigOption, ) (*DiskCleanerSerivce, error)
NewDiskCleanerSerivce ...
func (*DiskCleanerSerivce) Run ¶ added in v0.0.75
func (s *DiskCleanerSerivce) Run(ctx context.Context) error
Run will initialize the backend. It must not block, but may run go routines in the background.
func (*DiskCleanerSerivce) Serve ¶ added in v0.0.75
func (s *DiskCleanerSerivce) Serve(ctx context.Context) error
Serve ...
func (*DiskCleanerSerivce) Shutdown ¶ added in v0.0.75
func (s *DiskCleanerSerivce) Shutdown()
Shutdown ...
type EmptyConfigOption ¶ added in v0.0.75
type EmptyConfigOption struct{}
EmptyConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type EmptyDiskCleanerConfigOption ¶ added in v0.0.75
type EmptyDiskCleanerConfigOption struct{}
EmptyDiskCleanerConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type EmptyFileCleanerOption ¶
type EmptyFileCleanerOption struct{}
EmptyFileCleanerOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type FileCleaner ¶
type FileCleaner struct {
// contains filtered or unexported fields
}
func (*FileCleaner) ApplyOptions ¶
func (o *FileCleaner) ApplyOptions(options ...FileCleanerOption) *FileCleaner
type FileCleanerOption ¶
type FileCleanerOption interface {
// contains filtered or unexported methods
}
A FileCleanerOption sets options.
func WithMaxAge ¶
func WithMaxAge(maxAge time.Duration) FileCleanerOption
func WithMaxCount ¶
func WithMaxCount(maxCount int64) FileCleanerOption
type FileCleanerOptionFunc ¶
type FileCleanerOptionFunc func(*FileCleaner)
FileCleanerOptionFunc wraps a function that modifies Client into an implementation of the FileCleanerOption interface.
type RotatedFiles ¶ added in v0.0.40
type RotatedFiles []string
func (RotatedFiles) Len ¶ added in v0.0.40
func (f RotatedFiles) Len() int
func (RotatedFiles) Less ¶ added in v0.0.40
func (f RotatedFiles) Less(i, j int) bool
func (RotatedFiles) Swap ¶ added in v0.0.40
func (f RotatedFiles) Swap(i, j int)