Documentation ¶
Index ¶
- Constants
- Variables
- func TestHTTPZPool(testZPool, prefix, testFs string, fn func(server *httptest.Server))
- type Client
- func (c *Client) DatasetSnapshots(ctx context.Context, dataset string, extraProps []string) ([]zfs.Dataset, error)
- func (c *Client) ResumableSendToken(ctx context.Context, dataset string) (token string, curBytes uint64, err error)
- func (c *Client) ResumeSend(ctx context.Context, dataset, resumeToken string, options ResumeSendOptions) (SendResult, error)
- func (c *Client) Send(ctx context.Context, send SnapshotSendOptions) (SendResult, error)
- func (c *Client) Server() string
- func (c *Client) SetClient(client *http.Client)
- func (c *Client) SetFilesystemProperties(ctx context.Context, filesystem string, props SetProperties) error
- func (c *Client) SetHeader(name, value string)
- func (c *Client) SetSnapshotProperties(ctx context.Context, filesystem, snapshot string, props SetProperties) error
- type Config
- type HTTP
- type Permissions
- type ReceiveProperties
- type ResumeSendOptions
- type SendResult
- type SetProperties
- type SnapshotSendOptions
Constants ¶
const ( GETParamExtraProperties = "extraProps" GETParamResumable = "resumable" GETParamIncludeProperties = "includeProps" GETParamRaw = "raw" GETParamReceiveProperties = "receiveProps" GETParamBytesPerSecond = "bytesPerSecond" GETParamEnableDecompression = "enableDecompression" GETParamCompressionLevel = "compressionLevel" )
const ( HeaderResumeReceiveToken = "X-Receive-Resume-Token" HeaderResumeReceivedBytes = "X-Received-Bytes" )
Variables ¶
Functions ¶
func TestHTTPZPool ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the struct used to send requests to a zfs http server
func (*Client) DatasetSnapshots ¶
func (c *Client) DatasetSnapshots(ctx context.Context, dataset string, extraProps []string) ([]zfs.Dataset, error)
DatasetSnapshots requests the snapshots for a remote dataset
func (*Client) ResumableSendToken ¶
func (c *Client) ResumableSendToken(ctx context.Context, dataset string) (token string, curBytes uint64, err error)
ResumableSendToken requests the resume token for a remote dataset, if there is one
func (*Client) ResumeSend ¶
func (c *Client) ResumeSend(ctx context.Context, dataset, resumeToken string, options ResumeSendOptions) (SendResult, error)
ResumeSend resumes a send for a dataset given the resume token
func (*Client) Send ¶
func (c *Client) Send(ctx context.Context, send SnapshotSendOptions) (SendResult, error)
Send sends the snapshot job to the remote server
func (*Client) SetFilesystemProperties ¶
func (c *Client) SetFilesystemProperties(ctx context.Context, filesystem string, props SetProperties) error
SetFilesystemProperties sets and/or unsets properties on the remote zfs filesystem
func (*Client) SetSnapshotProperties ¶
func (c *Client) SetSnapshotProperties(ctx context.Context, filesystem, snapshot string, props SetProperties) error
SetSnapshotProperties sets and/or unsets properties on the remote zfs snapshot
type Config ¶
type Config struct { HTTPPathPrefix string `json:"HTTPPathPrefix" yaml:"HTTPPathPrefix"` ParentDataset string `json:"ParentDataset" yaml:"ParentDataset"` SpeedBytesPerSecond int64 `json:"SpeedBytesPerSecond" yaml:"SpeedBytesPerSecond"` Permissions Permissions `json:"Permissions" yaml:"Permissions"` }
Config specifies the configuration for the zfs http server
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults sets all config values to their defaults (if they have one)
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP is the main object for serving the ZFS HTTP server
type Permissions ¶
type Permissions struct { AllowSpeedOverride bool `json:"AllowSpeedOverride" yaml:"AllowSpeedOverride"` AllowNonRaw bool `json:"AllowNonRaw" yaml:"AllowNonRaw"` AllowIncludeProperties bool `json:"AllowIncludeProperties" yaml:"AllowIncludeProperties"` AllowDestroyFilesystems bool `json:"AllowDestroyFilesystems" yaml:"AllowDestroyFilesystems"` AllowDestroySnapshots bool `json:"AllowDestroySnapshots" yaml:"AllowDestroySnapshots"` }
Permissions specifies permissions for requests over zfs http
type ReceiveProperties ¶
func DecodeReceiveProperties ¶
func DecodeReceiveProperties(in string) (ReceiveProperties, error)
DecodeReceiveProperties decodes receive properties from an URL GET parameter
func (ReceiveProperties) Encode ¶
func (r ReceiveProperties) Encode() string
Encode encodes a set of ReceiveProperties
type ResumeSendOptions ¶
type ResumeSendOptions struct { zfs.ResumeSendOptions // ProgressFn: Set a callback function to receive updates about progress ProgressFn zfs.ProgressCallback // ProgressEvery determines progress update interval ProgressEvery time.Duration }
ResumeSendOptions is a struct for a resume of a send job to a remote server using a Client
type SendResult ¶
SendResult contains some statistics from the sending of a snapshot
type SetProperties ¶
type SetProperties struct { Set map[string]string `json:"set,omitempty"` Unset []string `json:"unset,omitempty"` }
SetProperties is used by the http api to set and unset zfs properties remotely
type SnapshotSendOptions ¶
type SnapshotSendOptions struct { zfs.SendOptions // Which dataset to send to DatasetName string // Which snapshot to send to (optional) SnapshotName string // The snapshot to send Snapshot *zfs.Dataset // Resumable determines whether the stream can be resumed Resumable bool Properties ReceiveProperties // ProgressFn: Set a callback function to receive updates about progress ProgressFn zfs.ProgressCallback // ProgressEvery determines progress update interval ProgressEvery time.Duration }
SnapshotSendOptions is a struct for a send job to a remote server using a Client