backup

package
v0.0.0-...-2ae8b38 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backuper

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

func NewBackuper

func NewBackuper(
	filesRepository RemoteFilesRepository,
	eChecker ExistentFilesChecker,
	config Config,
) Backuper

func (Backuper) Upload

func (h Backuper) Upload(ctx context.Context, errChan chan error) error

type Checker

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

func NewChecker

func NewChecker(filesRepository RemoteFilesRepository, cfg Config) *Checker

func (*Checker) Add

func (h *Checker) Add(path string, uploadedAt time.Time, _ int64)

func (*Checker) Close

func (h *Checker) Close(ctx context.Context) error

func (*Checker) Exists

func (h *Checker) Exists(path string, lastUpdate time.Time) bool

func (*Checker) GetFiles

func (h *Checker) GetFiles() map[string]time.Time

func (*Checker) Ignored

func (h *Checker) Ignored() int

func (Checker) Open

func (h Checker) Open(ctx context.Context) error

func (*Checker) Remove

func (h *Checker) Remove(path string)

func (*Checker) Uploaded

func (h *Checker) Uploaded() int

type Config

type Config struct {
	PathsToBackup   []string          `yaml:"pathsToBackup"`
	IgnoredPatterns []string          `yaml:"ignoredPatterns"`
	SelectedRemote  string            `yaml:"selectedRemote"`
	DatabaseKey     string            `yaml:"databaseKey" default:"backup.db"`
	Remotes         map[string]Remote `yaml:"remotes"`
	GlacierPath     string
}

func (Config) IsLocal

func (conf Config) IsLocal() bool

func (Config) IsS3

func (conf Config) IsS3() bool

type ConfigDecoder

type ConfigDecoder struct {
}

func NewConfigDecoder

func NewConfigDecoder() *ConfigDecoder

func (ConfigDecoder) LoadConfiguration

func (cd ConfigDecoder) LoadConfiguration() (Config, error)

type ExistentFilesChecker

type ExistentFilesChecker interface {
	Open(ctx context.Context) error
	Add(path string, uploadedAt time.Time, size int64)
	Remove(path string)
	Exists(path string, lastUpdated time.Time) bool
	Close(ctx context.Context) error
	Ignored() int
	Uploaded() int
	GetFiles() map[string]time.Time
}

type FileNotFoundError

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

func NewFileNotFoundError

func NewFileNotFoundError(filePath string) FileNotFoundError

func (FileNotFoundError) Error

func (f FileNotFoundError) Error() string

type Remote

type Remote struct {
	CustomConfig map[string]string `yaml:"customConfig"`
}

type RemoteFilesRepository

type RemoteFilesRepository interface {
	PutGlacier(ctx context.Context, localPath string) error
	PutEditable(ctx context.Context, localPath string, remotePath string) error
	Delete(ctx context.Context, remotePath string) error
	Get(ctx context.Context, remotePath string) (string, error)
	Download(ctx context.Context, key string, path string) error
}

type SQLiteChecker

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

func NewSQLiteChecker

func NewSQLiteChecker(cfg SqliteConfig, repository RemoteFilesRepository) *SQLiteChecker

func (*SQLiteChecker) Add

func (c *SQLiteChecker) Add(path string, uploadedAt time.Time, size int64)

func (*SQLiteChecker) Close

func (c *SQLiteChecker) Close(ctx context.Context) error

func (*SQLiteChecker) Exists

func (c *SQLiteChecker) Exists(path string, lastUpdated time.Time) bool

func (*SQLiteChecker) GetFiles

func (c *SQLiteChecker) GetFiles() map[string]time.Time

func (*SQLiteChecker) Ignored

func (c *SQLiteChecker) Ignored() int

func (*SQLiteChecker) Open

func (c *SQLiteChecker) Open(ctx context.Context) error

func (*SQLiteChecker) Remove

func (c *SQLiteChecker) Remove(path string)

func (*SQLiteChecker) Uploaded

func (c *SQLiteChecker) Uploaded() int

type SqliteConfig

type SqliteConfig struct {
	Path string
	Key  string
}

Directories

Path Synopsis
implementations
s3

Jump to

Keyboard shortcuts

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