Documentation
¶
Index ¶
- type AzureBlobConfig
- type AzureBlobStorage
- func (s *AzureBlobStorage) Close() error
- func (s *AzureBlobStorage) ContainerName() string
- func (s *AzureBlobStorage) CopyBlob(ctx context.Context, srcPath, dstPath string) error
- func (s *AzureBlobStorage) Delete(ctx context.Context, path string) error
- func (s *AzureBlobStorage) Exists(ctx context.Context, path string) (bool, error)
- func (s *AzureBlobStorage) GenerateSASURL(ctx context.Context, path string, expiry time.Duration) (string, error)
- func (s *AzureBlobStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
- func (s *AzureBlobStorage) Prefix() string
- func (s *AzureBlobStorage) Read(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *AzureBlobStorage) Size(ctx context.Context, path string) (int64, error)
- func (s *AzureBlobStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
- func (s *AzureBlobStorage) Type() string
- func (s *AzureBlobStorage) Write(ctx context.Context, path string, reader io.Reader, size int64) error
- type B2Config
- type B2Storage
- func (s *B2Storage) Bucket() string
- func (s *B2Storage) Close() error
- func (s *B2Storage) CopyObject(ctx context.Context, srcPath, dstPath string) error
- func (s *B2Storage) Delete(ctx context.Context, path string) error
- func (s *B2Storage) Exists(ctx context.Context, path string) (bool, error)
- func (s *B2Storage) GeneratePresignedURL(ctx context.Context, path string, expiry time.Duration) (string, error)
- func (s *B2Storage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
- func (s *B2Storage) Prefix() string
- func (s *B2Storage) Read(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *B2Storage) Size(ctx context.Context, path string) (int64, error)
- func (s *B2Storage) Stats(ctx context.Context) (*backup.StorageStats, error)
- func (s *B2Storage) Type() string
- func (s *B2Storage) Write(ctx context.Context, path string, reader io.Reader, size int64) error
- type LocalStorage
- func (s *LocalStorage) BasePath() string
- func (s *LocalStorage) Close() error
- func (s *LocalStorage) CreateSubdir(name string) (string, error)
- func (s *LocalStorage) Delete(ctx context.Context, path string) error
- func (s *LocalStorage) EnsureSpace(ctx context.Context, requiredBytes int64) error
- func (s *LocalStorage) Exists(ctx context.Context, path string) (bool, error)
- func (s *LocalStorage) GetLastModified(ctx context.Context, path string) (time.Time, error)
- func (s *LocalStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
- func (s *LocalStorage) Read(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *LocalStorage) Size(ctx context.Context, path string) (int64, error)
- func (s *LocalStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
- func (s *LocalStorage) Type() string
- func (s *LocalStorage) Write(ctx context.Context, path string, reader io.Reader, size int64) error
- type S3Config
- type S3Storage
- func (s *S3Storage) Bucket() string
- func (s *S3Storage) Close() error
- func (s *S3Storage) CopyObject(ctx context.Context, srcPath, dstPath string) error
- func (s *S3Storage) Delete(ctx context.Context, path string) error
- func (s *S3Storage) Exists(ctx context.Context, path string) (bool, error)
- func (s *S3Storage) GeneratePresignedURL(ctx context.Context, path string, expiry time.Duration) (string, error)
- func (s *S3Storage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
- func (s *S3Storage) Prefix() string
- func (s *S3Storage) Read(ctx context.Context, path string) (io.ReadCloser, error)
- func (s *S3Storage) Size(ctx context.Context, path string) (int64, error)
- func (s *S3Storage) Stats(ctx context.Context) (*backup.StorageStats, error)
- func (s *S3Storage) Type() string
- func (s *S3Storage) Write(ctx context.Context, path string, reader io.Reader, size int64) error
- type SFTPConfig
- type SFTPStorage
- func (s *SFTPStorage) Close() error
- func (s *SFTPStorage) Delete(ctx context.Context, filePath string) error
- func (s *SFTPStorage) Exists(ctx context.Context, filePath string) (bool, error)
- func (s *SFTPStorage) GetLastModified(ctx context.Context, filePath string) (time.Time, error)
- func (s *SFTPStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
- func (s *SFTPStorage) Read(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (s *SFTPStorage) Reconnect(ctx context.Context) error
- func (s *SFTPStorage) SetPermissions(ctx context.Context, filePath string, mode os.FileMode) error
- func (s *SFTPStorage) Size(ctx context.Context, filePath string) (int64, error)
- func (s *SFTPStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
- func (s *SFTPStorage) Type() string
- func (s *SFTPStorage) Write(ctx context.Context, filePath string, reader io.Reader, size int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureBlobConfig ¶
type AzureBlobConfig struct {
// AccountName is the Azure storage account name
AccountName string
// AccountKey is the Azure storage account key
AccountKey string
// ConnectionString is the full connection string (alternative to AccountName/Key)
ConnectionString string
// ContainerName is the Azure blob container name
ContainerName string
// Prefix is the blob prefix for all backups
Prefix string
// Endpoint is the custom endpoint URL (optional, for government/China clouds)
Endpoint string
}
AzureBlobConfig contains Azure Blob storage configuration.
type AzureBlobStorage ¶
type AzureBlobStorage struct {
// contains filtered or unexported fields
}
AzureBlobStorage implements backup.Storage for Azure Blob storage.
func NewAzureBlobStorage ¶
func NewAzureBlobStorage(ctx context.Context, cfg AzureBlobConfig) (*AzureBlobStorage, error)
NewAzureBlobStorage creates a new Azure Blob storage backend.
func (*AzureBlobStorage) Close ¶
func (s *AzureBlobStorage) Close() error
Close releases any resources.
func (*AzureBlobStorage) ContainerName ¶
func (s *AzureBlobStorage) ContainerName() string
ContainerName returns the Azure container name.
func (*AzureBlobStorage) CopyBlob ¶
func (s *AzureBlobStorage) CopyBlob(ctx context.Context, srcPath, dstPath string) error
CopyBlob copies a blob within Azure storage.
func (*AzureBlobStorage) Delete ¶
func (s *AzureBlobStorage) Delete(ctx context.Context, path string) error
Delete removes a backup from Azure Blob storage.
func (*AzureBlobStorage) GenerateSASURL ¶
func (s *AzureBlobStorage) GenerateSASURL(ctx context.Context, path string, expiry time.Duration) (string, error)
GenerateSASURL generates a SAS URL for downloading a backup.
func (*AzureBlobStorage) List ¶
func (s *AzureBlobStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
List lists backups with optional prefix.
func (*AzureBlobStorage) Prefix ¶
func (s *AzureBlobStorage) Prefix() string
Prefix returns the blob prefix.
func (*AzureBlobStorage) Read ¶
func (s *AzureBlobStorage) Read(ctx context.Context, path string) (io.ReadCloser, error)
Read returns a reader for the backup at path.
func (*AzureBlobStorage) Stats ¶
func (s *AzureBlobStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
Stats returns storage statistics.
func (*AzureBlobStorage) Type ¶
func (s *AzureBlobStorage) Type() string
Type returns the storage type identifier.
type B2Config ¶
type B2Config struct {
// KeyID is the Backblaze B2 Application Key ID
KeyID string
// ApplicationKey is the Backblaze B2 Application Key
ApplicationKey string
// Bucket is the B2 bucket name
Bucket string
// Region is the B2 region (e.g., "us-west-002", "eu-central-003")
Region string
// Prefix is the key prefix for all backups
Prefix string
}
B2Config contains B2 storage configuration.
type B2Storage ¶
type B2Storage struct {
// contains filtered or unexported fields
}
B2Storage implements backup.Storage for Backblaze B2 storage using S3-compatible API.
func NewB2Storage ¶
NewB2Storage creates a new Backblaze B2 storage backend.
func (*B2Storage) CopyObject ¶
CopyObject copies an object within B2.
func (*B2Storage) GeneratePresignedURL ¶
func (s *B2Storage) GeneratePresignedURL(ctx context.Context, path string, expiry time.Duration) (string, error)
GeneratePresignedURL generates a presigned URL for downloading a backup.
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage implements backup.Storage for local filesystem storage.
func NewLocalStorage ¶
func NewLocalStorage(basePath string) (*LocalStorage, error)
NewLocalStorage creates a new local storage backend.
func (*LocalStorage) BasePath ¶
func (s *LocalStorage) BasePath() string
BasePath returns the base storage path.
func (*LocalStorage) CreateSubdir ¶
func (s *LocalStorage) CreateSubdir(name string) (string, error)
CreateSubdir creates a subdirectory in the storage path.
func (*LocalStorage) Delete ¶
func (s *LocalStorage) Delete(ctx context.Context, path string) error
Delete removes a backup from storage.
func (*LocalStorage) EnsureSpace ¶
func (s *LocalStorage) EnsureSpace(ctx context.Context, requiredBytes int64) error
EnsureSpace checks if there's enough space for a backup.
func (*LocalStorage) GetLastModified ¶
GetLastModified returns the last modification time of a backup.
func (*LocalStorage) List ¶
func (s *LocalStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
List lists backups with optional prefix.
func (*LocalStorage) Read ¶
func (s *LocalStorage) Read(ctx context.Context, path string) (io.ReadCloser, error)
Read returns a reader for the backup at path.
func (*LocalStorage) Stats ¶
func (s *LocalStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
Stats returns storage statistics.
func (*LocalStorage) Type ¶
func (s *LocalStorage) Type() string
Type returns the storage type identifier.
type S3Config ¶
type S3Config struct {
// Endpoint is the S3 endpoint URL (for MinIO, etc.)
// Leave empty for AWS S3
Endpoint string
// Region is the AWS region
Region string
// Bucket is the S3 bucket name
Bucket string
// Prefix is the key prefix for all backups
Prefix string
// AccessKey is the AWS access key
AccessKey string
// SecretKey is the AWS secret key
SecretKey string
// UsePathStyle enables path-style addressing (required for MinIO)
UsePathStyle bool
}
S3Config contains S3 storage configuration.
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage implements backup.Storage for S3-compatible storage.
func NewS3Storage ¶
NewS3Storage creates a new S3 storage backend.
func (*S3Storage) CopyObject ¶
CopyObject copies an object within S3.
func (*S3Storage) GeneratePresignedURL ¶
func (s *S3Storage) GeneratePresignedURL(ctx context.Context, path string, expiry time.Duration) (string, error)
GeneratePresignedURL generates a presigned URL for downloading a backup.
type SFTPConfig ¶
type SFTPConfig struct {
// Host is the SFTP server hostname
Host string
// Port is the SFTP server port (default: 22)
Port int
// Username is the SSH username
Username string
// Password is the SSH password (optional if using key)
Password string
// PrivateKey is the SSH private key (PEM encoded)
PrivateKey string
// PrivateKeyPassphrase is the passphrase for the private key
PrivateKeyPassphrase string
// KnownHostsFile is the path to the known_hosts file (optional)
KnownHostsFile string
// HostKeyFingerprint is the expected SSH host key fingerprint (SHA256:...).
// If set, only this fingerprint is accepted. Takes precedence over KnownHostsFile.
HostKeyFingerprint string
// InsecureIgnoreHostKey skips host key verification (not recommended)
InsecureIgnoreHostKey bool
// BasePath is the base directory on the SFTP server
BasePath string
// ConnectTimeout is the connection timeout
ConnectTimeout time.Duration
}
SFTPConfig contains SFTP storage configuration.
type SFTPStorage ¶
type SFTPStorage struct {
// contains filtered or unexported fields
}
SFTPStorage implements backup.Storage for SFTP storage.
func NewSFTPStorage ¶
func NewSFTPStorage(ctx context.Context, cfg SFTPConfig) (*SFTPStorage, error)
NewSFTPStorage creates a new SFTP storage backend.
func (*SFTPStorage) Delete ¶
func (s *SFTPStorage) Delete(ctx context.Context, filePath string) error
Delete removes a backup from storage.
func (*SFTPStorage) GetLastModified ¶
GetLastModified returns the last modification time of a backup.
func (*SFTPStorage) List ¶
func (s *SFTPStorage) List(ctx context.Context, prefix string) ([]backup.StorageEntry, error)
List lists backups with optional prefix.
func (*SFTPStorage) Read ¶
func (s *SFTPStorage) Read(ctx context.Context, filePath string) (io.ReadCloser, error)
Read returns a reader for the backup at path.
func (*SFTPStorage) Reconnect ¶
func (s *SFTPStorage) Reconnect(ctx context.Context) error
Reconnect attempts to reconnect to the SFTP server.
func (*SFTPStorage) SetPermissions ¶
SetPermissions sets file permissions on the SFTP server.
func (*SFTPStorage) Stats ¶
func (s *SFTPStorage) Stats(ctx context.Context) (*backup.StorageStats, error)
Stats returns storage statistics.
func (*SFTPStorage) Type ¶
func (s *SFTPStorage) Type() string
Type returns the storage type identifier.