storage

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BufferSize - size of ring buffer between stream handlers
	BufferSize = 1 * 1024 * 1024
)

Variables

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

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) GetFileReader

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

func (*AzureBlob) GetFileReaderWithLocalPath added in v1.5.2

func (s *AzureBlob) GetFileReaderWithLocalPath(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) StatFile added in v1.5.2

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

func (*AzureBlob) Walk

func (s *AzureBlob) Walk(azPath string, recursive bool, process func(r RemoteFile) error) error

type Backup

type Backup struct {
	metadata.BackupMetadata
	Legacy        bool
	FileExtension string
	Broken        string
	UploadDate    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, calcMaxSize bool) (*BackupDestination, error)

func (*BackupDestination) BackupList

func (bd *BackupDestination) BackupList(parseMetadata bool, parseMetadataOnly string) ([]Backup, error)

func (*BackupDestination) DownloadCompressedStream added in v1.3.2

func (bd *BackupDestination) DownloadCompressedStream(ctx context.Context, remotePath string, localPath string) error

func (*BackupDestination) DownloadPath added in v1.5.2

func (bd *BackupDestination) DownloadPath(size int64, remotePath string, localPath string) error

func (*BackupDestination) RemoveBackup

func (bd *BackupDestination) RemoveBackup(backup Backup) error

func (*BackupDestination) RemoveOldBackups

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

func (*BackupDestination) UploadCompressedStream added in v1.3.2

func (bd *BackupDestination) UploadCompressedStream(baseLocalPath string, files []string, remotePath string) error

func (*BackupDestination) UploadPath added in v1.5.2

func (bd *BackupDestination) UploadPath(size int64, baseLocalPath string, files []string, remotePath string) error

type COS

type COS struct {
	Config *config.COSConfig
	// 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) GetFileReader

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

func (*COS) GetFileReaderWithLocalPath added in v1.5.2

func (c *COS) GetFileReaderWithLocalPath(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) StatFile added in v1.5.2

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

func (*COS) Walk

func (c *COS) Walk(cosPath string, recursive bool, process func(RemoteFile) error) error

type FTP

type FTP struct {
	Config *config.FTPConfig
	// 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) GetFileReader

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

func (*FTP) GetFileReaderWithLocalPath added in v1.5.2

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

func (*FTP) Kind

func (f *FTP) Kind() string

func (*FTP) MkdirAll added in v1.5.2

func (f *FTP) MkdirAll(key string, client *ftp.ServerConn) error

func (*FTP) PutFile

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

func (*FTP) StatFile added in v1.5.2

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

func (*FTP) Walk

func (f *FTP) Walk(ftpPath string, recursive bool, process func(RemoteFile) error) error

type FTPFileReader added in v1.5.2

type FTPFileReader struct {
	*ftp.Response
	// contains filtered or unexported fields
}

func (*FTPFileReader) Close added in v1.5.2

func (fr *FTPFileReader) Close() 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) GetFileReader

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

func (*GCS) GetFileReaderWithLocalPath added in v1.5.2

func (gcs *GCS) GetFileReaderWithLocalPath(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) StatFile added in v1.5.2

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

func (*GCS) Walk

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

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
	StatFile(key string) (RemoteFile, error)
	DeleteFile(key string) error
	Connect() error
	Walk(prefix string, recursive bool, fn func(RemoteFile) error) error
	GetFileReader(key string) (io.ReadCloser, error)
	GetFileReaderWithLocalPath(key, localPath string) (io.ReadCloser, error)
	PutFile(key string, r io.ReadCloser) error
}

RemoteStorage -

type S3

type S3 struct {
	Config      *config.S3Config
	PartSize    int64
	Concurrency int
	BufferSize  int
	// 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) GetFileReader

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

func (*S3) GetFileReaderWithLocalPath added in v1.5.2

func (s *S3) GetFileReaderWithLocalPath(key, localPath 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) StatFile added in v1.5.2

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

func (*S3) Walk

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

type S3LogToApexLogAdapter added in v1.5.2

type S3LogToApexLogAdapter struct {
	// contains filtered or unexported fields
}

func (*S3LogToApexLogAdapter) Log added in v1.5.2

func (S3LogToApexLogAdapter *S3LogToApexLogAdapter) Log(args ...interface{})

type SFTP added in v1.5.2

type SFTP struct {
	Config *config.SFTPConfig
	// contains filtered or unexported fields
}

SFTP Implement RemoteStorage

func (*SFTP) Connect added in v1.5.2

func (sftp *SFTP) Connect() error

func (*SFTP) Debug added in v1.5.2

func (sftp *SFTP) Debug(msg string, v ...interface{})

func (*SFTP) DeleteDirectory added in v1.5.2

func (sftp *SFTP) DeleteDirectory(dirPath string) error

func (*SFTP) DeleteFile added in v1.5.2

func (sftp *SFTP) DeleteFile(key string) error

func (*SFTP) GetFileReader added in v1.5.2

func (sftp *SFTP) GetFileReader(key string) (io.ReadCloser, error)

func (*SFTP) GetFileReaderWithLocalPath added in v1.5.2

func (sftp *SFTP) GetFileReaderWithLocalPath(key, _ string) (io.ReadCloser, error)

func (*SFTP) Kind added in v1.5.2

func (sftp *SFTP) Kind() string

func (*SFTP) PutFile added in v1.5.2

func (sftp *SFTP) PutFile(key string, localFile io.ReadCloser) error

func (*SFTP) StatFile added in v1.5.2

func (sftp *SFTP) StatFile(key string) (RemoteFile, error)

func (*SFTP) Walk added in v1.5.2

func (sftp *SFTP) Walk(remotePath string, recursive bool, process func(RemoteFile) error) 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

Jump to

Keyboard shortcuts

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