Documentation ¶
Index ¶
- func IsDatasetBusyError(e error) bool
- func IsDatasetHasChildrenError(e error) bool
- func NewProvider(config *ProviderConfig) (volume.Provider, error)
- type Logger
- type MakeDev
- type Provider
- func (b *Provider) CreateSnapshot(vol volume.Volume) (volume.Volume, error)
- func (b *Provider) DestroyVolume(vol volume.Volume) error
- func (b *Provider) ForkVolume(vol volume.Volume) (volume.Volume, error)
- func (b Provider) Kind() string
- func (b *Provider) ListHaves(vol volume.Volume) ([]json.RawMessage, error)
- func (b *Provider) MarshalGlobalState() (json.RawMessage, error)
- func (b *Provider) MarshalVolumeState(volumeID string) (json.RawMessage, error)
- func (b *Provider) NewVolume() (volume.Volume, error)
- func (b *Provider) ReceiveSnapshot(vol volume.Volume, input io.Reader) (volume.Volume, error)
- func (b *Provider) RestoreVolumeState(volInfo *volume.Info, data json.RawMessage) (volume.Volume, error)
- func (b *Provider) SendSnapshot(vol volume.Volume, haves []json.RawMessage, output io.Writer) error
- type ProviderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDatasetBusyError ¶
"dataset is busy" errors from ZFS typically indicate that there are open files in that dataset mount.
func IsDatasetHasChildrenError ¶
"has children" errors from ZFS occur when removing a volume that has snapshots. ZFS requires snapshots of a volume to be deleted first.
func NewProvider ¶
func NewProvider(config *ProviderConfig) (volume.Provider, error)
Types ¶
type MakeDev ¶
Describes parameters for creating a zpool.
Currently this only supports file-type vdevs; be aware that these are convenient, but may have limited performance. Advanced users should consider configuring a zpool using block devices directly, and specifing use of datasets in those zpools those rather than this fallback mechanism.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) CreateSnapshot ¶
func (*Provider) ForkVolume ¶
func (*Provider) ListHaves ¶
Returns the set of snapshot UIDs available in this volume's backing dataset.
func (*Provider) MarshalGlobalState ¶
func (b *Provider) MarshalGlobalState() (json.RawMessage, error)
func (*Provider) MarshalVolumeState ¶
func (b *Provider) MarshalVolumeState(volumeID string) (json.RawMessage, error)
func (*Provider) ReceiveSnapshot ¶
ReceiveSnapshot both accepts a snapshotted filesystem as a byte stream, and applies that state to the given `vol` (i.e., if this were git, it's like `git fetch && git pull` at the same time; regretably, it's pretty hard to get zfs to separate those operations). If there are local working changes in the volume, they will be overwritten.
In addition to the given volume being mutated on disk, a reference to the new snapshot will be returned (this can be used for cleanup, though be aware that with zfs, removing snapshots may impact the ability to use incremental deltas when receiving future snapshots).
Also note that ZFS is *extremely* picky about receiving snapshots; in addition to obvious failure modes like an incremental snapshot with insufficient data, the following complications apply: - Sending an incremental snapshot with too much history will fail. - Sending a full snapshot to a volume with any other snapshots will fail. In the former case, you can renegociate; in the latter, you will have to either *destroy snapshots* or make a new volume.
func (*Provider) RestoreVolumeState ¶
func (*Provider) SendSnapshot ¶
type ProviderConfig ¶
type ProviderConfig struct { // DatasetName specifies the zfs dataset this provider will create volumes under. // // If it doesn't specify an existing dataset, and `MakeDev` parameters have // been provided, those will be followed to create a zpool; otherwise // provider creation will fail. DatasetName string `json:"dataset"` Make *MakeDev `json:"makedev,omitempty"` // WorkingDir specifies the working directory zfs will use to expose mounts. // A default will be chosen if left blank. WorkingDir string `json:"working_dir"` }
Describes zfs config used at provider setup time.
`volume.ProviderSpec.Config` is deserialized to this for zfs.
Also is the output of `MarshalGlobalState`.