Documentation
¶
Overview ¶
Package s3 provides a storage.Manager for S3
Index ¶
- type Storage
- func (s Storage) CleanupBackups(ctx context.Context) (err error)
- func (s Storage) DownloadAsReader(ctx context.Context, name string) (helper.ReaderAtCloser, int64, error)
- func (s Storage) DownloadPITBackupAsReader(ctx context.Context, pit time.Time) (helper.ReaderAtCloser, int64, error)
- func (s Storage) DownloadPITBackupToFile(ctx context.Context, pit time.Time, targetPath string) error
- func (s Storage) DownloadToFile(ctx context.Context, name, targetPath string) error
- func (s Storage) ListAvailableBackups(ctx context.Context) ([]string, error)
- func (s Storage) UploadFromFile(ctx context.Context, filePath string) error
- func (s Storage) UploadFromReader(ctx context.Context, name string, data io.Reader, size int64) (err error)
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 ¶
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 ¶
DownloadToFile fetches the given backup (must exist) and saves it to the given targetPath
func (Storage) ListAvailableBackups ¶
ListAvailableBackups fetches a list of backups stored on the remote storage and returns the names suitable for DownloadToFile
func (Storage) UploadFromFile ¶
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