Documentation
¶
Overview ¶
Package provisionclient is how `fileshare serve` talks to `fileshare provisioner`: a unix socket, typed calls, and nothing that could carry a path. See proto/fileshare/provision/v1/provision.proto for what each call promises, and the status codes it answers with.
Index ¶
- type Client
- func (c *Client) Capabilities(ctx context.Context) (*provisionv1.GetCapabilitiesResponse, error)
- func (c *Client) Close() error
- func (c *Client) Conn() *grpc.ClientConn
- func (c *Client) Create(ctx context.Context, parent, name string, quota uint64) (v *provisionv1.Volume, created bool, err error)
- func (c *Client) Delete(ctx context.Context, parent, name string, destroyData bool) (deleted bool, err error)
- func (c *Client) Get(ctx context.Context, parent, name string) (*provisionv1.Volume, error)
- func (c *Client) List(ctx context.Context, parent string) ([]*provisionv1.Volume, error)
- func (c *Client) Resize(ctx context.Context, parent, name string, quota uint64) (*provisionv1.Volume, error)
- func (c *Client) Snapshot(ctx context.Context, parent, name, snapshot string) (v *provisionv1.Volume, created bool, err error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to a provisioner. It is safe for concurrent use; the provisioner serializes the changes itself.
func Dial ¶
Dial prepares a connection to the provisioner on socket, which is "unix:///path" or an absolute path. Like grpc.NewClient it does not connect: the first call does, and fails if nothing answers.
func (*Client) Capabilities ¶
func (c *Client) Capabilities(ctx context.Context) (*provisionv1.GetCapabilitiesResponse, error)
Capabilities lists the parents and the limits.
func (*Client) Conn ¶
func (c *Client) Conn() *grpc.ClientConn
Conn is the underlying connection, for a caller that needs the raw service -- or, in a test, a method the provisioner does not have.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, parent, name string, quota uint64) (v *provisionv1.Volume, created bool, err error)
Create creates parent/name with quota bytes, or answers with the volume that exists with that quota already (created false).
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, parent, name string, destroyData bool) (deleted bool, err error)
Delete deletes a volume; deleted is false when there was none. Without destroyData a volume holding data or snapshots is refused.
type Option ¶
type Option func(*options)
An Option changes how Dial connects.
func ServerUID ¶
ServerUID refuses a socket where something other than uid answers. A provisioner normally runs as root, and the socket's directory is root's; this is the check that does not depend on either.
func WithDialOption ¶
func WithDialOption(d grpc.DialOption) Option
WithDialOption passes a gRPC dial option through, for the tests.