Documentation ¶
Overview ¶
Package zfs provides an interface to work with ZFS.
Index ¶
- Constants
- func PoolMappings(runner runners.Runner, mountDir, preSnapshotSuffix string) (map[string]string, error)
- func RollbackSnapshot(r runners.Runner, pool string, snapshot string) error
- type Config
- type EmptyPoolError
- type ListEntry
- type Manager
- func (m *Manager) CleanupSnapshots(retentionLimit int) ([]string, error)
- func (m *Manager) CreateClone(cloneName, snapshotID string) error
- func (m *Manager) CreateSnapshot(poolSuffix, dataStateAt string) (string, error)
- func (m *Manager) DestroyClone(cloneName string) error
- func (m *Manager) DestroySnapshot(snapshotName string) error
- func (m *Manager) GetFilesystemState() (models.FileSystem, error)
- func (m *Manager) GetSessionState(name string) (*resources.SessionState, error)
- func (m *Manager) GetSnapshots() ([]resources.Snapshot, error)
- func (m *Manager) ListClonesNames() ([]string, error)
- func (m *Manager) Pool() *resources.Pool
Constants ¶
const (
// PoolMode defines the zfs filesystem name.
PoolMode = "zfs"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EmptyPoolError ¶
type EmptyPoolError struct {
// contains filtered or unexported fields
}
EmptyPoolError defines an error when storage pool has no available elements.
func NewEmptyPoolError ¶
func NewEmptyPoolError(dsType dsType, pool string) *EmptyPoolError
NewEmptyPoolError creates a new EmptyPoolError.
func (*EmptyPoolError) Error ¶
func (e *EmptyPoolError) Error() string
Error prints a message describing EmptyPoolError.
type ListEntry ¶
type ListEntry struct { Name string // Read-only property that identifies the amount of disk space consumed // by a dataset and all its descendents. Used uint64 // Controls the mount point used for this file system. When the mountpoint // property is changed for a file system, the file system and // any descendents that inherit the mount point are unmounted. // If the new value is legacy, then they remain unmounted. Otherwise, // they are automatically remounted in a new location if the property // was previously legacy or none, or if they were mounted before // the property was changed. In addition, any shared file systems are // unshared and shared in the new location. MountPoint string // Read-only property that identifies the compression ratio achieved for // a dataset, expressed as a multiplier. Compression can be enabled by the // zfs set compression=on dataset command. // The value is calculated from the logical size of all files and // the amount of referenced physical data. It includes explicit savings // through the use of the compression property. CompressRatio float64 // Read-only property that identifies the amount of disk space available // to a file system and all its children, assuming no other activity in // the pool. Because disk space is shared within a pool, available space // can be limited by various factors including physical pool size, quotas, // reservations, and other datasets within the pool. Available uint64 // Read-only property that identifies the dataset type as filesystem // (file system or clone), volume, or snapshot. Type string // Read-only property for cloned file systems or volumes that identifies // the snapshot from which the clone was created. The origin cannot be // destroyed (even with the –r or –f option) as long as a clone exists. // Non-cloned file systems have an origin of none. Origin string // Read-only property that identifies the date and time that a dataset // was created. Creation time.Time // The amount of data that is accessible by this dataset, which may // or may not be shared with other datasets in the pool. When a snapshot // or clone is created, it initially references the same amount of space // as the file system or snapshot it was created from, since its contents // are identical. Referenced uint64 // The amount of space that is "logically" accessible by this dataset. // See the referenced property. The logical space ignores the effect // of the compression and copies properties, giving a quantity closer // to the amount of data that applications see. However, it does include // space consumed by metadata. LogicalReferenced uint64 // The amount of space that is "logically" consumed by this dataset // and all its descendents. See the used property. The logical space // ignores the effect of the compression and copies properties, giving // a quantity closer to the amount of data that applications see. However, // it does include space consumed by metadata. LogicalUsed uint64 // The amount of space consumed by snapshots of this dataset. // In particular, it is the amount of space that would be freed // if all of this dataset's snapshots were destroyed. // Note that this is not simply the sum of the snapshots' used properties // because space can be shared by multiple snapshots. UsedBySnapshots uint64 // The amount of space used by children of this dataset, // which would be freed if all the dataset's children were destroyed. UsedByChildren uint64 // Data state timestamp. DataStateAt time.Time }
ListEntry defines entry of ZFS list command.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager describes a filesystem manager for ZFS.
func NewFSManager ¶
NewFSManager creates a new Manager instance for ZFS.
func (*Manager) CleanupSnapshots ¶
CleanupSnapshots destroys old snapshots considering retention limit and related clones.
func (*Manager) CreateClone ¶
CreateClone creates a new ZFS clone.
func (*Manager) CreateSnapshot ¶
CreateSnapshot creates a new snapshot.
func (*Manager) DestroyClone ¶
DestroyClone destroys a ZFS clone.
func (*Manager) DestroySnapshot ¶
DestroySnapshot destroys the snapshot.
func (*Manager) GetFilesystemState ¶
func (m *Manager) GetFilesystemState() (models.FileSystem, error)
GetFilesystemState returns a disk state.
func (*Manager) GetSessionState ¶
func (m *Manager) GetSessionState(name string) (*resources.SessionState, error)
GetSessionState returns a state of a session.
func (*Manager) GetSnapshots ¶
GetSnapshots returns a snapshot list.
func (*Manager) ListClonesNames ¶
ListClonesNames lists ZFS clones.