zfs

package
v0.0.0-...-6bdf688 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FQ

func FQ(poolName, fs string) string

FQ - from filesystem id to a fully qualified ZFS filesystem

func FullIdWithSnapshot

func FullIdWithSnapshot(filesystemId, snapshotId string) string

I'm bored of writing "if snapshotId is empty"

func LogZFSCommand

func LogZFSCommand(filesystemId, command string)

TODO: why not use a logger and using a file with it then tune the level? This is used aalllll over the codebase.

func UnFQ

func UnFQ(poolName, fqfs string) string

UnFQ - from fully qualified ZFS name to filesystem id, strip off prefix

Types

type DiffResult

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

type DiffSide

type DiffSide map[string]DiffResult

type FilesystemDiffCache

type FilesystemDiffCache struct {
	// latest snapshot cached (we only cache one DiffSide result per
	// filesystem, this points to which snapshot it is for)
	SnapshotID string
	DiffSide   DiffSide
}

type FilesystemResultCache

type FilesystemResultCache struct {
	SnapshotID string
	Result     []types.ZFSFileDiff
}

type ZFS

type ZFS interface {
	GetPoolID() string
	GetZPoolCapacity() (float64, error)
	ReportZpoolCapacity() error
	FindFilesystemIdsOnSystem() []string
	DeleteFilesystemInZFS(fs string) error
	// Return:
	// 1. How many bytes changed since the given filesystem snapshot.
	// 2. The total number of bytes used by the filesystem. Specifically the
	//    "referenced" attribute, which means if two filesystems share some data,
	//    it'll be double-counted. Which is fine, probably, ZFS being smart is an
	//    implementation detail.
	GetDirtyDelta(filesystemId, latestSnap string) (dirtyBytes int64, usedBytes int64, err error)
	Snapshot(filesystemId, snapshotId string, meta []string) ([]byte, error)
	List(filesystemId, snapshotId string) ([]byte, error)
	FQ(filesystemId string) string
	DiscoverSystem(fs string) (*types.Filesystem, error)
	StashBranch(existingFs string, newFs string, rollbackTo string) error
	PredictSize(fromFilesystemId, fromSnapshotId, toFilesystemId, toSnapshotId string) (int64, error)
	Clone(filesystemId, originSnapshotId, newCloneFilesystemId string) ([]byte, error)
	Rollback(filesystemId, snapshotId string) ([]byte, error)
	Create(filesystemId string) ([]byte, error)
	Recv(pipeReader *io.PipeReader, toFilesystemId string, errBuffer *bytes.Buffer) error
	ApplyPrelude(prelude types.Prelude, fs string) error
	Send(fromFilesystemId, fromSnapshotId, toFilesystemId, toSnapshotId string, preludeEncoded []byte) (*io.PipeReader, chan error)
	SetCanmount(filesystemId, snapshotId string) ([]byte, error)
	Mount(filesystemId, snapshotId string, options string, mountPath string) ([]byte, error)
	Fork(filesystemId, latestSnapshot, forkFilesystemId string) error
	Diff(filesystemId string) ([]types.ZFSFileDiff, error)
	// LastModified returns last modified temp snapshot, must be called after Diff
	LastModified(filesystemID string) (*types.LastModified, error)
	DestroyTmpSnapIfExists(filesystemId string) error
}

func NewZFS

func NewZFS(zfsPath, zpoolPath, poolName, mountZFS string) (ZFS, error)

Jump to

Keyboard shortcuts

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