kopiarunner

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package kopiarunner wraps the execution of the kopia binary.

Index

Constants

This section is empty.

Variables

View Source
var ErrExeVariableNotSet = errors.New("KOPIA_EXE variable has not been set")

ErrExeVariableNotSet is an exported error

Functions

This section is empty.

Types

type KopiaSnapshotter

type KopiaSnapshotter struct {
	Runner *Runner
}

KopiaSnapshotter implements the Snapshotter interface using Kopia commands

func NewKopiaSnapshotter

func NewKopiaSnapshotter() (*KopiaSnapshotter, error)

NewKopiaSnapshotter instantiates a new KopiaSnapshotter and returns its pointer

func (*KopiaSnapshotter) Cleanup

func (ks *KopiaSnapshotter) Cleanup()

Cleanup cleans up the kopia Runner

func (*KopiaSnapshotter) ConnectOrCreateFilesystem

func (ks *KopiaSnapshotter) ConnectOrCreateFilesystem(repoPath string) error

ConnectOrCreateFilesystem attempts to connect to a kopia repo in the local filesystem at the path provided. It will attempt to create one there if connection was unsuccessful.

func (*KopiaSnapshotter) ConnectOrCreateRepo

func (ks *KopiaSnapshotter) ConnectOrCreateRepo(args ...string) error

ConnectOrCreateRepo attempts to connect to a repo described by the provided arguments, and attempts to create it if connection was unsuccessful.

func (*KopiaSnapshotter) ConnectOrCreateS3

func (ks *KopiaSnapshotter) ConnectOrCreateS3(bucketName, pathPrefix string) error

ConnectOrCreateS3 attempts to connect to a kopia repo in the s3 bucket identified by the provided bucketName, at the provided path prefix. It will attempt to create one there if connection was unsuccessful.

func (*KopiaSnapshotter) ConnectRepo

func (ks *KopiaSnapshotter) ConnectRepo(args ...string) (err error)

ConnectRepo connects to the repository described by the provided arguments

func (*KopiaSnapshotter) CreateRepo

func (ks *KopiaSnapshotter) CreateRepo(args ...string) (err error)

CreateRepo creates a kopia repository with the provided arguments

func (*KopiaSnapshotter) CreateSnapshot

func (ks *KopiaSnapshotter) CreateSnapshot(source string) (snapID string, err error)

CreateSnapshot implements the Snapshotter interface, issues a kopia snapshot create command on the provided source path.

func (*KopiaSnapshotter) DeleteSnapshot

func (ks *KopiaSnapshotter) DeleteSnapshot(snapID string) (err error)

DeleteSnapshot implements the Snapshotter interface, issues a kopia snapshot delete of the provided snapshot ID

func (*KopiaSnapshotter) ListSnapshots

func (ks *KopiaSnapshotter) ListSnapshots() ([]string, error)

ListSnapshots implements the Snapshotter interface, issues a kopia snapshot list and parses the snapshot IDs

func (*KopiaSnapshotter) RestoreSnapshot

func (ks *KopiaSnapshotter) RestoreSnapshot(snapID, restoreDir string) (err error)

RestoreSnapshot implements the Snapshotter interface, issues a kopia snapshot restore command of the provided snapshot ID to the provided restore destination

func (*KopiaSnapshotter) Run

func (ks *KopiaSnapshotter) Run(args ...string) (stdout, stderr string, err error)

Run implements the Snapshotter interface, issues an arbitrary kopia command and returns the output

type Runner

type Runner struct {
	Exe       string
	ConfigDir string
	// contains filtered or unexported fields
}

Runner is a helper for running kopia commands

func NewRunner

func NewRunner() (*Runner, error)

NewRunner initializes a new kopia runner and returns its pointer

func (*Runner) Cleanup

func (kr *Runner) Cleanup()

Cleanup cleans up the directories managed by the kopia Runner

func (*Runner) Run

func (kr *Runner) Run(args ...string) (stdout, stderr string, err error)

Run will execute the kopia command with the given args

Jump to

Keyboard shortcuts

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