blobmanipulator

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package blobmanipulator provides the framework for snapshot fix testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobManipulator

type BlobManipulator struct {
	KopiaCommandRunner *kopiarunner.KopiaSnapshotter
	DirCreater         *snapmeta.KopiaSnapshotter

	DataRepoPath       string
	CanRunMaintenance  bool
	PathToTakeSnapshot string
	// contains filtered or unexported fields
}

BlobManipulator provides a way to run a kopia command.

func NewBlobManipulator

func NewBlobManipulator(baseDirPath, dataRepoPath string) (*BlobManipulator, error)

NewBlobManipulator instantiates a new BlobManipulator and returns its pointer.

func (*BlobManipulator) ConnectOrCreateRepo

func (bm *BlobManipulator) ConnectOrCreateRepo(dataRepoPath string) error

ConnectOrCreateRepo connects to an existing repository if possible or creates a new one.

func (*BlobManipulator) DeleteBlob

func (bm *BlobManipulator) DeleteBlob(blobID string) error

DeleteBlob deletes the provided blob or a random blob, in kopia repo.

func (*BlobManipulator) DeleteSnapshot

func (bm *BlobManipulator) DeleteSnapshot(snapshotID string) (string, error)

DeleteSnapshot deletes provided snapshot.

func (*BlobManipulator) GenerateRandomFiles added in v0.14.0

func (bm *BlobManipulator) GenerateRandomFiles(fileSize, numFiles int) error

GenerateRandomFiles connects or creates a Kopia repository that writes random data in source directory. Tests can later create snapshots from the source directory.

func (*BlobManipulator) RestoreGivenOrRandomSnapshot

func (bm *BlobManipulator) RestoreGivenOrRandomSnapshot(snapID, restoreDir string) (string, error)

RestoreGivenOrRandomSnapshot restores a given or a random snapshot from kopia repository into the provided target directory.

func (*BlobManipulator) RunMaintenance

func (bm *BlobManipulator) RunMaintenance() (string, error)

RunMaintenance runs repository maintenance.

func (*BlobManipulator) SetUpSystemUnderTest

func (bm *BlobManipulator) SetUpSystemUnderTest() error

SetUpSystemUnderTest connects or creates a kopia repo, writes random data in source directory, creates snapshots of the source directory.

func (*BlobManipulator) SetUpSystemWithOneSnapshot added in v0.14.0

func (bm *BlobManipulator) SetUpSystemWithOneSnapshot() (string, error)

SetUpSystemWithOneSnapshot connects or creates a kopia repo, writes random data in source directory, creates snapshots of the source directory.

func (*BlobManipulator) SnapshotFixInvalidFiles

func (bm *BlobManipulator) SnapshotFixInvalidFiles(flags string) (string, error)

SnapshotFixInvalidFiles runs snapshot fix invalid-files command with the provided flags.

func (*BlobManipulator) SnapshotFixRemoveFilesByBlobID

func (bm *BlobManipulator) SnapshotFixRemoveFilesByBlobID(blobID string) (string, error)

SnapshotFixRemoveFilesByBlobID runs snapshot fix remove-files command with a provided blob id.

func (*BlobManipulator) SnapshotFixRemoveFilesByFilename

func (bm *BlobManipulator) SnapshotFixRemoveFilesByFilename(filename string) (string, error)

SnapshotFixRemoveFilesByFilename runs snapshot fix remove-files command with a provided file name.

func (*BlobManipulator) TakeSnapshot

func (bm *BlobManipulator) TakeSnapshot(dir string) (snapID, stdout string, err error)

TakeSnapshot creates snapshot of the provided directory.

func (*BlobManipulator) VerifySnapshot added in v0.14.0

func (bm *BlobManipulator) VerifySnapshot() error

VerifySnapshot implements the Snapshotter interface to verify a kopia snapshot corruption.

Jump to

Keyboard shortcuts

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