Documentation ¶
Overview ¶
Package kopiarunner wraps the execution of the kopia binary.
Index ¶
- Variables
- type KopiaSnapshotter
- func (ks *KopiaSnapshotter) AuthorizeClient(user, host string, args ...string) error
- func (ks *KopiaSnapshotter) Cleanup()
- func (ks *KopiaSnapshotter) ConnectClient(addr, fingerprint, user, host string, args ...string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateFilesystem(repoPath string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateFilesystemWithServer(serverAddr, repoPath string) (*exec.Cmd, string, error)
- func (ks *KopiaSnapshotter) ConnectOrCreateRepo(args ...string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateRepoWithServer(serverAddr string, args ...string) (*exec.Cmd, string, error)
- func (ks *KopiaSnapshotter) ConnectOrCreateS3(bucketName, pathPrefix string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, string, error)
- func (ks *KopiaSnapshotter) ConnectRepo(args ...string) (err error)
- func (ks *KopiaSnapshotter) CreateRepo(args ...string) (err error)
- func (ks *KopiaSnapshotter) CreateServer(addr string, args ...string) (*exec.Cmd, error)
- func (ks *KopiaSnapshotter) CreateSnapshot(source string) (snapID string, err error)
- func (ks *KopiaSnapshotter) DeleteSnapshot(snapID string) (err error)
- func (ks *KopiaSnapshotter) DisconnectClient(args ...string) error
- func (ks *KopiaSnapshotter) GetRepositoryStatus() (cli.RepositoryStatus, error)
- func (ks *KopiaSnapshotter) ListClients(addr, fingerprint string, args ...string) error
- func (ks *KopiaSnapshotter) ListSnapshots() ([]string, error)
- func (ks *KopiaSnapshotter) RefreshServer(addr, fingerprint string, args ...string) error
- func (ks *KopiaSnapshotter) RemoveClient(user, host string, args ...string) error
- func (ks *KopiaSnapshotter) RestoreSnapshot(snapID, restoreDir string) (err error)
- func (ks *KopiaSnapshotter) Run(args ...string) (stdout, stderr string, err error)
- func (ks *KopiaSnapshotter) RunGC() (err error)
- func (ks *KopiaSnapshotter) UpgradeRepository(repoPath string) error
- type Runner
Constants ¶
This section is empty.
Variables ¶
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
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) GetRepositoryStatus ¶ added in v0.10.7
func (ks *KopiaSnapshotter) GetRepositoryStatus() (cli.RepositoryStatus, error)
GetRepositoryStatus returns the repository status in JSON format.
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.
func (*KopiaSnapshotter) UpgradeRepository ¶ added in v0.10.7
func (ks *KopiaSnapshotter) UpgradeRepository(repoPath string) error
UpgradeRepository upgrades the given kopia repository from current format version to latest stable format version.
type Runner ¶
Runner is a helper for running kopia commands.
func (*Runner) Cleanup ¶
func (kr *Runner) Cleanup()
Cleanup cleans up the directories managed by the kopia Runner.