storage

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrObjectNotFound = errors.New("object not found")

Functions

This section is empty.

Types

type Azure

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

Azure is a type for working with Azure Blob storages

func (*Azure) DeleteObject

func (a *Azure) DeleteObject(ctx context.Context, objectName string) error

func (*Azure) GetObject

func (a *Azure) GetObject(ctx context.Context, name string) (io.ReadCloser, error)

func (*Azure) GetPrefix

func (a *Azure) GetPrefix() string

func (*Azure) ListObjects

func (a *Azure) ListObjects(ctx context.Context, prefix string) ([]string, error)

func (*Azure) PutObject

func (a *Azure) PutObject(ctx context.Context, name string, data io.Reader, _ int64) error

func (*Azure) SetPrefix

func (a *Azure) SetPrefix(prefix string)

type AzureOptions

type AzureOptions struct {
	StorageAccount string
	AccessKey      string
	Endpoint       string
	Container      string
	Prefix         string
}

func (*AzureOptions) Type

type GCSOptions

type GCSOptions struct {
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	BucketName      string
	Prefix          string
	VerifyTLS       bool
}

func (*GCSOptions) Type

type NewClientFunc

type NewClientFunc func(context.Context, Options) (Storage, error)

type Options

type Options interface {
	Type() apiv1alpha1.BackupStorageType
}

func GetOptionsFromBackupConfig

func GetOptionsFromBackupConfig(cfg *xtrabackup.BackupConfig) (Options, error)

type S3

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

S3 is a type for working with S3 storages

func (*S3) DeleteObject

func (s *S3) DeleteObject(ctx context.Context, objectName string) error

func (*S3) GetObject

func (s *S3) GetObject(ctx context.Context, objectName string) (io.ReadCloser, error)

GetObject return content by given object name

func (*S3) GetPrefix

func (s *S3) GetPrefix() string

func (*S3) ListObjects

func (s *S3) ListObjects(ctx context.Context, prefix string) ([]string, error)

func (*S3) PutObject

func (s *S3) PutObject(ctx context.Context, name string, data io.Reader, size int64) error

PutObject puts new object to storage with given name and content

func (*S3) SetPrefix

func (s *S3) SetPrefix(prefix string)

type S3Options

type S3Options struct {
	Endpoint        string
	AccessKeyID     string
	SecretAccessKey string
	BucketName      string
	Prefix          string
	Region          string
	VerifyTLS       bool
}

func (*S3Options) Type

type Storage

type Storage interface {
	GetObject(ctx context.Context, objectName string) (io.ReadCloser, error)
	PutObject(ctx context.Context, name string, data io.Reader, size int64) error
	ListObjects(ctx context.Context, prefix string) ([]string, error)
	DeleteObject(ctx context.Context, objectName string) error
	SetPrefix(prefix string)
	GetPrefix() string
}

func NewAzure

func NewAzure(storageAccount, accessKey, endpoint, container, prefix string) (Storage, error)

func NewClient

func NewClient(ctx context.Context, opts Options) (Storage, error)

func NewGCS

func NewGCS(ctx context.Context, endpoint, accessKeyID, secretAccessKey, bucketName, prefix string, verifyTLS bool) (Storage, error)

NewGCS return new Manager, useSSL using ssl for connection with storage

func NewS3

func NewS3(ctx context.Context, endpoint, accessKeyID, secretAccessKey, bucketName, prefix, region string, verifyTLS bool) (Storage, error)

NewS3 return new Manager, useSSL using ssl for connection with storage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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