s3

package
v0.0.0-...-395ddcd Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package s3 provides a storage.Manager for S3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Storage

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

Storage implements the storage.Manager interface to provide backup storage access in S3 compatible (S3, GCS, MinIO) storages

func New

func New(ctx context.Context, storageLocation *v1.DatabaseBackupStorageLocation, cfg *v1.DatabaseBackup) (*Storage, error)

New creates a new S3 Storage

func (Storage) CleanupBackups

func (s Storage) CleanupBackups(ctx context.Context) (err error)

CleanupBackups takes care of removing expired backups from the remote storage

func (Storage) DownloadAsReader

func (s Storage) DownloadAsReader(ctx context.Context, name string) (helper.ReaderAtCloser, int64, error)

DownloadAsReader fetches the given backup (must exist) and returns an io.ReadCloser for it

func (Storage) DownloadPITBackupAsReader

func (s Storage) DownloadPITBackupAsReader(ctx context.Context, pit time.Time) (helper.ReaderAtCloser, int64, error)

DownloadPITBackupAsReader takes a Point-in-Time, fetches the closest older backup to that point-in-time and returns an io.ReadCloser for it

func (Storage) DownloadPITBackupToFile

func (s Storage) DownloadPITBackupToFile(ctx context.Context, pit time.Time, targetPath string) error

DownloadPITBackupToFile takes a Point-in-Time and downloads the closest older backup to that point-in-time to thhe given path

func (Storage) DownloadToFile

func (s Storage) DownloadToFile(ctx context.Context, name, targetPath string) error

DownloadToFile fetches the given backup (must exist) and saves it to the given targetPath

func (Storage) ListAvailableBackups

func (s Storage) ListAvailableBackups(ctx context.Context) ([]string, error)

ListAvailableBackups fetches a list of backups stored on the remote storage and returns the names suitable for DownloadToFile

func (Storage) UploadFromFile

func (s Storage) UploadFromFile(ctx context.Context, filePath string) error

UploadFromFile takes a local file and uploads the contents under the filename the file on the filesystem has

func (Storage) UploadFromReader

func (s Storage) UploadFromReader(ctx context.Context, name string, data io.Reader, size int64) (err error)

UploadFromReader takes a name and a reader to upload a backup to the remote storage. The name is used as storage name and later available in ListAvailableBackups and DownloadToFile

Jump to

Keyboard shortcuts

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