Documentation ¶
Overview ¶
Package zfs provides wrappers around the ZFS command line tools.
Package zfs provides wrappers around the ZFS command line tools.
Index ¶
- Constants
- type CloneOptions
- type CreateFilesystemOptions
- type DestroyFlag
- type Filesystem
- func (d *Filesystem) Children(ctx context.Context) ([]*Filesystem, error)
- func (d *Filesystem) Destroy(ctx context.Context, flags DestroyFlag) error
- func (d *Filesystem) GetProperty(ctx context.Context, key string) (string, bool, error)
- func (d *Filesystem) LoadKey(ctx context.Context, password string) error
- func (d *Filesystem) Mount(ctx context.Context) error
- func (d *Filesystem) SetProperty(ctx context.Context, key, val string) error
- func (d *Filesystem) Snapshot(ctx context.Context, name string) (*Snapshot, error)
- func (d *Filesystem) Snapshots(ctx context.Context) ([]*Snapshot, error)
- func (d *Filesystem) UnloadKey(ctx context.Context) error
- func (d *Filesystem) Unmount(ctx context.Context) error
- type Info
- type Pool
- type SendOptions
- type Snapshot
- func (d *Snapshot) Clone(ctx context.Context, dest string, options CloneOptions) (*Filesystem, error)
- func (d *Snapshot) Destroy(ctx context.Context, flags DestroyFlag) error
- func (d *Snapshot) GetProperty(ctx context.Context, key string) (string, bool, error)
- func (d *Snapshot) Hold(ctx context.Context, tag string) error
- func (d *Snapshot) Holds(ctx context.Context) ([]string, error)
- func (d *Snapshot) Release(ctx context.Context, tag string) error
- func (d *Snapshot) Rollback(ctx context.Context) error
- func (d *Snapshot) Send(ctx context.Context, options SendOptions, output io.WriteCloser) error
- func (d *Snapshot) SetProperty(ctx context.Context, key, val string) error
Constants ¶
const ( DestroyDefault DestroyFlag = 1 << iota DestroyRecursive = 1 << iota DestroyRecursiveClones = 1 << iota DestroyDeferDeletion = 1 << iota DestroyForceUmount = 1 << iota )
Valid destroy options
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloneOptions ¶ added in v3.1.0
CloneOptions stores options passed to Clone method
type CreateFilesystemOptions ¶ added in v3.1.0
CreateFilesystemOptions stores options passed to CreateFilesystem function
type Filesystem ¶
type Filesystem struct {
Info Info
}
Filesystem is a ZFS filesystem
func CreateFilesystem ¶
func CreateFilesystem(ctx context.Context, name string, options CreateFilesystemOptions) (*Filesystem, error)
CreateFilesystem creates a new ZFS filesystem with the specified name and properties. A full list of available ZFS properties may be found here: https://www.freebsd.org/cgi/man.cgi?zfs(8).
func Filesystems ¶
func Filesystems(ctx context.Context) ([]*Filesystem, error)
Filesystems returns a slice of ZFS filesystems. A filter argument may be passed to select a filesystem with the matching name, or empty string ("") may be used to select all filesystems.
func GetFilesystem ¶
func GetFilesystem(ctx context.Context, name string) (*Filesystem, error)
GetFilesystem retrieves a single ZFS filesystem by name
func (*Filesystem) Children ¶
func (d *Filesystem) Children(ctx context.Context) ([]*Filesystem, error)
Children returns a slice of children of the receiving ZFS dataset.
func (*Filesystem) Destroy ¶
func (d *Filesystem) Destroy(ctx context.Context, flags DestroyFlag) error
Destroy destroys a ZFS dataset. If the destroy bit flag is set, any descendents of the dataset will be recursively destroyed, including snapshots. If the deferred bit flag is set, the snapshot is marked for deferred deletion.
func (*Filesystem) GetProperty ¶
GetProperty returns the current value of a ZFS property from the receiving dataset. A full list of available ZFS properties may be found here: https://www.freebsd.org/cgi/man.cgi?zfs(8).
func (*Filesystem) LoadKey ¶
func (d *Filesystem) LoadKey(ctx context.Context, password string) error
LoadKey loads encryption key for dataset
func (*Filesystem) Mount ¶
func (d *Filesystem) Mount(ctx context.Context) error
Mount mounts ZFS filesystem
func (*Filesystem) SetProperty ¶
func (d *Filesystem) SetProperty(ctx context.Context, key, val string) error
SetProperty sets a ZFS property on the receiving dataset. A full list of available ZFS properties may be found here: https://www.freebsd.org/cgi/man.cgi?zfs(8).
func (*Filesystem) Snapshot ¶
Snapshot creates a new ZFS snapshot of the receiving dataset, using the specified name. Optionally, the snapshot can be taken recursively, creating snapshots of all descendent filesystems in a single, atomic operation.
func (*Filesystem) Snapshots ¶
func (d *Filesystem) Snapshots(ctx context.Context) ([]*Snapshot, error)
Snapshots returns a slice of all ZFS snapshots of a given dataset.
type Info ¶
type Info struct { Name string Origin string Used uint64 Avail uint64 Mountpoint string Compression string Written uint64 Volsize uint64 Logicalused uint64 Usedbydataset uint64 Quota uint64 Referenced uint64 }
Info contains dataset info
type Pool ¶ added in v3.0.2
type Pool struct {
Name string
}
Pool represents ZPool
func ImportPool ¶ added in v3.0.2
ImportPool imports ZPool
type SendOptions ¶ added in v3.1.0
SendOptions is the set of options available for Send command
type Snapshot ¶
type Snapshot struct {
Info Info
}
Snapshot is a ZFS snapshot
func GetSnapshot ¶
GetSnapshot retrieves a single ZFS snapshot by name
func ReceiveSnapshot ¶
ReceiveSnapshot receives a ZFS stream from the input io.Reader, creates a new snapshot with the specified name, and streams the input data into the newly-created snapshot.
func Snapshots ¶
Snapshots returns a slice of ZFS snapshots. A filter argument may be passed to select a snapshot with the matching name, or empty string ("") may be used to select all snapshots.
func (*Snapshot) Clone ¶
func (d *Snapshot) Clone(ctx context.Context, dest string, options CloneOptions) (*Filesystem, error)
Clone clones a ZFS snapshot and returns the cloned filesystem. An error will be returned if the input dataset is not of snapshot type.
func (*Snapshot) Destroy ¶
func (d *Snapshot) Destroy(ctx context.Context, flags DestroyFlag) error
Destroy destroys a ZFS dataset. If the destroy bit flag is set, any descendents of the dataset will be recursively destroyed, including snapshots. If the deferred bit flag is set, the snapshot is marked for deferred deletion.
func (*Snapshot) GetProperty ¶
GetProperty returns the current value of a ZFS property from the receiving dataset. A full list of available ZFS properties may be found here: https://www.freebsd.org/cgi/man.cgi?zfs(8).
func (*Snapshot) Rollback ¶
Rollback rolls back the receiving ZFS filesystem to a previous snapshot. Intermediate snapshots can be destroyed.
func (*Snapshot) Send ¶
func (d *Snapshot) Send(ctx context.Context, options SendOptions, output io.WriteCloser) error
Send sends a ZFS stream of a snapshot to the input io.Writer. An error will be returned if the input dataset is not of snapshot type.
func (*Snapshot) SetProperty ¶
SetProperty sets a ZFS property on the receiving dataset. A full list of available ZFS properties may be found here: https://www.freebsd.org/cgi/man.cgi?zfs(8).