Documentation
¶
Index ¶
- Constants
- Variables
- func AdjustValueByRange(value, minValue, maxSize int64) int64
- func NewErrNotFound(key string) error
- type AzureBlob
- func (a *AzureBlob) Close(_ context.Context) error
- func (a *AzureBlob) Connect(ctx context.Context) error
- func (a *AzureBlob) CopyObject(ctx context.Context, _ int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (a *AzureBlob) DeleteFile(ctx context.Context, key string) error
- func (a *AzureBlob) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (a *AzureBlob) DeleteKeysBatch(ctx context.Context, keys []string) error
- func (a *AzureBlob) DeleteKeysFromObjectDiskBackupBatch(ctx context.Context, keys []string) error
- func (a *AzureBlob) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (a *AzureBlob) GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
- func (a *AzureBlob) GetFileReaderWithLocalPath(ctx context.Context, key, _ string, _ int64) (io.ReadCloser, error)
- func (a *AzureBlob) Kind() string
- func (a *AzureBlob) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (a *AzureBlob) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (a *AzureBlob) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (a *AzureBlob) StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
- func (a *AzureBlob) Walk(ctx context.Context, azPath string, recursive bool, ...) error
- func (a *AzureBlob) WalkAbsolute(ctx context.Context, prefix string, recursive bool, ...) error
- type Backup
- type BackupDestination
- func (bd *BackupDestination) BackupList(ctx context.Context, parseMetadata bool, parseMetadataOnly string) ([]Backup, error)
- func (bd *BackupDestination) DownloadCompressedStream(ctx context.Context, remotePath string, localPath string, maxSpeed uint64) (int64, error)
- func (bd *BackupDestination) DownloadLimiter(maxBytesPerSecond uint64) *bwlimit.Limiter
- func (bd *BackupDestination) DownloadManifest(ctx context.Context, backupName string) *ManifestReader
- func (bd *BackupDestination) DownloadPath(ctx context.Context, remotePath string, localPath string, RetriesOnFailure int, ...) (int64, error)
- func (bd *BackupDestination) DownloadPathWithManifest(ctx context.Context, remotePath string, localPath string, fileNames []string, ...) (int64, error)
- func (bd *BackupDestination) RemoveBackupRemote(ctx context.Context, backup Backup, cfg *config.Config, ...) error
- func (bd *BackupDestination) UpdateMetadataCacheEntry(ctx context.Context, backup Backup) error
- func (bd *BackupDestination) UploadCompressedStream(ctx context.Context, baseLocalPath string, files []string, remotePath string, ...) error
- func (bd *BackupDestination) UploadLimiter(maxBytesPerSecond uint64) *bwlimit.Limiter
- func (bd *BackupDestination) UploadManifest(ctx context.Context, backupName string, w *ManifestWriter) error
- func (bd *BackupDestination) UploadPath(ctx context.Context, baseLocalPath string, files []string, remotePath string, ...) (int64, error)
- func (bd *BackupDestination) WalkCompressedStream(ctx context.Context, remotePath string, ...) error
- type BatchDeleteError
- type BatchDeleter
- type COS
- func (c *COS) Close(_ context.Context) error
- func (c *COS) Connect(ctx context.Context) error
- func (c *COS) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (c *COS) DeleteFile(ctx context.Context, key string) error
- func (c *COS) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (c *COS) DeleteKeysBatch(ctx context.Context, keys []string) error
- func (c *COS) DeleteKeysFromObjectDiskBackupBatch(ctx context.Context, keys []string) error
- func (c *COS) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *COS) GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *COS) GetFileReaderWithLocalPath(ctx context.Context, key, localPath string, remoteSize int64) (io.ReadCloser, error)
- func (c *COS) Kind() string
- func (c *COS) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (c *COS) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (c *COS) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (c *COS) StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
- func (c *COS) Walk(ctx context.Context, cosPath string, recursive bool, ...) error
- func (c *COS) WalkAbsolute(ctx context.Context, prefix string, recursive bool, ...) error
- type FTP
- func (f *FTP) Close(ctx context.Context) error
- func (f *FTP) Connect(ctx context.Context) error
- func (f *FTP) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (f *FTP) DeleteFile(ctx context.Context, key string) error
- func (f *FTP) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (f *FTP) DeleteKeys(ctx context.Context, keys []string) error
- func (f *FTP) DeleteKeysFromObjectDiskBackup(ctx context.Context, keys []string) error
- func (f *FTP) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (f *FTP) GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
- func (f *FTP) GetFileReaderWithLocalPath(ctx context.Context, key, _ string, _ int64) (io.ReadCloser, error)
- func (f *FTP) Kind() string
- func (f *FTP) MkdirAll(key string, client *ftp.ServerConn) error
- func (f *FTP) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (f *FTP) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, _ int64) error
- func (f *FTP) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (f *FTP) StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
- func (f *FTP) Walk(ctx context.Context, ftpPath string, recursive bool, ...) error
- func (f *FTP) WalkAbsolute(ctx context.Context, prefix string, recursive bool, ...) error
- type FTPFileReader
- type GCS
- func (gcs *GCS) Close(ctx context.Context) error
- func (gcs *GCS) Connect(ctx context.Context) error
- func (gcs *GCS) CopyObject(ctx context.Context, _ int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (gcs *GCS) DeleteFile(ctx context.Context, key string) error
- func (gcs *GCS) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (gcs *GCS) DeleteKeysBatch(ctx context.Context, keys []string) error
- func (gcs *GCS) DeleteKeysFromObjectDiskBackupBatch(ctx context.Context, keys []string) error
- func (gcs *GCS) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (gcs *GCS) GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
- func (gcs *GCS) GetFileReaderWithLocalPath(ctx context.Context, key, localPath string, remoteSize int64) (io.ReadCloser, error)
- func (gcs *GCS) Kind() string
- func (gcs *GCS) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (gcs *GCS) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (gcs *GCS) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (gcs *GCS) StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
- func (gcs *GCS) Walk(ctx context.Context, gcsPath string, recursive bool, ...) error
- func (gcs *GCS) WalkAbsolute(ctx context.Context, rootPath string, recursive bool, ...) error
- type KeyError
- type ManifestReader
- type ManifestWriter
- type RecalculateV4Signature
- type RemoteFile
- type RemoteStorage
- type S3
- func (s *S3) Close(_ context.Context) error
- func (s *S3) Connect(ctx context.Context) error
- func (s *S3) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (s *S3) DeleteFile(ctx context.Context, key string) error
- func (s *S3) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (s *S3) DeleteKeysBatch(ctx context.Context, keys []string) error
- func (s *S3) DeleteKeysFromObjectDiskBackupBatch(ctx context.Context, keys []string) error
- func (s *S3) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *S3) GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *S3) GetFileReaderWithLocalPath(ctx context.Context, key, localPath string, remoteSize int64) (io.ReadCloser, error)
- func (s *S3) Kind() string
- func (s *S3) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (s *S3) PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (s *S3) ResolveEndpoint(ctx context.Context, params s3.EndpointParameters) (endpoint smithyendpoints.Endpoint, err error)
- func (s *S3) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (s *S3) StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
- func (s *S3) Walk(ctx context.Context, s3Path string, recursive bool, ...) error
- func (s *S3) WalkAbsolute(ctx context.Context, prefix string, recursive bool, ...) error
- type S3LogToZeroLogAdapter
- type SFTP
- func (sftp *SFTP) Close(_ context.Context) error
- func (sftp *SFTP) Connect(_ context.Context) error
- func (sftp *SFTP) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
- func (sftp *SFTP) Debug(msg string, v ...interface{})
- func (sftp *SFTP) DeleteDirectory(ctx context.Context, dirPath string) error
- func (sftp *SFTP) DeleteFile(ctx context.Context, key string) error
- func (sftp *SFTP) DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
- func (sftp *SFTP) DeleteKeys(ctx context.Context, keys []string) error
- func (sftp *SFTP) DeleteKeysFromObjectDiskBackup(ctx context.Context, keys []string) error
- func (sftp *SFTP) GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
- func (sftp *SFTP) GetFileReaderAbsolute(_ context.Context, key string) (io.ReadCloser, error)
- func (sftp *SFTP) GetFileReaderWithLocalPath(ctx context.Context, key, _ string, _ int64) (io.ReadCloser, error)
- func (sftp *SFTP) Kind() string
- func (sftp *SFTP) PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
- func (sftp *SFTP) PutFileAbsolute(_ context.Context, key string, r io.ReadCloser, _ int64) error
- func (sftp *SFTP) StatFile(ctx context.Context, key string) (RemoteFile, error)
- func (sftp *SFTP) StatFileAbsolute(_ context.Context, key string) (RemoteFile, error)
- func (sftp *SFTP) Walk(ctx context.Context, remotePath string, recursive bool, ...) error
- func (sftp *SFTP) WalkAbsolute(ctx context.Context, prefix string, recursive bool, ...) error
Constants ¶
const ( // ManifestFileName is the name of the file manifest stored alongside metadata.json. // It is a gzip-compressed bbolt database whose keys are the relative paths of every // file in the backup, allowing restore operations to skip the expensive S3 // ListObjects Walk. bbolt keeps keys sorted, so per-part lookups are prefix seeks // instead of full scans, and the read side is mmap-backed instead of loading the // whole listing into the heap. ManifestFileName = "manifest.bolt.gz" // ManifestVersion is the current manifest format version. ManifestVersion = 1 )
Variables ¶
var ( // ErrNotFound is returned when file/object cannot be found ErrNotFound = errors.New("key not found") )
Functions ¶
func AdjustValueByRange ¶ added in v2.6.18
func NewErrNotFound ¶ added in v2.7.0
NewErrNotFound wraps ErrNotFound with key; errors.Is(err, ErrNotFound) still matches.
Types ¶
type AzureBlob ¶
type AzureBlob struct {
Container *container.Client
CPK *blob.CPKInfo
Config *config.AzureBlobConfig
}
AzureBlob - presents methods for manipulate data on Azure
func (*AzureBlob) CopyObject ¶
func (a *AzureBlob) CopyObject(ctx context.Context, _ int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject server-side copy from srcBucket/srcKey to a.Config.Container/dstKey, both keys are absolute inside the container
func (*AzureBlob) DeleteFile ¶
func (*AzureBlob) DeleteFileFromObjectDiskBackup ¶
func (*AzureBlob) DeleteKeysBatch ¶ added in v2.6.42
DeleteKeysBatch implements BatchDeleter interface for Azure Blob Uses concurrent deletion since Azure SDK doesn't expose batch delete API
func (*AzureBlob) DeleteKeysFromObjectDiskBackupBatch ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackupBatch implements BatchDeleter interface for Azure Blob
func (*AzureBlob) GetFileReader ¶
func (*AzureBlob) GetFileReaderAbsolute ¶ added in v2.5.0
func (*AzureBlob) GetFileReaderWithLocalPath ¶
func (*AzureBlob) PutFileAbsolute ¶ added in v2.5.0
func (*AzureBlob) StatFileAbsolute ¶ added in v2.6.26
type Backup ¶
type Backup struct {
metadata.BackupMetadata
Broken string
UploadDate time.Time `json:"upload_date"`
}
func GetBackupsToDeleteRemote ¶ added in v2.4.28
func GetOldestLiveBackupToRebase ¶ added in v2.8.0
GetOldestLiveBackupToRebase - return the oldest kept backup whose `required_backup` points to a backup outside the `keep` window, rebase of such backup makes it full, so the whole out-of-window chain loses `required_backup` references from kept backups and becomes deletable by GetBackupsToDeleteRemote
type BackupDestination ¶
type BackupDestination struct {
RemoteStorage
// contains filtered or unexported fields
}
func NewBackupDestination ¶
func NewBackupDestination(ctx context.Context, cfg *config.Config, ch *clickhouse.ClickHouse, backupName string) (*BackupDestination, error)
func (*BackupDestination) BackupList ¶
func (*BackupDestination) DownloadCompressedStream ¶
func (*BackupDestination) DownloadLimiter ¶ added in v2.7.1
func (bd *BackupDestination) DownloadLimiter(maxBytesPerSecond uint64) *bwlimit.Limiter
DownloadLimiter mirrors UploadLimiter for the download direction.
func (*BackupDestination) DownloadManifest ¶ added in v2.8.0
func (bd *BackupDestination) DownloadManifest(ctx context.Context, backupName string) *ManifestReader
DownloadManifest attempts to download, decompress and open the manifest for a given backup. Returns nil if the manifest does not exist or is unreadable (graceful fallback to Walk).
func (*BackupDestination) DownloadPath ¶
func (*BackupDestination) DownloadPathWithManifest ¶ added in v2.8.0
func (bd *BackupDestination) DownloadPathWithManifest(ctx context.Context, remotePath string, localPath string, fileNames []string, RetriesOnFailure int, RetriesDuration time.Duration, RetriesJitter int8, RetrierClassifier retrier.Classifier, maxSpeed uint64) (int64, error)
DownloadPathWithManifest downloads the given files from remotePath using a pre-loaded manifest listing instead of calling Walk. fileNames are relative to remotePath, as returned by ManifestReader.FilesUnderPrefix.
func (*BackupDestination) RemoveBackupRemote ¶ added in v2.4.28
func (bd *BackupDestination) RemoveBackupRemote(ctx context.Context, backup Backup, cfg *config.Config, retrierClassifier retrier.Classifier) error
func (*BackupDestination) UpdateMetadataCacheEntry ¶ added in v2.8.0
func (bd *BackupDestination) UpdateMetadataCacheEntry(ctx context.Context, backup Backup) error
UpdateMetadataCacheEntry overwrites one entry in the on-disk metadata cache, need after metadata.json rewrite on remote storage (e.g. `rebase` command), otherwise BackupList fast path returns the stale cached entry
func (*BackupDestination) UploadCompressedStream ¶
func (*BackupDestination) UploadLimiter ¶ added in v2.7.1
func (bd *BackupDestination) UploadLimiter(maxBytesPerSecond uint64) *bwlimit.Limiter
UploadLimiter returns the shared upload rate limiter for this destination, creating (or recreating, on a rate change) it lazily. It returns nil when throttling is disabled (maxBytesPerSecond == 0). The limiter is shared across all concurrent upload workers so the configured rate is an aggregate cap.
func (*BackupDestination) UploadManifest ¶ added in v2.8.0
func (bd *BackupDestination) UploadManifest(ctx context.Context, backupName string, w *ManifestWriter) error
UploadManifest finalizes the manifest and uploads it to remote storage alongside metadata.json.
func (*BackupDestination) UploadPath ¶
func (*BackupDestination) WalkCompressedStream ¶ added in v2.8.0
func (bd *BackupDestination) WalkCompressedStream(ctx context.Context, remotePath string, handler func(ctx context.Context, fileName string, content io.Reader) error) error
WalkCompressedStream streams a remote archive and calls handler for every file inside, without writing anything to the local filesystem, need for `rebase` object disk blobs copy
type BatchDeleteError ¶ added in v2.6.42
BatchDeleteError represents errors that occurred during batch deletion
func (*BatchDeleteError) Error ¶ added in v2.6.42
func (e *BatchDeleteError) Error() string
type BatchDeleter ¶ added in v2.6.42
type BatchDeleter interface {
// DeleteKeysBatch deletes a batch of keys
// Batching (collecting keys up to DeleteBatchSize) should be done by the caller
// Returns nil if all keys were deleted successfully
// Returns BatchDeleteError if some keys failed to delete
DeleteKeysBatch(ctx context.Context, keys []string) error
// DeleteKeysFromObjectDiskBackupBatch deletes a batch of keys from object disk backup path
DeleteKeysFromObjectDiskBackupBatch(ctx context.Context, keys []string) error
}
BatchDeleter is an optional interface that storage backends can implement to support batch deletion of keys for improved performance
type COS ¶
type COS struct {
Config *config.COSConfig
BufferSize int
// contains filtered or unexported fields
}
func (*COS) CopyObject ¶
func (c *COS) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject server-side copy inside COS, empty srcBucket means the same bucket, non-empty srcBucket - another COS bucket in the same region (e.g. ClickHouse object disk over COS), MultiCopy internally switches to multipart copy for objects above the single-copy limit, when the source is not really on COS (e.g. object disk over MinIO) MultiCopy fails and callers fall back to streaming
func (*COS) DeleteFileFromObjectDiskBackup ¶
func (*COS) DeleteKeysBatch ¶ added in v2.6.42
DeleteKeysBatch implements BatchDeleter interface for COS Uses concurrent deletion with configurable concurrency
func (*COS) DeleteKeysFromObjectDiskBackupBatch ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackupBatch implements BatchDeleter interface for COS
func (*COS) GetFileReader ¶
func (*COS) GetFileReaderAbsolute ¶ added in v2.5.0
func (*COS) GetFileReaderWithLocalPath ¶
func (*COS) PutFileAbsolute ¶ added in v2.5.0
func (*COS) StatFileAbsolute ¶ added in v2.6.26
type FTP ¶
func (*FTP) CopyObject ¶
func (f *FTP) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject copy file inside the same FTP server (like `cp` command), srcBucket is ignored, tries ProFTPD mod_copy `SITE CPFR`/`SITE CPTO` server-side copy first, then FXP (PASV+PORT, server transfers to itself without client bandwidth), falls back to streaming RETR from one pooled connection into STOR on another
func (*FTP) DeleteFileFromObjectDiskBackup ¶
func (*FTP) DeleteKeys ¶ added in v2.6.42
DeleteKeys implements BatchDeleter interface for FTP Uses concurrent deletion with connection pool
func (*FTP) DeleteKeysFromObjectDiskBackup ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackup implements BatchDeleter interface for FTP
func (*FTP) GetFileReader ¶
func (*FTP) GetFileReaderAbsolute ¶ added in v2.5.0
func (*FTP) GetFileReaderWithLocalPath ¶
func (*FTP) PutFileAbsolute ¶ added in v2.5.0
func (*FTP) StatFileAbsolute ¶ added in v2.6.26
type FTPFileReader ¶
func (*FTPFileReader) Close ¶
func (fr *FTPFileReader) Close() error
type GCS ¶
GCS - presents methods for manipulate data on GCS
func (*GCS) CopyObject ¶
func (gcs *GCS) CopyObject(ctx context.Context, _ int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject server-side copy from srcBucket/srcKey to gcs.Config.Bucket/dstKey, both keys are absolute inside the bucket
func (*GCS) DeleteFileFromObjectDiskBackup ¶
func (*GCS) DeleteKeysBatch ¶ added in v2.6.42
DeleteKeysBatch implements BatchDeleter interface for GCS Uses concurrent deletion with connection pool since GCS doesn't have batch delete API
func (*GCS) DeleteKeysFromObjectDiskBackupBatch ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackupBatch implements BatchDeleter interface for GCS
func (*GCS) GetFileReader ¶
func (*GCS) GetFileReaderAbsolute ¶ added in v2.5.0
func (*GCS) GetFileReaderWithLocalPath ¶
func (*GCS) PutFileAbsolute ¶ added in v2.5.0
func (*GCS) StatFileAbsolute ¶ added in v2.6.26
type KeyError ¶ added in v2.6.42
KeyError represents an error for a specific key during batch deletion
type ManifestReader ¶ added in v2.8.0
type ManifestReader struct {
// contains filtered or unexported fields
}
ManifestReader provides prefix lookups over a downloaded manifest. It is backed by a read-only (mmap) bolt database in a local temporary file, so lookups don't require loading the whole listing into memory.
func (*ManifestReader) Close ¶ added in v2.8.0
func (r *ManifestReader) Close()
Close closes the underlying bolt database and removes the temporary file. Safe to call on a nil reader.
func (*ManifestReader) FilesUnderPrefix ¶ added in v2.8.0
func (r *ManifestReader) FilesUnderPrefix(prefix string) ([]string, error)
FilesUnderPrefix returns the names (relative to the prefix) of all manifest entries whose path starts with the given prefix, using a sorted-key seek instead of a full scan. The prefix should NOT include the backup name (e.g., "shadow/default/my_table/default/part1").
type ManifestWriter ¶ added in v2.8.0
type ManifestWriter struct {
TotalFiles int
// contains filtered or unexported fields
}
ManifestWriter incrementally records uploaded file paths into a local bbolt database, batching writes to bound memory usage. It is safe for concurrent use. After a write error it becomes a no-op and the error is returned by Finalize, so a broken manifest never fails the backup itself.
func NewManifestWriter ¶ added in v2.8.0
func NewManifestWriter(backupName string) (*ManifestWriter, error)
NewManifestWriter creates a manifest writer backed by a temporary local bolt file.
func (*ManifestWriter) AddFile ¶ added in v2.8.0
func (w *ManifestWriter) AddFile(relativePath string)
AddFile records a file path in the manifest. On flush failure the writer is marked broken and subsequent calls become no-ops; the error surfaces in Finalize.
func (*ManifestWriter) Close ¶ added in v2.8.0
func (w *ManifestWriter) Close()
Close releases the writer's resources and removes its temporary files. Safe to call multiple times, after Finalize, and on a nil writer.
func (*ManifestWriter) Finalize ¶ added in v2.8.0
func (w *ManifestWriter) Finalize() (string, error)
Finalize flushes pending entries, writes the manifest metadata, closes the bolt database and gzip-compresses it. It returns the path of the compressed file.
type RecalculateV4Signature ¶
type RecalculateV4Signature struct {
// contains filtered or unexported fields
}
RecalculateV4Signature allow GCS over S3, remove Accept-Encoding header from sign https://stackoverflow.com/a/74382598/1204665, https://github.com/aws/aws-sdk-go-v2/issues/1816
type RemoteFile ¶
RemoteFile - interface describe file on remote storage
type RemoteStorage ¶
type RemoteStorage interface {
Kind() string
Connect(ctx context.Context) error
Close(ctx context.Context) error
StatFile(ctx context.Context, key string) (RemoteFile, error)
StatFileAbsolute(ctx context.Context, key string) (RemoteFile, error)
DeleteFile(ctx context.Context, key string) error
DeleteFileFromObjectDiskBackup(ctx context.Context, key string) error
Walk(ctx context.Context, prefix string, recursive bool, fn func(context.Context, RemoteFile) error) error
WalkAbsolute(ctx context.Context, absolutePrefix string, recursive bool, fn func(context.Context, RemoteFile) error) error
GetFileReader(ctx context.Context, key string) (io.ReadCloser, error)
GetFileReaderAbsolute(ctx context.Context, key string) (io.ReadCloser, error)
GetFileReaderWithLocalPath(ctx context.Context, key, localPath string, remoteSize int64) (io.ReadCloser, error)
PutFile(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
PutFileAbsolute(ctx context.Context, key string, r io.ReadCloser, localSize int64) error
CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
}
RemoteStorage -
type S3 ¶
type S3 struct {
Config *config.S3Config
Concurrency int
// contains filtered or unexported fields
}
S3 - presents methods for manipulate data on s3
func (*S3) CopyObject ¶
func (s *S3) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject server-side copy from srcBucket/srcKey to s.Config.Bucket/dstKey, both keys are absolute inside the bucket
func (*S3) DeleteFileFromObjectDiskBackup ¶
func (*S3) DeleteKeysBatch ¶ added in v2.6.42
DeleteKeysBatch implements BatchDeleter interface for S3 Uses DeleteObjects API to delete up to 1000 keys per request
func (*S3) DeleteKeysFromObjectDiskBackupBatch ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackupBatch implements BatchDeleter interface for S3
func (*S3) GetFileReader ¶
func (*S3) GetFileReaderAbsolute ¶ added in v2.5.0
func (*S3) GetFileReaderWithLocalPath ¶
func (*S3) PutFileAbsolute ¶ added in v2.5.0
func (*S3) ResolveEndpoint ¶ added in v2.6.0
func (s *S3) ResolveEndpoint(ctx context.Context, params s3.EndpointParameters) (endpoint smithyendpoints.Endpoint, err error)
func (*S3) StatFileAbsolute ¶ added in v2.6.26
type S3LogToZeroLogAdapter ¶ added in v2.5.22
type S3LogToZeroLogAdapter struct {
// contains filtered or unexported fields
}
func (S3LogToZeroLogAdapter) Logf ¶ added in v2.5.22
func (adapter S3LogToZeroLogAdapter) Logf(severity awsV2Logging.Classification, msg string, args ...interface{})
type SFTP ¶
type SFTP struct {
Config *config.SFTPConfig
// contains filtered or unexported fields
}
SFTP Implement RemoteStorage
func (*SFTP) CopyObject ¶
func (sftp *SFTP) CopyObject(ctx context.Context, srcSize int64, srcBucket, srcKey, dstKey string) (int64, error)
CopyObject copy file inside the same SFTP server (like `echo "cp src dst" | sftp -b -`), srcBucket is ignored, uses the `copy-data` SFTP protocol extension (OpenSSH 9.0+) for server-side copy, falls back to `hardlink@openssh.com` (OpenSSH 5.7+, backup files are immutable so a hardlink is equivalent to a copy), streams through the client as the last resort
func (*SFTP) DeleteDirectory ¶
func (*SFTP) DeleteFileFromObjectDiskBackup ¶
func (*SFTP) DeleteKeys ¶ added in v2.6.42
DeleteKeys implements BatchDeleter interface for SFTP SFTP uses sequential deletion due to protocol limitations (single connection)
func (*SFTP) DeleteKeysFromObjectDiskBackup ¶ added in v2.6.42
DeleteKeysFromObjectDiskBackup implements BatchDeleter interface for SFTP