backup

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBackupDate

func FormatBackupDate(t time.Time) string

FormatBackupDate formats a time with the layout compatible with this module.

func GetBackupTargetFile

func GetBackupTargetFile(backupFileNames []string, targetRecoveryTime time.Time, logger logr.Logger) (string, error)

GetBackupTargetFile finds the backup file with the closest date to the target recovery time.

func GetFilePath added in v0.36.0

func GetFilePath(path, fileName string) string

GetFilePath returns the path to a backup file.

func GetOldBackupFiles

func GetOldBackupFiles(backupFileNames []string, maxRetention time.Duration, logger logr.Logger) []string

GetOldBackupFiles determines which backup files should be deleted according with the retention policy.

func GetUncompressedBackupFile added in v0.34.0

func GetUncompressedBackupFile(compressedBackupFile string) (string, error)

GetUncompressedBackupFile returns the file without the compression extension. It will return an error if the file does not have compression. You may check this with ParseCompressionAlgorithm.

func IsValidBackupFile

func IsValidBackupFile(fileName string) bool

IsValidBackupFile determines whether a backup file name is valid.

func ParseBackupDate

func ParseBackupDate(timeRaw string) (time.Time, error)

ParseBackupDate parses a time string with the layout compatible with this module.

func ParseCompressionAlgorithm added in v0.34.0

func ParseCompressionAlgorithm(fileName string) (mariadbv1alpha1.CompressAlgorithm, error)

ParseCompressionAlrogrithm gets the compression algorithm from the backup file name.

Types

type BackupCompressor added in v0.36.0

type BackupCompressor interface {
	Compress(fileName string) error
	Decompress(fileName string) (string, error)
}

func NewBzip2BackupCompressor added in v0.36.0

func NewBzip2BackupCompressor(basePath string, logger logr.Logger) BackupCompressor

func NewGzipBackupCompressor added in v0.36.0

func NewGzipBackupCompressor(basePath string, logger logr.Logger) BackupCompressor

func NewNopCompressor added in v0.36.0

func NewNopCompressor(basePath string, logger logr.Logger) BackupCompressor

type BackupStorage

type BackupStorage interface {
	List(ctx context.Context) ([]string, error)
	Push(ctx context.Context, fileName string) error
	Pull(ctx context.Context, fileName string) error
	Delete(ctx context.Context, fileName string) error
	// contains filtered or unexported methods
}

func NewFileSystemBackupStorage

func NewFileSystemBackupStorage(basePath string, logger logr.Logger) BackupStorage

func NewS3BackupStorage

func NewS3BackupStorage(basePath, bucket, endpoint string, logger logr.Logger, s3Opts ...S3BackupStorageOpt) (BackupStorage, error)

type Bzip2BackupCompressor added in v0.36.0

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

func (*Bzip2BackupCompressor) Compress added in v0.36.0

func (c *Bzip2BackupCompressor) Compress(fileName string) error

func (*Bzip2BackupCompressor) Decompress added in v0.36.0

func (c *Bzip2BackupCompressor) Decompress(fileName string) (string, error)

type FileSystemBackupStorage

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

func (*FileSystemBackupStorage) Delete

func (f *FileSystemBackupStorage) Delete(ctx context.Context, fileName string) error

func (*FileSystemBackupStorage) List

func (*FileSystemBackupStorage) Pull

func (f *FileSystemBackupStorage) Pull(ctx context.Context, fileName string) error

func (*FileSystemBackupStorage) Push

func (f *FileSystemBackupStorage) Push(ctx context.Context, fileName string) error

type GzipBackupCompressor added in v0.36.0

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

func (*GzipBackupCompressor) Compress added in v0.36.0

func (c *GzipBackupCompressor) Compress(fileName string) error

func (*GzipBackupCompressor) Decompress added in v0.36.0

func (c *GzipBackupCompressor) Decompress(fileName string) (string, error)

type NopCompressor added in v0.36.0

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

func (*NopCompressor) Compress added in v0.36.0

func (c *NopCompressor) Compress(fileName string) error

func (*NopCompressor) Decompress added in v0.36.0

func (c *NopCompressor) Decompress(fileName string) (string, error)

type S3BackupStorage

type S3BackupStorage struct {
	S3BackupStorageOpts
	// contains filtered or unexported fields
}

func (*S3BackupStorage) Delete

func (s *S3BackupStorage) Delete(ctx context.Context, fileName string) error

func (*S3BackupStorage) List

func (s *S3BackupStorage) List(ctx context.Context) ([]string, error)

func (*S3BackupStorage) Pull

func (s *S3BackupStorage) Pull(ctx context.Context, fileName string) error

func (*S3BackupStorage) Push

func (s *S3BackupStorage) Push(ctx context.Context, fileName string) error

type S3BackupStorageOpt

type S3BackupStorageOpt func(s *S3BackupStorageOpts)

func WithCACertPath added in v0.0.27

func WithCACertPath(caCertPath string) S3BackupStorageOpt

func WithPrefix added in v0.0.25

func WithPrefix(prefix string) S3BackupStorageOpt

func WithRegion

func WithRegion(region string) S3BackupStorageOpt

func WithTLS

func WithTLS(tls bool) S3BackupStorageOpt

type S3BackupStorageOpts

type S3BackupStorageOpts struct {
	TLS        bool
	CACertPath string
	Region     string
	Prefix     string
}

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy