const DatasetFilesystem … const DatasetSnapshot … const DatasetVolume … type Dataset … type InodeType … const _ … const BlockDevice … const CharacterDevice … const Directory … const Door … const NamedPipe … const SymbolicLink … const EventPort … const Socket … const File … type ChangeType … const _ … const Removed … const Created … const Modified … const Renamed … type DestroyFlag … const DestroyDefault … const DestroyRecursive … const DestroyRecursiveClones … const DestroyDeferDeletion … const DestroyForceUmount … type InodeChange … type Logger … type defaultLogger … func (*defaultLogger) Log(cmd []string) { … } var logger … // SetLogger set a log handler to log all commands including arguments before // they are executed func SetLogger(l Logger) { … } // zfs is a helper function to wrap typical calls to zfs. func zfs(arg ...string) ([][]string, error) { … } // Datasets returns a slice of ZFS datasets, regardless of type. // A filter argument may be passed to select a dataset with the matching name, // or empty string ("") may be used to select all datasets. func Datasets(filter string) ([]*Dataset, error) { … } // 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 Snapshots(filter string) ([]*Dataset, 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 Filesystems(filter string) ([]*Dataset, error) { … } // Volumes returns a slice of ZFS volumes. // A filter argument may be passed to select a volume with the matching name, // or empty string ("") may be used to select all volumes. func Volumes(filter string) ([]*Dataset, error) { … } // GetDataset retrieves a single ZFS dataset by name. This dataset could be // any valid ZFS dataset type, such as a clone, filesystem, snapshot, or volume. func GetDataset(name string) (*Dataset, error) { … } // Clone clones a ZFS snapshot and returns a clone dataset. // An error will be returned if the input dataset is not of snapshot type. func (d *Dataset) Clone(dest string, properties map[string]string) (*Dataset, error) { … } // Unmount unmounts currently mounted ZFS file systems. func (d *Dataset) Unmount(force bool) (*Dataset, error) { … } // Mount mounts ZFS file systems. func (d *Dataset) Mount(overlay bool, options []string) (*Dataset, error) { … } // 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 ReceiveSnapshot(input io.Reader, name string) (*Dataset, error) { … } // SendSnapshot 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 (d *Dataset) SendSnapshot(output io.Writer) error { … } // CreateVolume creates a new ZFS volume with the specified name, size, and // properties. // A full list of available ZFS properties may be found here: // https://www.freebsd.org/cgi/man.cgi?zfs(8). func CreateVolume(name string, size uint64, properties map[string]string) (*Dataset, 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 (d *Dataset) Destroy(flags DestroyFlag) 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 (d *Dataset) SetProperty(key, val string) error { … } // 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 (d *Dataset) GetProperty(key string) (string, error) { … } // Rename renames a dataset. func (d *Dataset) Rename(name string, createParent bool, recursiveRenameSnapshots bool) (*Dataset, error) { … } // Snapshots returns a slice of all ZFS snapshots of a given dataset. func (d *Dataset) Snapshots() ([]*Dataset, 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 CreateFilesystem(name string, properties map[string]string) (*Dataset, error) { … } // 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 (d *Dataset) Snapshot(name string, recursive bool) (*Dataset, error) { … } // Rollback rolls back the receiving ZFS dataset to a previous snapshot. // Optionally, intermediate snapshots can be destroyed. A ZFS snapshot // rollback cannot be completed without this option, if more recent // snapshots exist. // An error will be returned if the input dataset is not of snapshot type. func (d *Dataset) Rollback(destroyMoreRecent bool) error { … } // Children returns a slice of children of the receiving ZFS dataset. // A recursion depth may be specified, or a depth of 0 allows unlimited // recursion. func (d *Dataset) Children(depth uint64) ([]*Dataset, error) { … } // Diff returns changes between a snapshot and the given ZFS dataset. // The snapshot name must include the filesystem part as it is possible to // compare clones with their origin snapshots. func (d *Dataset) Diff(snapshot string) ([]*InodeChange, error) { … }