zfs

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: Apache-2.0, BSD-3-Clause, CC-BY-4.0, + 2 more Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvailableDatasetNames

func AvailableDatasetNames() ([]string, error)

func NewZFSForFilePath

func NewZFSForFilePath(path string) (ZFS, Dataset, error)

Types

type Dataset

type Dataset struct {
	Name       string       `json:"name"`
	Used       uint64       `json:"used"`
	Avail      uint64       `json:"avail"`
	Refer      uint64       `json:"refer"`
	MountPoint fs.DirHandle `json:"mountPoint"`
	// contains filtered or unexported fields
}

Dataset represents a zfs dataset (aka. zfs filesystem)

func (*Dataset) CloneSnapshot

func (self *Dataset) CloneSnapshot(snapName, fsName string, flags []string) error

func (*Dataset) CreateSnapshot

func (self *Dataset) CreateSnapshot(name string) (string, error)

func (*Dataset) DestroySnapshot

func (self *Dataset) DestroySnapshot(name string, flags []string) error

func (*Dataset) RenameSnapshot

func (self *Dataset) RenameSnapshot(oldName, newName string) error

FIXME: check if the given name is a snapshot name

func (*Dataset) RollbackSnapshot

func (self *Dataset) RollbackSnapshot(name string, flags []string) error

func (*Dataset) ScanSnapshots

func (self *Dataset) ScanSnapshots() (Snapshots, error)

ScanSnapshots returns a list of all snapshots for this dataset

type Datasets

type Datasets []Dataset

Datasets are a list of Dataset

func (Datasets) Root

func (ds Datasets) Root() *Dataset

Root returns the parent dataset

type ExecZFSError

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

func (ExecZFSError) Error

func (self ExecZFSError) Error() string

type ExecutableNotFound

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

func (ExecutableNotFound) Error

func (self ExecutableNotFound) Error() string

type Snapshot

type Snapshot struct {
	Name       string       `json:"name"`
	FullName   string       `json:"fullName"`
	Created    time.Time    `json:"created"`
	MountPoint fs.DirHandle `json:"mountPoint"`
}

Snapshot - zfs snapshot

func (*Snapshot) IsMounted

func (s *Snapshot) IsMounted() (bool, error)

Check if the snaphot is mounted

type Snapshots

type Snapshots []Snapshot

Snapshots represents snapshots from a zfs dataset

func (*Snapshots) Filter

func (s *Snapshots) Filter(f func(Snapshot) bool) Snapshots

Filter filters snapshots per given filter function

func (Snapshots) Reverse

func (s Snapshots) Reverse() Snapshots

Reverse reverse the snapshot list

type SortByPathDesc

type SortByPathDesc Datasets

func (SortByPathDesc) Len

func (s SortByPathDesc) Len() int

func (SortByPathDesc) Less

func (s SortByPathDesc) Less(i, j int) bool

func (SortByPathDesc) Swap

func (s SortByPathDesc) Swap(i, j int)

type Stderr

type Stderr = string

type Stdout

type Stdout = string

type ZFS

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

ZFS represents a zfs filesystem

func NewZFS

func NewZFS(name string) (ZFS, error)

NewZFS returns a handler for a zfs filesystem

func (*ZFS) Datasets

func (self *ZFS) Datasets() Datasets

func (*ZFS) FindDatasetByName

func (self *ZFS) FindDatasetByName(name string) (Dataset, error)

FindDatasetByName searches and returns the dataset with the given name

func (*ZFS) FindDatasetForPath

func (self *ZFS) FindDatasetForPath(path string) (Dataset, error)

func (*ZFS) MountSnapshot

func (self *ZFS) MountSnapshot(snap Snapshot) error

func (*ZFS) Name

func (self *ZFS) Name() string

func (*ZFS) RescanDatasets

func (self *ZFS) RescanDatasets() error

func (*ZFS) ScanDatasets

func (self *ZFS) ScanDatasets() (Datasets, error)

type ZFSCmd

type ZFSCmd interface {
	Exec(string, ...string) (Stdout, Stderr, error)
}

func NewZFSCmd

func NewZFSCmd(useSudo bool) ZFSCmd

func NewZFSCmdMock

func NewZFSCmdMock(stdout Stdout, stderr Stderr, err error) ZFSCmd

Jump to

Keyboard shortcuts

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