Documentation ¶
Overview ¶
Package snapmeta provides Kopia implementations of Persister and Snapshotter.
Index ¶
- Constants
- type Index
- type KopiaPersister
- func (store *KopiaPersister) Cleanup()
- func (store *KopiaPersister) ConnectOrCreateFilesystem(path string) error
- func (store *KopiaPersister) ConnectOrCreateFilesystemWithServer(repoPath, serverAddr string) (*exec.Cmd, string, error)
- func (store *KopiaPersister) ConnectOrCreateRepo(repoPath string) error
- func (store *KopiaPersister) ConnectOrCreateS3(bucketName, pathPrefix string) error
- func (store *KopiaPersister) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, string, error)
- func (store *KopiaPersister) FlushMetadata() error
- func (store *KopiaPersister) GetPersistDir() string
- func (store *KopiaPersister) LoadMetadata() error
- type KopiaPersisterLight
- func (kpl *KopiaPersisterLight) Cleanup()
- func (kpl *KopiaPersisterLight) ConnectOrCreateRepo(repoPath string) error
- func (kpl *KopiaPersisterLight) Delete(ctx context.Context, key string) error
- func (kpl *KopiaPersisterLight) FlushMetadata() error
- func (kpl *KopiaPersisterLight) GetPersistDir() string
- func (kpl *KopiaPersisterLight) Load(ctx context.Context, key string) ([]byte, error)
- func (kpl *KopiaPersisterLight) LoadMetadata() error
- func (kpl *KopiaPersisterLight) Store(ctx context.Context, key string, val []byte) error
- type KopiaSnapshotter
- func (ks *KopiaSnapshotter) AuthorizeClient(user string) error
- func (ks *KopiaSnapshotter) Cleanup()
- func (ks *KopiaSnapshotter) ConnectClient(fingerprint, user string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateFilesystem(path string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateFilesystemWithServer(serverAddr, repoPath string) (*exec.Cmd, error)
- func (ks *KopiaSnapshotter) ConnectOrCreateRepo(repoPath string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateS3(bucketName, pathPrefix string) error
- func (ks *KopiaSnapshotter) ConnectOrCreateS3WithServer(serverAddr, bucketName, pathPrefix string) (*exec.Cmd, error)
- func (ks *KopiaSnapshotter) CreateSnapshot(ctx context.Context, sourceDir string, opts map[string]string) (snapID string, fingerprint []byte, snapStats *robustness.CreateSnapshotStats, ...)
- func (ks *KopiaSnapshotter) DeleteSnapshot(ctx context.Context, snapID string, opts map[string]string) error
- func (ks *KopiaSnapshotter) DisconnectClient(user string)
- func (ks *KopiaSnapshotter) ListSnapshots(ctx context.Context) ([]string, error)
- func (ks *KopiaSnapshotter) RemoveClient(user string)
- func (ks *KopiaSnapshotter) RestoreSnapshot(ctx context.Context, snapID, restoreDir string, opts map[string]string) (fingerprint []byte, err error)
- func (ks *KopiaSnapshotter) RestoreSnapshotCompare(ctx context.Context, snapID, restoreDir string, validationData []byte, ...) (err error)
- func (ks *KopiaSnapshotter) Run(args ...string) (stdout, stderr string, err error)
- func (ks *KopiaSnapshotter) RunGC(ctx context.Context, opts map[string]string) error
- func (ks *KopiaSnapshotter) ServerCmd() *exec.Cmd
- func (ks *KopiaSnapshotter) ServerFingerprint() string
- type Simple
Constants ¶
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
Index is a map of index name to the keys associated with that index name.
func (Index) AddToIndex ¶ added in v0.8.0
AddToIndex adds a key to the index of the given name.
func (Index) GetKeys ¶ added in v0.8.0
GetKeys returns the list of keys associated with the given index name.
func (Index) IsKeyInIndex ¶ added in v0.8.0
IsKeyInIndex will return true if the given index name contains the provided key.
func (Index) RemoveFromIndex ¶ added in v0.8.0
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, string, 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, string, 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 KopiaPersisterLight ¶ added in v0.9.0
type KopiaPersisterLight struct {
// contains filtered or unexported fields
}
KopiaPersisterLight is a wrapper for KopiaClient that satisfies the Persister interface.
func NewPersisterLight ¶ added in v0.9.0
func NewPersisterLight(baseDir string) (*KopiaPersisterLight, error)
NewPersisterLight returns a new KopiaPersisterLight.
func (*KopiaPersisterLight) Cleanup ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) Cleanup()
Cleanup removes the persistence directory and closes the Kopia repo.
func (*KopiaPersisterLight) ConnectOrCreateRepo ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) ConnectOrCreateRepo(repoPath string) error
ConnectOrCreateRepo creates a new Kopia repo or connects to an existing one if possible.
func (*KopiaPersisterLight) Delete ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) Delete(ctx context.Context, key string) error
Delete deletes all snapshots associated with the given key.
func (*KopiaPersisterLight) FlushMetadata ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) FlushMetadata() error
FlushMetadata is a no-op. It is included to satisfy the Persister interface.
func (*KopiaPersisterLight) GetPersistDir ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) GetPersistDir() string
GetPersistDir returns the persistence directory.
func (*KopiaPersisterLight) Load ¶ added in v0.9.0
Load pulls the key value pair from the Kopia repo and returns the value.
func (*KopiaPersisterLight) LoadMetadata ¶ added in v0.9.0
func (kpl *KopiaPersisterLight) LoadMetadata() error
LoadMetadata is a no-op. It is included to satisfy the Persister interface.
type KopiaSnapshotter ¶ added in v0.8.0
type KopiaSnapshotter struct {
// contains filtered or unexported fields
}
KopiaSnapshotter wraps the functionality to connect to a kopia repository with the fswalker WalkCompare.
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) AuthorizeClient ¶ added in v0.9.0
func (ks *KopiaSnapshotter) AuthorizeClient(user string) error
AuthorizeClient should be called by a server to add a client to the server's user list.
func (*KopiaSnapshotter) Cleanup ¶ added in v0.8.0
func (ks *KopiaSnapshotter) Cleanup()
Cleanup should be called before termination.
func (*KopiaSnapshotter) ConnectClient ¶ added in v0.9.0
func (ks *KopiaSnapshotter) ConnectClient(fingerprint, user string) error
ConnectClient should be called by a client to connect itself to the server using the given cert fingerprint.
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(ctx context.Context, sourceDir string, opts map[string]string) (snapID string, fingerprint []byte, snapStats *robustness.CreateSnapshotStats, err error)
CreateSnapshot is part of Snapshotter.
func (*KopiaSnapshotter) DeleteSnapshot ¶ added in v0.8.0
func (ks *KopiaSnapshotter) DeleteSnapshot(ctx context.Context, snapID string, opts map[string]string) error
DeleteSnapshot is part of Snapshotter.
func (*KopiaSnapshotter) DisconnectClient ¶ added in v0.9.0
func (ks *KopiaSnapshotter) DisconnectClient(user string)
DisconnectClient should be called by a client to disconnect itself from the server.
func (*KopiaSnapshotter) ListSnapshots ¶ added in v0.8.0
func (ks *KopiaSnapshotter) ListSnapshots(ctx context.Context) ([]string, error)
ListSnapshots is part of Snapshotter.
func (*KopiaSnapshotter) RemoveClient ¶ added in v0.9.0
func (ks *KopiaSnapshotter) RemoveClient(user string)
RemoveClient should be called by a server to remove a client from its user list.
func (*KopiaSnapshotter) RestoreSnapshot ¶ added in v0.8.0
func (ks *KopiaSnapshotter) RestoreSnapshot(ctx context.Context, snapID, restoreDir string, opts map[string]string) (fingerprint []byte, err error)
RestoreSnapshot restores the snapshot with the given ID to the provided restore directory. It returns fingerprint verification data of the restored snapshot directory.
func (*KopiaSnapshotter) RestoreSnapshotCompare ¶ added in v0.8.0
func (ks *KopiaSnapshotter) RestoreSnapshotCompare(ctx context.Context, snapID, restoreDir string, validationData []byte, reportOut io.Writer, opts map[string]string) (err error)
RestoreSnapshotCompare restores the snapshot with the given ID to the provided restore directory, then verifies the data that has been restored against the provided fingerprint validation data.
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) ServerCmd ¶ added in v0.8.0
func (ks *KopiaSnapshotter) ServerCmd() *exec.Cmd
ServerCmd returns the server command.
func (*KopiaSnapshotter) ServerFingerprint ¶ added in v0.9.0
func (ks *KopiaSnapshotter) ServerFingerprint() string
ServerFingerprint returns the cert fingerprint that is used to connect to the server.
type Simple ¶
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.