libzfs

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PoolPropAltroot ZFS Pool property
	PoolPropAltroot = golibzfs.PoolPropAltroot
	// PoolNumProps is the end pool number property
	PoolNumProps = golibzfs.PoolNumProps
	// VDevTypeFile is the vdevtype on file
	VDevTypeFile = golibzfs.VDevTypeFile
	// DatasetTypeFilesystem - file system dataset
	DatasetTypeFilesystem = golibzfs.DatasetTypeFilesystem
	// DatasetTypeSnapshot - snapshot of dataset
	DatasetTypeSnapshot = golibzfs.DatasetTypeSnapshot
	// DatasetTypeVolume - volume (virtual block device) dataset
	DatasetTypeVolume = golibzfs.DatasetTypeVolume
	// DatasetTypeBookmark - bookmark dataset
	DatasetTypeBookmark = golibzfs.DatasetTypeBookmark
	// DatasetPropName is the name of the dataset
	DatasetPropName = golibzfs.DatasetPropName
	// DatasetPropCanmount is the canmount property of the dataset
	DatasetPropCanmount = golibzfs.DatasetPropCanmount
	// DatasetPropMountpoint is the mountpoint of the dataset
	DatasetPropMountpoint = golibzfs.DatasetPropMountpoint
	// DatasetPropOrigin is the origin of the dataset
	DatasetPropOrigin = golibzfs.DatasetPropOrigin
	// DatasetPropMounted is the mounted property for the dataset
	DatasetPropMounted = golibzfs.DatasetPropMounted
	// DatasetPropCreation is the creation time property for the dataset
	DatasetPropCreation = golibzfs.DatasetPropCreation
)
View Source
const (

	// BootfsProp string value
	BootfsProp = zsysPrefix + "bootfs"
	// LastUsedProp string value
	LastUsedProp = zsysPrefix + "last-used"
	// BootfsDatasetsProp string value
	BootfsDatasetsProp = zsysPrefix + "bootfs-datasets"
	// LastBootedKernelProp string value
	LastBootedKernelProp = zsysPrefix + "last-booted-kernel"
	// CanmountProp string value
	CanmountProp = "canmount"
	// SnapshotCanmountProp is the equivalent to CanmountProp, but as a user property to store on zsys snapshot
	SnapshotCanmountProp = zsysPrefix + CanmountProp
	// MountPointProp string value
	MountPointProp = "mountpoint"
	// SnapshotMountpointProp is the equivalent to MountPointProp, but as a user property to store on zsys snapshot
	SnapshotMountpointProp = zsysPrefix + MountPointProp
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

Adapter is an accessor to real system zfs libraries.

func (*Adapter) DatasetCreate

func (*Adapter) DatasetCreate(path string, dtype DatasetType, props map[Prop]Property) (DZFSInterface, error)

DatasetCreate creates a dataset

func (Adapter) DatasetOpen

func (Adapter) DatasetOpen(name string) (DZFSInterface, error)

DatasetOpen opens a dataset

func (Adapter) DatasetOpenAll

func (l Adapter) DatasetOpenAll() (datasets []DZFSInterface, err error)

DatasetOpenAll opens all the dataset recursively

func (*Adapter) DatasetSnapshot

func (*Adapter) DatasetSnapshot(path string, recur bool, props map[Prop]Property) (DZFSInterface, error)

DatasetSnapshot creates a snapshot

func (*Adapter) GenerateID

func (*Adapter) GenerateID(length int) string

GenerateID with n ascii or digits, lowercase, characters

func (Adapter) PoolCreate

func (Adapter) PoolCreate(name string, vdev VDevTree, features map[string]string, props PoolProperties, fsprops DatasetProperties) (pool Pool, err error)

PoolCreate creates a zfs pool

func (Adapter) PoolOpen

func (Adapter) PoolOpen(name string) (pool Pool, err error)

PoolOpen opens given pool

type DZFSInterface

type DZFSInterface interface {
	DZFSChildren() *[]Dataset
	Children() []DZFSInterface
	Clone(target string, props map[Prop]Property) (rd DZFSInterface, err error)
	Clones() (clones []string, err error)
	Close()
	Destroy(Defer bool) (err error)
	GetUserProperty(p string) (prop Property, err error)
	IsSnapshot() (ok bool)
	Pool() (p Pool, err error)
	Promote() (err error)
	Properties() *map[Prop]Property
	ReloadProperties() (err error)
	SetUserProperty(prop, value string) error
	SetProperty(p Prop, value string) error
	Type() DatasetType
}

DZFSInterface is the interface to use real libzfs Dataset object or in memory mock.

type Dataset

type Dataset = golibzfs.Dataset

Dataset - ZFS dataset object

type DatasetProperties

type DatasetProperties = golibzfs.DatasetProperties

DatasetProperties type is map of dataset or volume properties prop -> value

type DatasetType

type DatasetType = golibzfs.DatasetType

DatasetType defines enum of dataset types

type Interface

type Interface interface {
	DatasetOpenAll() (datasets []DZFSInterface, err error)
	DatasetOpen(name string) (d DZFSInterface, err error)
	DatasetCreate(path string, dtype DatasetType, props map[Prop]Property) (d DZFSInterface, err error)
	DatasetSnapshot(path string, recur bool, props map[Prop]Property) (rd DZFSInterface, err error)
	GenerateID(length int) string
}

Interface is the interface to use real libzfs or our in memory mock.

type Pool

type Pool = golibzfs.Pool

Pool object represents handler to single ZFS pool Pool.Properties map[string]Property Map of all ZFS pool properties, changing any of this will not affect ZFS pool, for that use SetProperty( name, value string) method of the pool object.

type PoolProperties

type PoolProperties = golibzfs.PoolProperties

PoolProperties type is map of pool properties name -> value

type Prop

type Prop = golibzfs.Prop

Prop type to enumerate all different properties supported by ZFS

type Property

type Property = golibzfs.Property

Property ZFS pool or dataset property value

type VDevTree

type VDevTree = golibzfs.VDevTree

VDevTree ZFS virtual device tree

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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