Documentation
¶
Index ¶
- func FormatBackupDate(t time.Time) string
- func GetBackupTargetFile(backupFileNames []string, targetRecoveryTime time.Time, logger logr.Logger) (string, error)
- func GetFilePath(path, fileName string) string
- func GetOldBackupFiles(backupFileNames []string, maxRetention time.Duration, logger logr.Logger) []string
- func GetUncompressedBackupFile(compressedBackupFile string) (string, error)
- func IsValidBackupFile(fileName string) bool
- func ParseBackupDate(timeRaw string) (time.Time, error)
- func ParseCompressionAlgorithm(fileName string) (mariadbv1alpha1.CompressAlgorithm, error)
- type BackupCompressor
- type BackupStorage
- type Bzip2BackupCompressor
- type FileSystemBackupStorage
- func (f *FileSystemBackupStorage) Delete(ctx context.Context, fileName string) error
- func (f *FileSystemBackupStorage) List(ctx context.Context) ([]string, error)
- func (f *FileSystemBackupStorage) Pull(ctx context.Context, fileName string) error
- func (f *FileSystemBackupStorage) Push(ctx context.Context, fileName string) error
- type GzipBackupCompressor
- type NopCompressor
- type S3BackupStorage
- type S3BackupStorageOpt
- type S3BackupStorageOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBackupDate ¶
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
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
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 ¶
IsValidBackupFile determines whether a backup file name is valid.
func ParseBackupDate ¶
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 (f *FileSystemBackupStorage) List(ctx context.Context) ([]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)
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