snapstore

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 42 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// EnvAzureEmulatorEnabled is the environment variable which indicates whether the Azurite emulator is enabled
	EnvAzureEmulatorEnabled = "AZURE_EMULATOR_ENABLED"
	// EnvGCSEmulatorEnabled is the environment variable which indicates whether the GCS emulator is enabled
	EnvGCSEmulatorEnabled = "GOOGLE_EMULATOR_ENABLED"
)

Variables

This section is empty.

Functions

func ConstructBlobServiceURL added in v0.29.0

func ConstructBlobServiceURL(storageAccount, domain string) (*url.URL, error)

ConstructBlobServiceURL constructs the Blob Service URL based on the activation status of the Azurite Emulator. It checks the environment variable for emulator configuration and constructs the URL accordingly. The function expects the following environment variable: - AZURE_EMULATOR_ENABLED: Indicates whether the Azurite Emulator is enabled (expects "true" or "false").

func GetABSCredentialsLastModifiedTime added in v0.29.0

func GetABSCredentialsLastModifiedTime() (time.Time, error)

GetABSCredentialsLastModifiedTime returns the latest modification timestamp of the ABS credential file(s)

func GetEnvVarOrError

func GetEnvVarOrError(varName string) (string, error)

GetEnvVarOrError returns the value of specified environment variable or terminates if it's not defined.

func GetEnvVarToBool added in v0.29.0

func GetEnvVarToBool(varName string) (bool, error)

GetEnvVarToBool return corresponding boolen if an environment is set to string true|false

func GetGCSCredentialsLastModifiedTime added in v0.29.0

func GetGCSCredentialsLastModifiedTime() (time.Time, error)

GetGCSCredentialsLastModifiedTime returns the latest modification timestamp of the GCS credential file

func GetOCSCredentialsLastModifiedTime added in v0.29.0

func GetOCSCredentialsLastModifiedTime() (time.Time, error)

GetOCSCredentialsLastModifiedTime returns the latest modification timestamp of the OCS credential file(s)

func GetOSSCredentialsLastModifiedTime added in v0.29.0

func GetOSSCredentialsLastModifiedTime() (time.Time, error)

GetOSSCredentialsLastModifiedTime returns the latest modification timestamp of the OSS credential file(s)

func GetS3CredentialsLastModifiedTime added in v0.29.0

func GetS3CredentialsLastModifiedTime() (time.Time, error)

GetS3CredentialsLastModifiedTime returns the latest modification timestamp of the AWS credential file(s)

func GetSnapstore

func GetSnapstore(config *brtypes.SnapstoreConfig) (brtypes.SnapStore, error)

GetSnapstore returns the snapstore object for give storageProvider with specified container

func GetSnapstoreSecretModifiedTime added in v0.29.0

func GetSnapstoreSecretModifiedTime(snapstoreProvider string) (time.Time, error)

GetSnapstoreSecretModifiedTime returns the latest modification timestamp of the access credential files. Returns an error if fetching the timestamp of the access credential files fails.

func GetSwiftCredentialsLastModifiedTime added in v0.29.0

func GetSwiftCredentialsLastModifiedTime() (time.Time, error)

GetSwiftCredentialsLastModifiedTime returns the latest modification timestamp of the Swift credential file(s)

func NewSnapshot

func NewSnapshot(kind string, startRevision, lastRevision int64, compressionSuffix string, isFinal bool) *brtypes.Snapshot

NewSnapshot returns the snapshot object.

func NewSnapstoreConfig added in v0.29.0

func NewSnapstoreConfig() *brtypes.SnapstoreConfig

NewSnapstoreConfig returns the snapstore config.

func ParseSnapshot

func ParseSnapshot(snapPath string) (*brtypes.Snapshot, error)

ParseSnapshot parse <snapPath> to create snapshot structure

Types

type ABSSnapStore

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

ABSSnapStore is an ABS backed snapstore.

func GetABSSnapstoreFromClient

func GetABSSnapstoreFromClient(container, prefix, tempDir string, maxParallelChunkUploads uint, minChunkSize int64, containerURL *azblob.ContainerURL) (*ABSSnapStore, error)

GetABSSnapstoreFromClient returns a new ABS object for a given container using the supplied storageClient

func NewABSSnapStore

func NewABSSnapStore(config *brtypes.SnapstoreConfig) (*ABSSnapStore, error)

NewABSSnapStore creates a new ABSSnapStore using a shared configuration and a specified bucket

func (*ABSSnapStore) Delete

func (a *ABSSnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store

func (*ABSSnapStore) Fetch

func (a *ABSSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*ABSSnapStore) List

func (a *ABSSnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*ABSSnapStore) Save

func (a *ABSSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store

type FailedSnapStore added in v0.29.0

type FailedSnapStore struct {
	brtypes.SnapStore
}

FailedSnapStore is snapstore with fake failed object store as backend

func NewFailedSnapStore added in v0.29.0

func NewFailedSnapStore() *FailedSnapStore

NewFailedSnapStore create new FailedSnapStore object.

func (*FailedSnapStore) Delete added in v0.29.0

func (f *FailedSnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store

func (*FailedSnapStore) Fetch added in v0.29.0

func (f *FailedSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*FailedSnapStore) List added in v0.29.0

func (f *FailedSnapStore) List() (brtypes.SnapList, error)

List will list the snapshots from store

func (*FailedSnapStore) Save added in v0.29.0

func (f *FailedSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store

type GCSSnapStore

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

GCSSnapStore is snapstore with GCS object store as backend.

func NewGCSSnapStore

func NewGCSSnapStore(config *brtypes.SnapstoreConfig) (*GCSSnapStore, error)

NewGCSSnapStore create new GCSSnapStore from shared configuration with specified bucket.

func NewGCSSnapStoreFromClient

func NewGCSSnapStoreFromClient(bucket, prefix, tempDir string, maxParallelChunkUploads uint, minChunkSize int64, chunkDirSuffix string, cli stiface.Client) *GCSSnapStore

NewGCSSnapStoreFromClient create new GCSSnapStore from shared configuration with specified bucket.

func (*GCSSnapStore) Delete

func (s *GCSSnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store.

func (*GCSSnapStore) Fetch

func (s *GCSSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store.

func (*GCSSnapStore) List

func (s *GCSSnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*GCSSnapStore) Save

func (s *GCSSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store.

type LocalSnapStore

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

LocalSnapStore is snapstore with local disk as backend

func NewLocalSnapStore

func NewLocalSnapStore(prefix string) (*LocalSnapStore, error)

NewLocalSnapStore return the new local disk based snapstore

func (*LocalSnapStore) Delete

func (s *LocalSnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store

func (*LocalSnapStore) Fetch

func (s *LocalSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*LocalSnapStore) List

func (s *LocalSnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*LocalSnapStore) Save

func (s *LocalSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store

func (*LocalSnapStore) Size

func (s *LocalSnapStore) Size(snap brtypes.Snapshot) (int64, error)

Size should return size of the snapshot file from store

type OSSBucket

type OSSBucket interface {
	GetObject(objectKey string, options ...oss.Option) (io.ReadCloser, error)
	InitiateMultipartUpload(objectKey string, options ...oss.Option) (oss.InitiateMultipartUploadResult, error)
	CompleteMultipartUpload(imur oss.InitiateMultipartUploadResult, parts []oss.UploadPart, options ...oss.Option) (oss.CompleteMultipartUploadResult, error)
	ListObjects(options ...oss.Option) (oss.ListObjectsResult, error)
	DeleteObject(objectKey string, options ...oss.Option) error
	UploadPart(imur oss.InitiateMultipartUploadResult, reader io.Reader, partSize int64, partNumber int, options ...oss.Option) (oss.UploadPart, error)
	AbortMultipartUpload(imur oss.InitiateMultipartUploadResult, options ...oss.Option) error
}

OSSBucket is an interface for oss.Bucket used in snapstore

type OSSSnapStore

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

OSSSnapStore is snapstore with Alicloud OSS object store as backend

func NewOSSFromBucket

func NewOSSFromBucket(prefix, tempDir string, maxParallelChunkUploads uint, minChunkSize int64, bucket OSSBucket) *OSSSnapStore

NewOSSFromBucket will create the new OSS snapstore object from OSS bucket

func NewOSSSnapStore

func NewOSSSnapStore(config *brtypes.SnapstoreConfig) (*OSSSnapStore, error)

NewOSSSnapStore create new OSSSnapStore from shared configuration with specified bucket

func (*OSSSnapStore) Delete

func (s *OSSSnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store

func (*OSSSnapStore) Fetch

func (s *OSSSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*OSSSnapStore) List

func (s *OSSSnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*OSSSnapStore) Save

func (s *OSSSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store

type S3SnapStore

type S3SnapStore struct {
	SSECredentials
	// contains filtered or unexported fields
}

S3SnapStore is snapstore with AWS S3 object store as backend

func NewECSSnapStore added in v0.29.0

func NewECSSnapStore(config *brtypes.SnapstoreConfig) (*S3SnapStore, error)

NewECSSnapStore creates a new S3SnapStore from shared configuration with the specified bucket.

func NewOCSSnapStore added in v0.29.0

func NewOCSSnapStore(config *brtypes.SnapstoreConfig) (*S3SnapStore, error)

NewOCSSnapStore creates a new S3SnapStore from shared configuration with the specified bucket.

func NewS3FromClient

func NewS3FromClient(bucket, prefix, tempDir string, maxParallelChunkUploads uint, minChunkSize int64, cli s3iface.S3API, sseCreds SSECredentials) *S3SnapStore

NewS3FromClient will create the new S3 snapstore object from S3 client

func NewS3SnapStore

func NewS3SnapStore(config *brtypes.SnapstoreConfig) (*S3SnapStore, error)

NewS3SnapStore create new S3SnapStore from shared configuration with specified bucket

func (*S3SnapStore) Delete

func (s *S3SnapStore) Delete(snap brtypes.Snapshot) error

Delete should delete the snapshot file from store

func (*S3SnapStore) Fetch

func (s *S3SnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*S3SnapStore) List

func (s *S3SnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*S3SnapStore) Save

func (s *S3SnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store

type SSECredentials added in v0.29.0

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

SSECredentials to hold fields for server-side encryption in I/O operations

type SwiftSnapStore

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

SwiftSnapStore is snapstore with Openstack Swift as backend

func NewSwiftSnapStore

func NewSwiftSnapStore(config *brtypes.SnapstoreConfig) (*SwiftSnapStore, error)

NewSwiftSnapStore create new SwiftSnapStore from shared configuration with specified bucket

func NewSwiftSnapstoreFromClient

func NewSwiftSnapstoreFromClient(bucket, prefix, tempDir string, maxParallelChunkUploads uint, minChunkSize int64, cli *gophercloud.ServiceClient) *SwiftSnapStore

NewSwiftSnapstoreFromClient will create the new Swift snapstore object from Swift client

func (*SwiftSnapStore) Delete

func (s *SwiftSnapStore) Delete(snap brtypes.Snapshot) error

Delete deletes the objects related to the DLO (dynamic large object) from the store. This includes the manifest object as well as the segment objects, as described in https://docs.openstack.org/swift/latest/overview_large_objects.html

func (*SwiftSnapStore) Fetch

func (s *SwiftSnapStore) Fetch(snap brtypes.Snapshot) (io.ReadCloser, error)

Fetch should open reader for the snapshot file from store

func (*SwiftSnapStore) List

func (s *SwiftSnapStore) List() (brtypes.SnapList, error)

List will return sorted list with all snapshot files on store.

func (*SwiftSnapStore) Save

func (s *SwiftSnapStore) Save(snap brtypes.Snapshot, rc io.ReadCloser) error

Save will write the snapshot to store, as a DLO (dynamic large object), as described in https://docs.openstack.org/swift/latest/overview_large_objects.html

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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