kopiarunner

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: Apache-2.0 Imports: 19 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(baseDir string) (*KopiaSnapshotter, error)

NewKopiaSnapshotter instantiates a new KopiaSnapshotter and returns its pointer.

func (*KopiaSnapshotter) AuthorizeClient added in v0.9.0

func (ks *KopiaSnapshotter) AuthorizeClient(user, host string, args ...string) error

AuthorizeClient adds a client to the server's user list.

func (*KopiaSnapshotter) Cleanup

func (ks *KopiaSnapshotter) Cleanup()

Cleanup cleans up the kopia Runner.

func (*KopiaSnapshotter) ConnectClient added in v0.9.0

func (ks *KopiaSnapshotter) ConnectClient(addr, fingerprint, user, host string, args ...string) error

ConnectClient connects a given client to the server at the given address using the given cert fingerprint.

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) ConnectOrCreateFilesystemWithServer added in v0.8.0

func (ks *KopiaSnapshotter) ConnectOrCreateFilesystemWithServer(serverAddr, repoPath string) (*exec.Cmd, string, error)

ConnectOrCreateFilesystemWithServer attempts to connect or create repo in local filesystem, but with TLS server/client Model.

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) ConnectOrCreateRepoWithServer added in v0.9.0

func (ks *KopiaSnapshotter) ConnectOrCreateRepoWithServer(serverAddr string, args ...string) (*exec.Cmd, string, error)

ConnectOrCreateRepoWithServer creates Repository and a TLS server/client model for interaction.

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) ConnectOrCreateS3WithServer added in v0.8.0

func (ks *KopiaSnapshotter) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, string, error)

ConnectOrCreateS3WithServer attempts to connect or create S3 bucket, but with TLS client/server Model.

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) CreateServer added in v0.8.0

func (ks *KopiaSnapshotter) CreateServer(addr string, args ...string) (*exec.Cmd, error)

CreateServer creates a new instance of Kopia Server with provided address.

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) DisconnectClient added in v0.9.0

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

DisconnectClient should be called by a client to disconnect itself from the server.

func (*KopiaSnapshotter) ListClients added in v0.9.0

func (ks *KopiaSnapshotter) ListClients(addr, fingerprint string, args ...string) error

ListClients lists the clients that are registered with the Kopia server.

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) RefreshServer added in v0.9.0

func (ks *KopiaSnapshotter) RefreshServer(addr, fingerprint string, args ...string) error

RefreshServer refreshes the server at the given address.

func (*KopiaSnapshotter) RemoveClient added in v0.9.0

func (ks *KopiaSnapshotter) RemoveClient(user, host string, args ...string) error

RemoveClient removes a client from the server's user list.

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.

func (*KopiaSnapshotter) RunGC added in v0.7.0

func (ks *KopiaSnapshotter) RunGC() (err error)

RunGC implements the Snapshotter interface, issues a gc command to the kopia repo.

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(baseDir string) (*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.

func (*Runner) RunAsync added in v0.8.0

func (kr *Runner) RunAsync(args ...string) (*exec.Cmd, error)

RunAsync will execute the kopia command with the given args in background.

Jump to

Keyboard shortcuts

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