zfs

package
v0.0.0-...-63b02d4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DatasetTypeFilesystem - file system dataset
	DatasetTypeFilesystem DatasetType = (1 << 0)
	// DatasetTypeSnapshot - snapshot of dataset
	DatasetTypeSnapshot = (1 << 1)
	// DatasetTypeVolume - volume (virtual block device) dataset
	DatasetTypeVolume = (1 << 2)
	// DatasetTypePool - pool dataset
	DatasetTypePool = (1 << 3)
	// DatasetTypeBookmark - bookmark dataset
	DatasetTypeBookmark = (1 << 4)
)

Variables

This section is empty.

Functions

func FilesystemCreateWithArgs

func FilesystemCreateWithArgs(l []string) funcopt.O

FilesystemCreateWithArgs defines the shlex splitted list of arguments to prepend to the command.

func FilesystemCreateWithQuota

func FilesystemCreateWithQuota(size *int64) funcopt.O

FilesystemCreateWithQuota Limits the amount of space a dataset and its descendents can consume. This property enforces a hard limit on the amount of space used. This includes all space consumed by descendents, including file systems and snapshots. Setting a quota on a descendent of a dataset that already has a quota does not override the ancestor's quota, but rather imposes an additional limit.

func FilesystemCreateWithRefQuota

func FilesystemCreateWithRefQuota(size *int64) funcopt.O

FilesystemCreateWithRefQuota Limits the amount of space a dataset can consume. This property enforces a hard limit on the amount of space used. This hard limit does not include space used by descendents, including file systems and snapshots.

func FilesystemCreateWithRefReservation

func FilesystemCreateWithRefReservation(size *int64) funcopt.O

FilesystemCreateWithRefReservation is the minimum amount of space guaranteed to a dataset, not including its descendents. When the amount of space used is below this value, the dataset is treated as if it were taking up the amount of space specified by refreservation. The refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations.

If refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset.

func FilesystemCreateWithReservation

func FilesystemCreateWithReservation(size *int64) funcopt.O

FilesystemCreateWithReservation is the minimum amount of space guaranteed to a dataset and its descendents. When the amount of space used is below this value, the dataset is treated as if it were taking up the amount of space specified by its reservation. Reservations are accounted for in the parent datasets' space used, and count against the parent datasets' quotas and reservations.

func FilesystemDestroyWithNode

func FilesystemDestroyWithNode(s string) funcopt.O

func FilesystemDestroyWithRecurse

func FilesystemDestroyWithRecurse(v bool) funcopt.O

FilesystemDestroyWithRecurse recursively destroys all clones of these snapshots, including the clones, snapshots, and children. If this flag is specified, the FilesystemDestroyWithTryImmediate flag will have no effect.

func FilesystemDestroyWithRemoveSnapshots

func FilesystemDestroyWithRemoveSnapshots(v bool) funcopt.O

FilesystemDestroyWithRemoveSnapshots forces an unmount of any file systems using the unmount -f command. This option has no effect on non-file systems or unmounted file systems. TODO: fix above doc ?

func FilesystemDestroyWithTryImmediate

func FilesystemDestroyWithTryImmediate(v bool) funcopt.O

FilesystemDestroyWithTryImmediate destroys immediately. If a snapshot cannot be destroyed now, mark it for deferred destruction.

func FilesystemMountWithOverlay

func FilesystemMountWithOverlay(v bool) funcopt.O

FilesystemMountWithOverlay performs an overlay mount. Allows mounting in non-empty mountpoint.

func FilesystemRenameWithNode

func FilesystemRenameWithNode(s string) funcopt.O

func FilesystemRenameWithRecurse

func FilesystemRenameWithRecurse(v bool) funcopt.O

FilesystemRenameWithRecurse recursively renames all datasets

func FilesystemSnapshotWithArgs

func FilesystemSnapshotWithArgs(l []string) funcopt.O

FilesystemSnapshotWithArgs defines the shlex splitted list of arguments to prepend to the command.

func FilesystemSnapshotWithRecursive

func FilesystemSnapshotWithRecursive(v bool) funcopt.O

func FilesystemUmountWithForce

func FilesystemUmountWithForce(v bool) funcopt.O

FilesystemUmountWithForce forcefully unmounts the file system, even if it is currently in use. This option is not supported on Linux.

func IsCapable

func IsCapable() bool

func ListWithLogger

func ListWithLogger(l *plog.Logger) funcopt.O

func ListWithNames

func ListWithNames(l ...string) funcopt.O

func ListWithOrderBy

func ListWithOrderBy(l ...string) funcopt.O

func ListWithOrderReverse

func ListWithOrderReverse() funcopt.O

func ListWithTypes

func ListWithTypes(l ...DatasetType) funcopt.O

func PoolCreateWithArgs

func PoolCreateWithArgs(l []string) funcopt.O

PoolCreateWithArgs defines the shlex splitted list of arguments to prepend to the command.

func PoolCreateWithVDevs

func PoolCreateWithVDevs(l []string) funcopt.O

PoolCreateWithVDevs defines the list of block devices paths to add to the pool.

func PoolDestroyWithForce

func PoolDestroyWithForce() funcopt.O

PoolDestroyWithForce forces any active datasets contained within the pool to be unmounted.

func PoolExportWithForce

func PoolExportWithForce() funcopt.O

PoolExportWithForce forcefully unmounts all datasets, using the unmount -f command. This option is not supported on Linux.

func PoolImportWithCacheFile

func PoolImportWithCacheFile(s string) funcopt.O

PoolImportWithCacheFile reads configuration from the given cachefile that was created with the cachefile pool property. This cachefile is used instead of searching for devices.

func PoolImportWithDevice

func PoolImportWithDevice(s string) funcopt.O

PoolImportWithDevice uses device or searches for devices or files in dir. PoolImportWithDevice can be specified multiple times. PoolImportWithDevice incompatible with PoolImportWithCacheFile.

func PoolImportWithForce

func PoolImportWithForce() funcopt.O

PoolImportWithForce forcefully unmounts all datasets, using the unmount -f command. This option is not supported on Linux.

func PoolImportWithOption

func PoolImportWithOption(option, value string) funcopt.O

PoolImportWithOption is a mount option to use when mounting datasets within the pool.

func PoolImportWithQuiet

func PoolImportWithQuiet() funcopt.O

PoolImportWithQuiet sets debug level for error and output logging

func PoolStatusWithVerbose

func PoolStatusWithVerbose() funcopt.O

PoolStatusWithVerbose displays verbose data error information, printing out a complete list of all data errors since the last complete pool scrub.

func VolCreateWithArgs

func VolCreateWithArgs(l []string) funcopt.O

VolCreateWithArgs defines the shlex splitted list of arguments to prepend to the command.

func VolCreateWithBlockSize

func VolCreateWithBlockSize(size uint64) funcopt.O

VolCreateWithBlockSize defines the block size of the volume in bytes

func VolCreateWithSize

func VolCreateWithSize(size uint64) funcopt.O

VolCreateWithSize defines the size of the volume in bytes

func VolDestroyWithBusyRetries

func VolDestroyWithBusyRetries(count int) funcopt.O

VolDestroyWithBusyRetries is the number of retries when the destroy command reports "busy".

func VolDestroyWithForce

func VolDestroyWithForce() funcopt.O

VolDestroyWithForce forces an unmount of any file systems using the unmount -f command. This option has no effect on non-file systems or unmounted file systems.

Types

type Dataset

type Dataset interface {
	GetName() string
	GetLog() *plog.Logger
}

type DatasetName

type DatasetName string

func (DatasetName) BaseName

func (t DatasetName) BaseName() string

BaseName returns the basename extracted from a <pool>/<basename> string.

func (DatasetName) PoolName

func (t DatasetName) PoolName() string

PoolName returns the pool name extracted from a <pool>/<basename> string.

func (DatasetName) String

func (t DatasetName) String() string

String implements the stringer interface.

type DatasetType

type DatasetType int32

func (DatasetType) String

func (t DatasetType) String() string

type DatasetTypes

type DatasetTypes []DatasetType

func (DatasetTypes) String

func (t DatasetTypes) String() string

type Filesystem

type Filesystem struct {
	Name string
	Log  *plog.Logger
}

func (Filesystem) BaseName

func (t Filesystem) BaseName() string

func (*Filesystem) Create

func (t *Filesystem) Create(fopts ...funcopt.O) error

func (*Filesystem) Destroy

func (t *Filesystem) Destroy(fopts ...funcopt.O) error

func (*Filesystem) Exists

func (t *Filesystem) Exists() (bool, error)

func (Filesystem) GetLog

func (t Filesystem) GetLog() *plog.Logger

func (Filesystem) GetName

func (t Filesystem) GetName() string

func (*Filesystem) GetProperty

func (t *Filesystem) GetProperty(prop string) (string, error)

GetProperty returns a dataset property value

func (*Filesystem) Mount

func (t *Filesystem) Mount(fopts ...funcopt.O) error

func (Filesystem) PoolName

func (t Filesystem) PoolName() string

func (*Filesystem) Rename

func (t *Filesystem) Rename(dst string, fopts ...funcopt.O) error

func (*Filesystem) SetProperty

func (t *Filesystem) SetProperty(prop, value string) error

SetProperty sets a dataset property value

func (*Filesystem) Snapshot

func (t *Filesystem) Snapshot(fopts ...funcopt.O) error

func (*Filesystem) SnapshotExists

func (t *Filesystem) SnapshotExists() (bool, error)

func (*Filesystem) Umount

func (t *Filesystem) Umount(fopts ...funcopt.O) error

type Filesystems

type Filesystems []Filesystem

func ListFilesystems

func ListFilesystems(fopts ...funcopt.O) (Filesystems, error)

type ListDatasetsOpts

type ListDatasetsOpts struct {
	Names        []string
	Types        DatasetTypes
	Log          *plog.Logger
	OrderBy      []string
	OrderReverse bool
}

type Pool

type Pool struct {
	Name      string
	Log       *plog.Logger
	LogPrefix string
}

func (*Pool) Create

func (t *Pool) Create(fopts ...funcopt.O) error

func (*Pool) Destroy

func (t *Pool) Destroy(fopts ...funcopt.O) error

func (*Pool) Exists

func (t *Pool) Exists() (bool, error)

func (*Pool) Export

func (t *Pool) Export(fopts ...funcopt.O) error

func (*Pool) GetProperty

func (t *Pool) GetProperty(prop string) (string, error)

GetProperty returns a dataset property value

func (*Pool) Import

func (t *Pool) Import(fopts ...funcopt.O) error

func (*Pool) ListVolumes

func (t *Pool) ListVolumes(fopts ...funcopt.O) (Vols, error)

func (*Pool) SetProperty

func (t *Pool) SetProperty(prop, value string) error

func (*Pool) Status

func (t *Pool) Status(fopts ...funcopt.O) (PoolStatusData, error)

func (*Pool) Usage

func (t *Pool) Usage(fopts ...funcopt.O) (PoolUsage, error)

func (*Pool) VDevDevices

func (t *Pool) VDevDevices() (device.L, error)

func (*Pool) VDevPaths

func (t *Pool) VDevPaths() ([]string, error)

type PoolStatusData

type PoolStatusData struct {
	State  string
	Errors string
	VDevs  poolStatusVDevs
}

type PoolUsage

type PoolUsage struct {
	Size  int64
	Alloc int64
	Free  int64
}

PoolUsage represents a parsed line of the df unix command

type Vol

type Vol struct {
	Name      string
	Size      uint64
	BlockSize uint64
	Log       *plog.Logger
}

func (Vol) BaseName

func (t Vol) BaseName() string

func (*Vol) Create

func (t *Vol) Create(fopts ...funcopt.O) error

func (*Vol) Destroy

func (t *Vol) Destroy(fopts ...funcopt.O) error

func (*Vol) Exists

func (t *Vol) Exists() (bool, error)

func (Vol) GetLog

func (t Vol) GetLog() *plog.Logger

func (Vol) GetName

func (t Vol) GetName() string

func (*Vol) GetProperty

func (t *Vol) GetProperty(prop string) (string, error)

GetProperty returns a dataset property value

func (Vol) PoolName

func (t Vol) PoolName() string

func (*Vol) SetProperty

func (t *Vol) SetProperty(prop, value string) error

SetProperty sets a dataset property value

type Vols

type Vols []Vol

func ListVolumes

func ListVolumes(fopts ...funcopt.O) (Vols, error)

func (Vols) Paths

func (t Vols) Paths() []string

Jump to

Keyboard shortcuts

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