orchestrator

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StateReady            = "ready"
	StateDeploymentExists = "deployment-exists"
	StateHasBackupScript  = "is-backupable"
	StateArtifactCreated  = "artifact-created"
	StateLocked           = "locked"
	StateBackedup         = "backed-up"
	StateUnlocked         = "unlocked"
	StateDrained          = "drained"
	StateFinished         = "finished"
)
View Source
const (
	EventCheckDeployment          = "check-deployment-exists"
	EventCheckHasBackupScript     = "check-is-backupable"
	EventCreateEmptyLocalArtifact = "create-artifact"
	EventPrebackupLock            = "pre-backup-lock"
	EventBackup                   = "backup"
	EventPostBackupUnlock         = "post-backup-unlock"
	EventDrain                    = "drain"
	EventCleanup                  = "cleanup"
)
View Source
const ArtifactDirectory = "/var/vcap/store/bbr-backup"

Variables

This section is empty.

Functions

func ConvertErrors

func ConvertErrors(errs []error) error

func ProcessError

func ProcessError(errs Error) (int, string, string)

Types

type ArtifactIdentifier

type ArtifactIdentifier interface {
	InstanceName() string
	InstanceIndex() string
	Name() string
	HasCustomName() bool
}

type AuthInfo

type AuthInfo struct {
	Type   string
	UaaUrl string
}

type Backup

type Backup interface {
	CreateArtifact(ArtifactIdentifier) (io.WriteCloser, error)
	ReadArtifact(ArtifactIdentifier) (io.ReadCloser, error)
	AddChecksum(ArtifactIdentifier, BackupChecksum) error
	CreateMetadataFileWithStartTime(time.Time) error
	AddFinishTime(time.Time) error
	FetchChecksum(ArtifactIdentifier) (BackupChecksum, error)
	CalculateChecksum(ArtifactIdentifier) (BackupChecksum, error)
	DeploymentMatches(string, []Instance) (bool, error)
	SaveManifest(manifest string) error
	Valid() (bool, error)
}

type BackupArtifact

type BackupArtifact interface {
	ArtifactIdentifier
	Size() (string, error)
	Checksum() (BackupChecksum, error)
	StreamFromRemote(io.Writer) error
	Delete() error
	StreamToRemote(io.Reader) error
}

type BackupChecksum

type BackupChecksum map[string]string

func (BackupChecksum) Match

func (self BackupChecksum) Match(other BackupChecksum) bool

type BackupError

type BackupError customError

func NewBackupError

func NewBackupError(errorMessage string) BackupError

type BackupManager

type BackupManager interface {
	Create(string, Logger, func() time.Time) (Backup, error)
	Open(string, Logger) (Backup, error)
}

type Backuper

type Backuper struct {
	BackupManager
	Logger

	DeploymentManager
	NowFunc func() time.Time
}

func NewBackuper

func NewBackuper(backupManager BackupManager, logger Logger, deploymentManager DeploymentManager, nowFunc func() time.Time) *Backuper

func (Backuper) Backup

func (b Backuper) Backup(deploymentName string) Error

Backup checks if a deployment has backupable instances and backs them up.

func (Backuper) CanBeBackedUp

func (b Backuper) CanBeBackedUp(deploymentName string) (bool, Error)

type CleanupError

type CleanupError customError

func NewCleanupError

func NewCleanupError(errorMessage string) CleanupError

type Deployment

type Deployment interface {
	HasBackupScript() bool
	HasUniqueCustomArtifactNames() bool
	CheckArtifactDir() error
	IsRestorable() bool
	PreBackupLock() error
	Backup() error
	PostBackupUnlock() error
	Restore() error
	CopyRemoteBackupToLocal(Backup) error
	CopyLocalBackupToRemote(Backup) error
	Cleanup() error
	Instances() []Instance
	CustomArtifactNamesMatch() error
}

func NewDeployment

func NewDeployment(logger Logger, instancesArray []Instance) Deployment

type DeploymentManager

type DeploymentManager interface {
	Find(deploymentName string) (Deployment, error)
	SaveManifest(deploymentName string, artifact Backup) error
}

type Error

type Error []error

func (Error) Error

func (e Error) Error() string

func (Error) IsCleanup

func (e Error) IsCleanup() bool

func (Error) IsFatal

func (e Error) IsFatal() bool

func (Error) IsNil

func (e Error) IsNil() bool

func (Error) IsPostBackup

func (err Error) IsPostBackup() bool

func (Error) PrettyError

func (e Error) PrettyError(includeStacktrace bool) string

type Instance

type Instance interface {
	InstanceIdentifer
	HasBackupScript() bool
	ArtifactDirExists() (bool, error)
	ArtifactDirCreated() bool
	MarkArtifactDirCreated()
	IsPostBackupUnlockable() bool
	IsPreBackupLockable() bool
	IsRestorable() bool
	PreBackupLock() error
	Backup() error
	PostBackupUnlock() error
	Restore() error
	Cleanup() error
	ArtifactsToBackup() []BackupArtifact
	ArtifactsToRestore() []BackupArtifact
	CustomBackupArtifactNames() []string
	CustomRestoreArtifactNames() []string
}

type InstanceIdentifer

type InstanceIdentifer interface {
	Name() string
	Index() string
	ID() string
}

type LockError

type LockError customError

func NewLockError

func NewLockError(errorMessage string) LockError

type Logger

type Logger interface {
	Debug(tag, msg string, args ...interface{})
	Info(tag, msg string, args ...interface{})
	Warn(tag, msg string, args ...interface{})
	Error(tag, msg string, args ...interface{})
}

type PostBackupUnlockError

type PostBackupUnlockError customError

func NewPostBackupUnlockError

func NewPostBackupUnlockError(errorMessage string) PostBackupUnlockError

type Restorer

type Restorer struct {
	BackupManager
	Logger

	DeploymentManager
}

func NewRestorer

func NewRestorer(backupManager BackupManager, logger Logger, deploymentManager DeploymentManager) *Restorer

func (Restorer) Restore

func (b Restorer) Restore(deploymentName, backupPath string) Error

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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