storage

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: MIT Imports: 40 Imported by: 0

Documentation

Overview

Package chbackup describes the objects and functions for clickhouse-backup app

Index

Constants

View Source
const (
	// MetaFileName - meta file name
	MetaFileName = "meta.json"
	// BufferSize - size of ring buffer between stream handlers
	BufferSize = 4 * 1024 * 1024
)

Variables

View Source
var (
	// ErrNotFound is returned when file/object cannot be found
	ErrNotFound = errors.New("file not found")
)

Functions

This section is empty.

Types

type AzureBlob

type AzureBlob struct {
	Container azblob.ContainerURL
	CPK       azblob.ClientProvidedKeyOptions
	Config    *config.AzureBlobConfig
}

AzureBlob - presents methods for manipulate data on Azure

func (*AzureBlob) Connect

func (s *AzureBlob) Connect() error

Connect - connect to Azure

func (*AzureBlob) DeleteFile

func (s *AzureBlob) DeleteFile(key string) error

func (*AzureBlob) GetFile

func (s *AzureBlob) GetFile(key string) (RemoteFile, error)

func (*AzureBlob) GetFileReader

func (s *AzureBlob) GetFileReader(key string) (io.ReadCloser, error)

func (*AzureBlob) Kind

func (s *AzureBlob) Kind() string

func (*AzureBlob) PutFile

func (s *AzureBlob) PutFile(key string, r io.ReadCloser) error

func (*AzureBlob) Walk

func (s *AzureBlob) Walk(_ string, process func(r RemoteFile)) error

type Backup

type Backup struct {
	Name string
	Size int64
	Date time.Time
}

func GetBackupsToDelete

func GetBackupsToDelete(backups []Backup, keep int) []Backup

type BackupDestination

type BackupDestination struct {
	RemoteStorage
	// contains filtered or unexported fields
}

func NewBackupDestination

func NewBackupDestination(cfg *config.Config) (*BackupDestination, error)

func (*BackupDestination) BackupList

func (bd *BackupDestination) BackupList() ([]Backup, error)

func (*BackupDestination) BackupsToKeep

func (bd *BackupDestination) BackupsToKeep() int

func (*BackupDestination) CompressedStreamDownload

func (bd *BackupDestination) CompressedStreamDownload(remotePath string, localPath string) error

func (*BackupDestination) CompressedStreamUpload

func (bd *BackupDestination) CompressedStreamUpload(localPath, remotePath, diffFromPath string) error

func (*BackupDestination) RemoveBackup

func (bd *BackupDestination) RemoveBackup(backupName string) error

func (*BackupDestination) RemoveOldBackups

func (bd *BackupDestination) RemoveOldBackups(keep int) error

type COS

type COS struct {
	Config *config.COSConfig
	Debug  bool
	// contains filtered or unexported fields
}

func (*COS) Connect

func (c *COS) Connect() error

Connect - connect to cos

func (*COS) DeleteFile

func (c *COS) DeleteFile(key string) error

func (*COS) GetFile

func (c *COS) GetFile(key string) (RemoteFile, error)

func (*COS) GetFileReader

func (c *COS) GetFileReader(key string) (io.ReadCloser, error)

func (*COS) Kind

func (c *COS) Kind() string

func (*COS) PutFile

func (c *COS) PutFile(key string, r io.ReadCloser) error

func (*COS) Walk

func (c *COS) Walk(path string, process func(RemoteFile)) error

type FTP

type FTP struct {
	Config *config.FTPConfig
	Debug  bool
	// contains filtered or unexported fields
}

func (*FTP) Connect

func (f *FTP) Connect() error

func (*FTP) DeleteFile

func (f *FTP) DeleteFile(key string) error

func (*FTP) GetFile

func (f *FTP) GetFile(key string) (RemoteFile, error)

func (*FTP) GetFileReader

func (f *FTP) GetFileReader(key string) (io.ReadCloser, error)

func (*FTP) Kind

func (f *FTP) Kind() string

func (*FTP) PutFile

func (f *FTP) PutFile(key string, r io.ReadCloser) error

func (*FTP) Walk

func (f *FTP) Walk(root string, process func(RemoteFile)) error

type GCS

type GCS struct {
	Config *config.GCSConfig
	// contains filtered or unexported fields
}

GCS - presents methods for manipulate data on GCS

func (*GCS) Connect

func (gcs *GCS) Connect() error

Connect - connect to GCS

func (*GCS) DeleteFile

func (gcs *GCS) DeleteFile(key string) error

func (*GCS) GetFile

func (gcs *GCS) GetFile(key string) (RemoteFile, error)

func (*GCS) GetFileReader

func (gcs *GCS) GetFileReader(key string) (io.ReadCloser, error)

func (*GCS) GetFileWriter

func (gcs *GCS) GetFileWriter(key string) io.WriteCloser

func (*GCS) Kind

func (gcs *GCS) Kind() string

func (*GCS) PutFile

func (gcs *GCS) PutFile(key string, r io.ReadCloser) error

func (*GCS) Walk

func (gcs *GCS) Walk(gcsPath string, process func(r RemoteFile)) error

type MetaFile

type MetaFile struct {
	RequiredBackup string   `json:"required_backup"`
	Hardlinks      []string `json:"hardlinks"`
}

MetaFile - structure describe meta file that will be added to incremental backups archive. Contains info of required files in backup and files

type RemoteFile

type RemoteFile interface {
	Size() int64
	Name() string
	LastModified() time.Time
}

RemoteFile - interface describe file on remote storage

type RemoteStorage

type RemoteStorage interface {
	Kind() string
	GetFile(string) (RemoteFile, error)
	DeleteFile(string) error
	Connect() error
	Walk(string, func(RemoteFile)) error
	GetFileReader(key string) (io.ReadCloser, error)
	PutFile(key string, r io.ReadCloser) error
}

RemoteStorage -

type S3

type S3 struct {
	Config *config.S3Config
	Debug  bool
	// contains filtered or unexported fields
}

S3 - presents methods for manipulate data on s3

func (*S3) Connect

func (s *S3) Connect() error

Connect - connect to s3

func (*S3) DeleteFile

func (s *S3) DeleteFile(key string) error

func (*S3) GetFile

func (s *S3) GetFile(key string) (RemoteFile, error)

func (*S3) GetFileReader

func (s *S3) GetFileReader(key string) (io.ReadCloser, error)

func (*S3) Kind

func (s *S3) Kind() string

func (*S3) PutFile

func (s *S3) PutFile(key string, r io.ReadCloser) error

func (*S3) Walk

func (s *S3) Walk(s3Path string, process func(r RemoteFile)) error

Directories

Path Synopsis
forked from github.com/Azure/azure-storage-blob-go/azblob/blob/feature/clientprovidedkey because UploadStreamToBlockBlob does not expose CPK forked from github.com/Azure/azure-storage-blob-go/azblob/blob/feature/clientprovidedkey because UploadStreamToBlockBlob does not expose CPK
forked from github.com/Azure/azure-storage-blob-go/azblob/blob/feature/clientprovidedkey because UploadStreamToBlockBlob does not expose CPK forked from github.com/Azure/azure-storage-blob-go/azblob/blob/feature/clientprovidedkey because UploadStreamToBlockBlob does not expose CPK

Jump to

Keyboard shortcuts

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