backup

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileBackup

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

FileBackup saves the events on the file system

func NewFileBackup

func NewFileBackup(
	backupInterval time.Duration,
	directory string,
) *FileBackup

NewFileBackup creates file system backup service

func (*FileBackup) Flush

func (b *FileBackup) Flush()

Flush is called before shutdown to force process of the last batch

func (*FileBackup) SaveAsync

func (b *FileBackup) SaveAsync(event *types.Event)

SaveAsync saves an event asynchronously

type IBackup

type IBackup interface {
	SaveAsync(event *types.Event)
	Flush()
}

IBackup interface for backup service

func New

func New(
	enabled bool,
	backupInterval time.Duration,
	directory string,
) IBackup

New is factory for backup service nolint: revive

type NullBackup

type NullBackup struct {
}

NullBackup is disabled backup implementation

func NewNullBackup

func NewNullBackup() *NullBackup

NewNullBackup creates disabled backup implementation

func (*NullBackup) Flush

func (*NullBackup) Flush()

Flush disabled implementation

func (*NullBackup) SaveAsync

func (*NullBackup) SaveAsync(_ *types.Event)

SaveAsync disabled implementation

Jump to

Keyboard shortcuts

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