rotation

package
v0.0.0-...-4aef51c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Path       string
	ArchivedAt time.Time
	Size       int64
}

type ArchiveByCompression

type ArchiveByCompression struct {
	RawArchive ArchiveStrategy
	Retention  RetainStrategy
	Naming     NamingStrategy
	Compressor Compressor
}

type ArchiveByMove

type ArchiveByMove struct {
	NamingStrategy NamingStrategy
}

func (*ArchiveByMove) Archive

func (strategy *ArchiveByMove) Archive(path string) ([]Archive, error)

type ArchiveStrategy

type ArchiveStrategy interface {
	Archive(path string) ([]Archive, error)
}

type Compressor

type Compressor interface {
}

type Config

type Config struct {
	WritePath       string
	FileMode        os.FileMode
	DirectoryMode   os.FileMode
	TriggerStrategy TriggerStrategy
	ArchiveStrategy ArchiveStrategy
	RetainStrategy  RetainStrategy
	PurgeStrategy   PurgeStrategy
}

type NameByIndex

type NameByIndex struct {
	Directory  string
	Pattern    string
	StartIndex int
}

func (*NameByIndex) ListFiles

func (naming *NameByIndex) ListFiles() ([]string, error)

type NameByTime

type NameByTime struct {
	Directory string
	Pattern   string
}

func (*NameByTime) ListFiles

func (namer *NameByTime) ListFiles() ([]Archive, error)

func (*NameByTime) NextFile

func (namer *NameByTime) NextFile() (string, error)

type NamingStrategy

type NamingStrategy interface {
	ListFiles() ([]Archive, error)
	NextFile() (string, error)
}

type PurgeByDelete

type PurgeByDelete struct {
}

func (*PurgeByDelete) Purge

func (strategy *PurgeByDelete) Purge(purgeSet []Archive) error

type PurgeStrategy

type PurgeStrategy interface {
	Purge(purgeSet []Archive) error
}

type RetainByCount

type RetainByCount struct {
	MaxArchivesCount int
}

func (*RetainByCount) PurgeSet

func (strategy *RetainByCount) PurgeSet(archives []Archive) []Archive

type RetainStrategy

type RetainStrategy interface {
	PurgeSet(archives []Archive) []Archive
}

type TriggerByInterval

type TriggerByInterval struct {
	Interval time.Duration
}

func (*TriggerByInterval) TimeToTrigger

func (trigger *TriggerByInterval) TimeToTrigger() time.Duration

func (*TriggerByInterval) UpdateStat

func (trigger *TriggerByInterval) UpdateStat(stat interface{}, file *os.File, buf []byte) (interface{}, bool, error)

type TriggerBySize

type TriggerBySize struct {
	SizeInKB int64
}

func (*TriggerBySize) UpdateStat

func (trigger *TriggerBySize) UpdateStat(stat interface{}, file *os.File, buf []byte) (interface{}, bool, error)

type TriggerStrategy

type TriggerStrategy interface {
	UpdateStat(stat interface{}, file *os.File, buf []byte) (interface{}, bool, error)
	TimeToTrigger() time.Duration
}

type Writer

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

func NewWriter

func NewWriter(cfg Config) (*Writer, error)

func (*Writer) Close

func (writer *Writer) Close() error

func (*Writer) Write

func (writer *Writer) Write(buf []byte) (int, error)

Jump to

Keyboard shortcuts

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