storage

package
v0.0.0-...-0f0168f Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const CredentialsFile = "/tmp/sa"

Variables

This section is empty.

Functions

This section is empty.

Types

type GcsStorageProvider

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

GCS storage provider

func NewGcsStorageProvider

func NewGcsStorageProvider(k8snamespace string, k8sClient client.Client, gcsSpec *v1alpha1.GcsBackupStorage, factory StorageClientFactory) (*GcsStorageProvider, error)

NewProvider creates a new GCS (compatible) storage provider.

func (*GcsStorageProvider) CopyFromGCS

func (p *GcsStorageProvider) CopyFromGCS(remoteFolder, destinationBase string, k8s *remote.K8sClient) error

func (*GcsStorageProvider) CopyToGCS

func (p *GcsStorageProvider) CopyToGCS(gcsSpec *v1alpha1.GcsBackupStorage, backupTime, srcFolder string) (string, error)

func (*GcsStorageProvider) ListDirectory

func (p *GcsStorageProvider) ListDirectory(key string) ([]string, error)

Get list of objects in provided the GCS bucket and key

func (*GcsStorageProvider) Retrieve

func (p *GcsStorageProvider) Retrieve(key string) (io.ReadCloser, *int64, error)

Retrieve the given key from GCS storage service.

func (*GcsStorageProvider) Store

func (p *GcsStorageProvider) Store(key string, body io.ReadCloser) error

Store the given data at the given key.

type S3StorageProvider

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

func NewS3StorageProvider

func NewS3StorageProvider(k8snamespace string, k8sClient client.Client, s3spec *v1alpha1.S3BackupStorage) (*S3StorageProvider, error)

NewProvider creates a new S3 (compatible) storage provider.

func (*S3StorageProvider) ListDirectory

func (p *S3StorageProvider) ListDirectory(key string) ([]*string, error)

Get list of objects in provided backup s3 bucket.

func (*S3StorageProvider) Retrieve

func (p *S3StorageProvider) Retrieve(key string) (io.ReadCloser, *int64, error)

Retrieve the given key from S3 storage service.

func (*S3StorageProvider) Store

func (p *S3StorageProvider) Store(key string, body io.ReadCloser) error

Store the given data at the given key.

type StorageClientFactory

type StorageClientFactory interface {
	NewStorageClient() (*storage.Client, error)
}

a factory for GCS or mock

type StorageClientFactoryGCS

type StorageClientFactoryGCS struct {
	CredentialsFile string
}

a factory for GCS

func (*StorageClientFactoryGCS) NewStorageClient

func (sc *StorageClientFactoryGCS) NewStorageClient() (*storage.Client, error)

implement GCS factory

type StorageInterface

type StorageInterface interface {
	// Store creates a new object in the underlying provider's datastore if it does not exist,
	// or replaces the existing object if it does exist.
	Store(key string, body io.ReadCloser) error
	// Retrieve return the object in the underlying provider's datastore if it exists.
	Retrieve(key string) (io.ReadCloser, *int64, error)
}

Jump to

Keyboard shortcuts

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