Documentation
¶
Overview ¶
Package storage provides storage backend implementations for local, S3, and SFTP.
Index ¶
- type BackupInfo
- type Local
- func (l *Local) Delete(_ context.Context, path string) error
- func (l *Local) Exists(_ context.Context, path string) (bool, error)
- func (l *Local) GetInfo(_ context.Context, path string) (*BackupInfo, error)
- func (l *Local) List(_ context.Context) ([]*BackupInfo, error)
- func (l *Local) Name() string
- func (l *Local) Retrieve(_ context.Context, path string, w io.Writer) error
- func (l *Local) Store(_ context.Context, path string, r io.Reader, _ int64) error
- func (l *Local) Validate(_ context.Context) error
- type S3
- func (s *S3) Delete(ctx context.Context, filePath string) error
- func (s *S3) Exists(ctx context.Context, filePath string) (bool, error)
- func (s *S3) GetInfo(ctx context.Context, filePath string) (*BackupInfo, error)
- func (s *S3) List(ctx context.Context) ([]*BackupInfo, error)
- func (s *S3) Name() string
- func (s *S3) Retrieve(ctx context.Context, filePath string, w io.Writer) error
- func (s *S3) Store(ctx context.Context, filePath string, r io.Reader, size int64) error
- func (s *S3) Validate(ctx context.Context) error
- type SFTP
- func (s *SFTP) Delete(_ context.Context, filePath string) error
- func (s *SFTP) Exists(_ context.Context, filePath string) (bool, error)
- func (s *SFTP) GetInfo(_ context.Context, filePath string) (*BackupInfo, error)
- func (s *SFTP) List(_ context.Context) ([]*BackupInfo, error)
- func (s *SFTP) Name() string
- func (s *SFTP) Retrieve(_ context.Context, filePath string, w io.Writer) error
- func (s *SFTP) Store(ctx context.Context, filePath string, r io.Reader, _ int64) error
- func (s *SFTP) Validate(_ context.Context) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupInfo ¶
BackupInfo contains metadata about a stored backup
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local implements Storage for local filesystem
func (*Local) List ¶
func (l *Local) List(_ context.Context) ([]*BackupInfo, error)
List returns all backup files in the storage
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
S3 implements Storage for AWS S3 and S3-compatible services
func (*S3) List ¶
func (s *S3) List(ctx context.Context) ([]*BackupInfo, error)
List returns all backup files in S3
type SFTP ¶
type SFTP struct {
// contains filtered or unexported fields
}
SFTP implements Storage for SFTP servers
func (*SFTP) List ¶
func (s *SFTP) List(_ context.Context) ([]*BackupInfo, error)
List returns all backup files from SFTP
type Storage ¶
type Storage interface {
// Store writes data from reader to the storage backend
// path is relative to the storage's configured base path
Store(ctx context.Context, path string, r io.Reader, size int64) error
// Retrieve reads data from storage into the writer
Retrieve(ctx context.Context, path string, w io.Writer) error
// List returns all backup files in the storage
List(ctx context.Context) ([]*BackupInfo, error)
// Delete removes a backup from storage
Delete(ctx context.Context, path string) error
// Name returns the storage backend name
Name() string
// Validate checks if the storage is accessible
Validate(ctx context.Context) error
// Exists checks if a backup file exists
Exists(ctx context.Context, path string) (bool, error)
// GetInfo returns metadata about a backup file
GetInfo(ctx context.Context, path string) (*BackupInfo, error)
}
Storage represents a backup storage backend
Click to show internal directories.
Click to hide internal directories.