snapmeta

package
v0.8.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package snapmeta provides Kopia implementations of Persister and Snapshotter.

Index

Constants

View Source
const (
	// S3BucketNameEnvKey is the environment variable required to connect to a repo on S3.
	S3BucketNameEnvKey = "S3_BUCKET_NAME"
	// EngineModeEnvKey is the environment variable required to switch between basic and server/client model.
	EngineModeEnvKey = "ENGINE_MODE"
	// EngineModeBasic is a constant used to check the engineMode.
	EngineModeBasic = "BASIC"
	// EngineModeServer is a constant used to check the engineMode.
	EngineModeServer = "SERVER"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Index added in v0.8.0

type Index map[string]map[string]struct{}

Index is a map of index name to the keys associated with that index name.

func (Index) AddToIndex added in v0.8.0

func (idx Index) AddToIndex(key, indexName string)

AddToIndex adds a key to the index of the given name.

func (Index) GetKeys added in v0.8.0

func (idx Index) GetKeys(indexName string) (ret []string)

GetKeys returns the list of keys associated with the given index name.

func (Index) IsKeyInIndex added in v0.8.0

func (idx Index) IsKeyInIndex(key, indexName string) bool

IsKeyInIndex will return true if the given index name contains the provided key.

func (Index) RemoveFromIndex added in v0.8.0

func (idx Index) RemoveFromIndex(key, indexName string)

RemoveFromIndex removes a key from the index of the given name.

type KopiaPersister added in v0.8.0

type KopiaPersister struct {
	*Simple
	// contains filtered or unexported fields
}

KopiaPersister implements robustness.Persister.

func NewPersister added in v0.8.0

func NewPersister(baseDir string) (*KopiaPersister, error)

NewPersister returns a Kopia based Persister. ConnectOrCreateRepo must be invoked to enable the interface.

func (*KopiaPersister) Cleanup added in v0.8.0

func (store *KopiaPersister) Cleanup()

Cleanup cleans up the local temporary files used by a KopiaMetadata.

func (*KopiaPersister) ConnectOrCreateFilesystem added in v0.8.0

func (store *KopiaPersister) ConnectOrCreateFilesystem(path string) error

ConnectOrCreateFilesystem implements the RepoManager interface, connects to a repo in the filesystem or attempts to create one if connection is unsuccessful.

func (*KopiaPersister) ConnectOrCreateFilesystemWithServer added in v0.8.0

func (store *KopiaPersister) ConnectOrCreateFilesystemWithServer(repoPath, serverAddr string) (*exec.Cmd, error)

ConnectOrCreateFilesystemWithServer implements the RepoManager interface, creates a server connects it a repo in the filesystem and creates a client to perform operations.

func (*KopiaPersister) ConnectOrCreateRepo added in v0.8.0

func (store *KopiaPersister) ConnectOrCreateRepo(repoPath string) error

ConnectOrCreateRepo makes the Persister ready for use.

func (*KopiaPersister) ConnectOrCreateS3 added in v0.8.0

func (store *KopiaPersister) ConnectOrCreateS3(bucketName, pathPrefix string) error

ConnectOrCreateS3 implements the RepoManager interface, connects to a repo in an S3 bucket or attempts to create one if connection is unsuccessful.

func (*KopiaPersister) ConnectOrCreateS3WithServer added in v0.8.0

func (store *KopiaPersister) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, error)

ConnectOrCreateS3WithServer implements the RepoManager interface, creates a server connects it a repo in an S3 bucket and creates a client to perform operations.

func (*KopiaPersister) FlushMetadata added in v0.8.0

func (store *KopiaPersister) FlushMetadata() error

FlushMetadata implements the DataPersister interface, flushing the local metadata on the target test repo's snapshots to the metadata Kopia repository as a snapshot create.

func (*KopiaPersister) GetPersistDir added in v0.8.0

func (store *KopiaPersister) GetPersistDir() string

GetPersistDir returns the path to the directory that will be persisted as a snapshot to the kopia repository.

func (*KopiaPersister) LoadMetadata added in v0.8.0

func (store *KopiaPersister) LoadMetadata() error

LoadMetadata implements the DataPersister interface, restores the latest snapshot from the kopia repository and decodes its contents, populating its metadata on the snapshots residing in the target test repository.

type KopiaSnapshotter added in v0.8.0

type KopiaSnapshotter struct {
	// contains filtered or unexported fields
}

KopiaSnapshotter implements robustness.Snapshotter.

func NewSnapshotter added in v0.8.0

func NewSnapshotter(baseDirPath string) (*KopiaSnapshotter, error)

NewSnapshotter returns a Kopia based Snapshotter. ConnectOrCreateRepo must be invoked to enable the interface.

func (*KopiaSnapshotter) Cleanup added in v0.8.0

func (ks *KopiaSnapshotter) Cleanup()

Cleanup should be called before termination.

func (*KopiaSnapshotter) ConnectOrCreateFilesystem added in v0.8.0

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

ConnectOrCreateFilesystem TBD: remove this.

func (*KopiaSnapshotter) ConnectOrCreateFilesystemWithServer added in v0.8.0

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

ConnectOrCreateFilesystemWithServer TBD: remove this.

func (*KopiaSnapshotter) ConnectOrCreateRepo added in v0.8.0

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

ConnectOrCreateRepo makes the Snapshotter ready for use.

func (*KopiaSnapshotter) ConnectOrCreateS3 added in v0.8.0

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

ConnectOrCreateS3 TBD: remove this.

func (*KopiaSnapshotter) ConnectOrCreateS3WithServer added in v0.8.0

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

ConnectOrCreateS3WithServer TBD: remove this.

func (*KopiaSnapshotter) CreateSnapshot added in v0.8.0

func (ks *KopiaSnapshotter) CreateSnapshot(sourceDir string, opts map[string]string) (snapID string, err error)

CreateSnapshot is part of Snapshotter.

func (*KopiaSnapshotter) DeleteSnapshot added in v0.8.0

func (ks *KopiaSnapshotter) DeleteSnapshot(snapID string, opts map[string]string) error

DeleteSnapshot is part of Snapshotter.

func (*KopiaSnapshotter) ListSnapshots added in v0.8.0

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

ListSnapshots is part of Snapshotter.

func (*KopiaSnapshotter) RestoreSnapshot added in v0.8.0

func (ks *KopiaSnapshotter) RestoreSnapshot(snapID, restoreDir string, opts map[string]string) error

RestoreSnapshot is part of Snapshotter.

func (*KopiaSnapshotter) Run added in v0.8.0

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

Run is part of Snapshotter.

func (*KopiaSnapshotter) RunGC added in v0.8.0

func (ks *KopiaSnapshotter) RunGC(opts map[string]string) error

RunGC is part of Snapshotter.

func (*KopiaSnapshotter) ServerCmd added in v0.8.0

func (ks *KopiaSnapshotter) ServerCmd() *exec.Cmd

ServerCmd returns the server command.

type Simple

type Simple struct {
	Data map[string][]byte `json:"data"`
}

Simple is a snapstore implementation that stores snapshot metadata as a byte slice in a map in memory. A Simple should not be copied.

func NewSimple

func NewSimple() *Simple

NewSimple instantiates a new Simple snapstore and returns its pointer.

func (*Simple) Delete

func (s *Simple) Delete(key string)

Delete implements the Storer interface Delete method.

func (*Simple) Load

func (s *Simple) Load(key string) ([]byte, error)

Load implements the Storer interface Load method.

func (*Simple) Store

func (s *Simple) Store(key string, val []byte) error

Store implements the Storer interface Store method.

Jump to

Keyboard shortcuts

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