package flocker
import "k8s.io/kubernetes/Godeps/_workspace/src/github.com/ClusterHQ/flocker-go"
flocker package allows you to easily interact with a Flocker Control Service.
Index ¶
- type Client
- func NewClient(host string, port int, clientIP string, caCertPath, keyPath, certPath string) (*Client, error)
- func (c Client) CreateDataset(metaName string) (*DatasetState, error)
- func (c Client) GetDatasetID(metaName string) (datasetID string, err error)
- func (c Client) GetDatasetState(datasetID string) (*DatasetState, error)
- func (c Client) GetPrimaryUUID() (uuid string, err error)
- func (c Client) UpdatePrimaryForDataset(newPrimaryUUID, datasetID string) (*DatasetState, error)
- type Clientable
- type DatasetState
Types ¶
type Client ¶
Client is a default Flocker Client.
func NewClient ¶
func NewClient(host string, port int, clientIP string, caCertPath, keyPath, certPath string) (*Client, error)
NewClient creates a wrapper over http.Client to communicate with the flocker control service.
func (Client) CreateDataset ¶
func (c Client) CreateDataset(metaName string) (*DatasetState, error)
CreateDataset creates a volume in Flocker, waits for it to be ready and returns the dataset id.
This process is a little bit complex but follows this flow:
1. Find the Flocker Control Service UUID 2. Try to create the dataset 3. If it already exists an error is returned 4. If it didn't previously exist, wait for it to be ready
func (Client) GetDatasetID ¶
GetDatasetID will return the DatasetID found for the given metadata name.
func (Client) GetDatasetState ¶
func (c Client) GetDatasetState(datasetID string) (*DatasetState, error)
GetDatasetState performs a get request to get the state of the given datasetID, if something goes wrong or the datasetID was not found it returns an error.
func (Client) GetPrimaryUUID ¶
GetPrimaryUUID returns the UUID of the primary Flocker Control Service for the given host.
func (Client) UpdatePrimaryForDataset ¶
func (c Client) UpdatePrimaryForDataset(newPrimaryUUID, datasetID string) (*DatasetState, error)
UpdatePrimaryForDataset will update the Primary for the given dataset returning the current DatasetState.
type Clientable ¶
type Clientable interface { CreateDataset(metaName string) (*DatasetState, error) GetDatasetState(datasetID string) (*DatasetState, error) GetDatasetID(metaName string) (datasetID string, err error) GetPrimaryUUID() (primaryUUID string, err error) UpdatePrimaryForDataset(primaryUUID, datasetID string) (*DatasetState, error) }
Clientable exposes the needed methods to implement your own Flocker Client.
type DatasetState ¶
type DatasetState struct { Path string `json:"path"` DatasetID string `json:"dataset_id"` Primary string `json:"primary,omitempty"` MaximumSize json.Number `json:"maximum_size,omitempty"` }
Source Files ¶
client.go doc.go util.go
- Version
- v1.1.9-beta.0
- Published
- Feb 23, 2016
- Platform
- js/wasm
- Imports
- 10 packages
- Last checked
- 51 minutes ago –
Tools for package owners.