api

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Action added in v0.3.0

func Action(w http.ResponseWriter, r *http.Request)

Action is a catchall for additional driver functions.

func LogHandler added in v0.3.0

func LogHandler(name string, debug bool, actionFunc func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

LogHandler injects a request logging handler if debugging is active. In either event it will dispatch.

func RESTHTTPError

func RESTHTTPError(w http.ResponseWriter, err error)

RESTHTTPError returns a 500 status with the error.

Types

type API

type API struct {
	Volplugin
	Hostname string
	Client   *config.Client
	Global   **config.Global // double pointer so we can track watch updates
	Lock     *lock.Driver

	MountCounter    *mount.Counter
	MountCollection *mount.Collection
	// contains filtered or unexported fields
}

API is a typed representation of API handlers.

func NewAPI

func NewAPI(volplugin Volplugin, hostname string, client *config.Client, global **config.Global) *API

NewAPI returns an *API

func (*API) AddStopChan added in v0.3.0

func (a *API) AddStopChan(name string, stopChan chan struct{})

AddStopChan adds a stop channel for the purposes of controlling mount ttl refresh goroutines

func (*API) Create

func (a *API) Create(w http.ResponseWriter, r *http.Request)

Create fully creates a volume

func (*API) Get added in v0.3.0

func (a *API) Get(w http.ResponseWriter, r *http.Request)

Get is the request to obtain information about a volume.

func (*API) GetStorageParameters added in v0.3.0

func (a *API) GetStorageParameters(uc *Volume) (storage.MountDriver, *config.Volume, storage.DriverOptions, error)

GetStorageParameters accepts a Volume API request and turns it into several internal structs.

func (*API) List added in v0.3.0

func (a *API) List(w http.ResponseWriter, r *http.Request)

List is the request to obtain a list of the volumes.

func (*API) Mount added in v0.3.0

func (a *API) Mount(w http.ResponseWriter, r *http.Request)

Mount is the request to mount a volume.

func (*API) Path added in v0.3.0

func (a *API) Path(w http.ResponseWriter, r *http.Request)

Path is the handler for both Path and Remove requests. We do not honor remove requests; they can be done with volcli.

func (*API) RemoveStopChan added in v0.3.0

func (a *API) RemoveStopChan(name string)

RemoveStopChan removes a stop channel for the purposes of controlling mount ttl refresh goroutines

func (*API) Unmount added in v0.3.0

func (a *API) Unmount(w http.ResponseWriter, r *http.Request)

Unmount is the request to unmount a volume.

type HTTP added in v0.3.0

type HTTP interface {
	Router(*API) *mux.Router
	HTTPError(http.ResponseWriter, error) // note that it is expected that anything that calls this returns immediately afterwards.
}

HTTP is a generic interface to HTTP calls. Used by the other interfaces.

type Volplugin added in v0.3.0

type Volplugin interface {
	HTTP
	ReadCreate(*http.Request) (*config.VolumeRequest, error)
	WriteCreate(*config.Volume, http.ResponseWriter) error
	ReadGet(*http.Request) (string, error)
	WriteGet(string, string, http.ResponseWriter) error
	ReadPath(*http.Request) (string, error)
	WritePath(string, http.ResponseWriter) error
	WriteList([]string, http.ResponseWriter) error
	ReadMount(*http.Request) (*Volume, error)
	WriteMount(string, http.ResponseWriter) error
}

Volplugin is the interface that volplugin needs to provide to the clients (docker/k8s/mesos).

type Volume

type Volume struct {
	Mountpoint string
	Policy     string
	Name       string
	Options    map[string]string
}

Volume abstracts the notion of a volume as it is received from the plugins. It is used heavily by the interfaces.

func (*Volume) String added in v0.3.0

func (v *Volume) String() string

Directories

Path Synopsis
impl
internals

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL