cloudprovider

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupGetter

type BackupGetter interface {
	// GetAllBackups lists all the api.Backups in object storage for the given bucket.
	GetAllBackups(bucket string) ([]*api.Backup, error)
}

BackupGetter knows how to list backups in object storage.

func NewBackupCache

func NewBackupCache(ctx context.Context, delegate BackupGetter, resyncPeriod time.Duration) BackupGetter

NewBackupCache returns a new backup cache that refreshes from delegate every resyncPeriod.

type BackupService

type BackupService interface {
	BackupGetter
	// UploadBackup uploads the specified Ark backup of a set of Kubernetes API objects, whose manifests are
	// stored in the specified file, into object storage in an Ark bucket, tagged with Ark metadata. Returns
	// an error if a problem is encountered accessing the file or performing the upload via the cloud API.
	UploadBackup(bucket, name string, metadata, backup io.ReadSeeker) error

	// DownloadBackup downloads an Ark backup with the specified object key from object storage via the cloud API.
	// It returns the snapshot metadata and data (separately), or an error if a problem is encountered
	// downloading or reading the file from the cloud API.
	DownloadBackup(bucket, name string) (io.ReadCloser, error)

	// DeleteBackup deletes the backup content in object storage for the given api.Backup.
	DeleteBackup(bucket, backupName string) error
}

BackupService contains methods for working with backups in object storage.

func NewBackupService

func NewBackupService(objectStorage ObjectStorageAdapter) BackupService

NewBackupService creates a backup service using the provided object storage adapter

func NewBackupServiceWithCachedBackupGetter

func NewBackupServiceWithCachedBackupGetter(ctx context.Context, delegate BackupService, resyncPeriod time.Duration) BackupService

NewBackupServiceWithCachedBackupGetter returns a BackupService that uses a cache for GetAllBackups().

type BlockStorageAdapter

type BlockStorageAdapter interface {
	// CreateVolumeFromSnapshot creates a new block volume, initialized from the provided snapshot,
	// and with the specified type and IOPS (if using provisioned IOPS).
	CreateVolumeFromSnapshot(snapshotID, volumeType string, iops *int) (volumeID string, err error)

	// GetVolumeInfo returns the type and IOPS (if using provisioned IOPS) for a specified block
	// volume.
	GetVolumeInfo(volumeID string) (string, *int, error)

	// IsVolumeReady returns whether the specified volume is ready to be used.
	IsVolumeReady(volumeID string) (ready bool, err error)

	// ListSnapshots returns a list of all snapshots matching the specified set of tag key/values.
	ListSnapshots(tagFilters map[string]string) ([]string, error)

	// CreateSnapshot creates a snapshot of the specified block volume, and applies the provided
	// set of tags to the snapshot.
	CreateSnapshot(volumeID string, tags map[string]string) (snapshotID string, err error)

	// DeleteSnapshot deletes the specified volume snapshot.
	DeleteSnapshot(snapshotID string) error
}

BlockStorageAdapter exposes basic block-storage operations required by Ark.

type ObjectStorageAdapter

type ObjectStorageAdapter interface {
	// PutObject creates a new object using the data in body within the specified
	// object storage bucket with the given key.
	PutObject(bucket string, key string, body io.ReadSeeker) error

	// GetObject retrieves the object with the given key from the specified
	// bucket in object storage.
	GetObject(bucket string, key string) (io.ReadCloser, error)

	// ListCommonPrefixes gets a list of all object key prefixes that come
	// before the provided delimiter (this is often used to simulate a directory
	// hierarchy in object storage).
	ListCommonPrefixes(bucket string, delimiter string) ([]string, error)

	// DeleteObject removes object with the specified key from the given
	// bucket.
	DeleteObject(bucket string, key string) error
}

ObjectStorageAdapter exposes basic object-storage operations required by Ark.

type SnapshotService

type SnapshotService interface {
	// GetAllSnapshots returns a slice of all snapshots found in the cloud API that
	// are tagged with Ark metadata. Returns an error if a problem is encountered accessing
	// the cloud API.
	GetAllSnapshots() ([]string, error)

	// CreateSnapshot triggers a snapshot for the specified cloud volume and tags it with metadata.
	// it returns the cloud snapshot ID, or an error if a problem is encountered triggering the snapshot via
	// the cloud API.
	CreateSnapshot(volumeID string) (string, error)

	// CreateVolumeFromSnapshot triggers a restore operation to create a new cloud volume from the specified
	// snapshot and volume characteristics. Returns the cloud volume ID, or an error if a problem is
	// encountered triggering the restore via the cloud API.
	CreateVolumeFromSnapshot(snapshotID, volumeType string, iops *int) (string, error)

	// DeleteSnapshot triggers a deletion of the specified Ark snapshot via the cloud API. It returns an
	// error if a problem is encountered triggering the deletion via the cloud API.
	DeleteSnapshot(snapshotID string) error

	// GetVolumeInfo gets the type and IOPS (if applicable) from the cloud API.
	GetVolumeInfo(volumeID string) (string, *int, error)
}

SnapshotService exposes Ark-specific operations for snapshotting and restoring block volumes.

func NewSnapshotService

func NewSnapshotService(blockStorage BlockStorageAdapter) SnapshotService

NewSnapshotService creates a snapshot service using the provided block storage adapter

type StorageAdapter

type StorageAdapter interface {
	ObjectStorage() ObjectStorageAdapter
	BlockStorage() BlockStorageAdapter
}

StorageAdapter exposes object- and block-storage interfaces and associated methods for a given storage provider.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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