backup

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Destination

type Destination interface {
	// Upload uploads the file on disk to this destination. It takes the local `path' at which the backup is currently
	// stored.
	Upload(ctx context.Context, source string) error

	// IsUploaded checks if the backup has already been uploaded to this destination.
	IsUploaded(ctx context.Context) (bool, error)

	// RemotePath returns a string representing the location that the backup has been/will be placed.
	RemotePath() (string, error)
}

Destination is the place to store the backup.

type GCSDestination

type GCSDestination struct {
	// The name of the GCS bucket to place the backup.
	Bucket string
	// The name of the object inside of the bucket. This can contain directories.
	BlobName string
}

GCSDestination is a Destination which allows backups to be stored in Google Cloud Storage.

func (*GCSDestination) IsUploaded

func (d *GCSDestination) IsUploaded(ctx context.Context) (bool, error)

func (*GCSDestination) RemotePath

func (d *GCSDestination) RemotePath() (string, error)

func (*GCSDestination) Upload

func (d *GCSDestination) Upload(ctx context.Context, source string) error

type LocalVolumeDestination

type LocalVolumeDestination struct {
	// The absolute path to a file in which the backup will be placed. If the directory containing this file does not
	// exist, it will be created.
	Path string
}

LocalVolumeDestination is a Destination which allows backups to be stored in a local filesystem volume.

func (*LocalVolumeDestination) IsUploaded

func (d *LocalVolumeDestination) IsUploaded(ctx context.Context) (bool, error)

func (*LocalVolumeDestination) RemotePath

func (d *LocalVolumeDestination) RemotePath() (string, error)

func (*LocalVolumeDestination) Upload

func (d *LocalVolumeDestination) Upload(ctx context.Context, source string) error

type Method

type Method interface {
	// Save takes the backup & saves it on disk at the given filename.
	Save(ctx context.Context, path string) error

	// IsSaved checks if the backup already exists on the local disk.
	IsSaved(ctx context.Context, path string) (bool, error)

	// Delete removes the image from the local disk.
	Delete(ctx context.Context, path string) error
}

Method is a technique to use to perform a backup.

type SnapshotMethod

type SnapshotMethod struct {
	// Endpoints holds a list of etcd endpoints, used when calling in to the etcd API.
	// Each should be of the format `scheme://host-name:port'.
	Endpoints []string
}

SnapshotMethod is a Method which uses the built-in etcd snapshot mechanisms to perform a backup.

func (*SnapshotMethod) Delete

func (m *SnapshotMethod) Delete(ctx context.Context, path string) error

func (*SnapshotMethod) IsSaved

func (m *SnapshotMethod) IsSaved(ctx context.Context, path string) (bool, error)

func (*SnapshotMethod) Save

func (m *SnapshotMethod) Save(ctx context.Context, path string) error

Jump to

Keyboard shortcuts

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