backup

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 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 Options

type Options struct {
	// Scylladb snapshot tag.
	// If empty, the snapshot tag is generated using current date and a hostname.
	SnapshotTag string `yaml:"snapshotTag"`
	// Where to store a backup on a database host before uploading to s3
	LocalPath string `yaml:"localPath"`
	// A list of keyspaces to back up.
	// Empty means all keyspaces.
	Keyspaces []string
	// Turns off upload to a remote storage
	DisableUpload bool `yaml:"disableUpload"`
	// Should local directories be cleaned up after uploading to remote storage
	CleanupLocal bool `yaml:"cleanupLocal"`
	// Should the expired backups be removed from s3 when creating a new backup
	CleanupRemote bool `yaml:"cleanupRemote"`
	// How long should the backups live in remote storage
	Retention time.Duration
	// Settings for compress backup
	Archive entity.Archive
}

type Service

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

Service is a backup management service. It operates on a single node.

func NewService

func NewService(
	options Options,
	buildInfo entity.BuildInfo,
	db dbClient,
	remoteStorage remoteStorageClient,
	notifier notifier.Notifier,
	logger *zap.SugaredLogger,
) *Service

func (*Service) Backup

func (s *Service) Backup(ctx context.Context, node *entity.Node) entity.BackupResult

Backup creates a database backup, uploads it to remote storage, and cleans up temporary files

func (*Service) Cleanup

func (s *Service) Cleanup(ctx context.Context, node *entity.Node, snapshotTag string) entity.CleanupResult

Cleanup removes temporary files on database node, as well as expired backups from this node in remote storage.

func (*Service) CleanupExpiredBackups

func (s *Service) CleanupExpiredBackups(
	ctx context.Context,
	node *entity.Node,
	now time.Time,
) ([]entity.RemoteBackup, error)

CleanupExpiredBackups removes expired backups from a node in remote storage.

func (*Service) Healthcheck

func (s *Service) Healthcheck(ctx context.Context, node *entity.Node) error

Healthcheck ensures the directories for backup exist on a node

func (*Service) ListExpiredBackups

func (s *Service) ListExpiredBackups(
	ctx context.Context,
	node *entity.Node,
	now time.Time,
) ([]entity.RemoteBackup, error)

ListExpiredBackups returns expired backups from a node.

Jump to

Keyboard shortcuts

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