cluster

package
v1.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2016 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoManager = fmt.Errorf("this node is not participating as a Swarm manager")

ErrNoManager is returned then a manager-only function is called on non-manager

View Source
var ErrNoSwarm = fmt.Errorf("this node is not part of Swarm")

ErrNoSwarm is returned on leaving a cluster that was never initialized

View Source
var ErrSwarmExists = fmt.Errorf("this node is already part of a Swarm")

ErrSwarmExists is returned on initialize or join request for a cluster that has already been activated

View Source
var ErrSwarmJoinTimeoutReached = fmt.Errorf("timeout reached before node was joined")

ErrSwarmJoinTimeoutReached is returned when cluster join could not complete before timeout was reached.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cluster provides capabilities to pariticipate in a cluster as worker or a manager and a worker.

func New

func New(config Config) (*Cluster, error)

New creates a new Cluster instance using provided config.

func (*Cluster) Cleanup

func (c *Cluster) Cleanup()

Cleanup stops active swarm node. This is run before daemon shutdown.

func (*Cluster) CreateNetwork

func (c *Cluster) CreateNetwork(s apitypes.NetworkCreateRequest) (string, error)

CreateNetwork creates a new cluster managed network.

func (*Cluster) CreateService

func (c *Cluster) CreateService(s types.ServiceSpec) (string, error)

CreateService creates a new service in a managed swarm cluster.

func (*Cluster) GetListenAddress added in v1.12.2

func (c *Cluster) GetListenAddress() string

GetListenAddress returns the listening address for current maanger's consensus and dispatcher APIs.

func (*Cluster) GetNetwork

func (c *Cluster) GetNetwork(input string) (apitypes.NetworkResource, error)

GetNetwork returns a cluster network by ID.

func (*Cluster) GetNetworks

func (c *Cluster) GetNetworks() ([]apitypes.NetworkResource, error)

GetNetworks returns all current cluster managed networks.

func (*Cluster) GetNode

func (c *Cluster) GetNode(input string) (types.Node, error)

GetNode returns a node based on a ID or name.

func (*Cluster) GetNodes

func (c *Cluster) GetNodes(options apitypes.NodeListOptions) ([]types.Node, error)

GetNodes returns a list of all nodes known to a cluster.

func (*Cluster) GetRemoteAddress

func (c *Cluster) GetRemoteAddress() string

GetRemoteAddress returns a known advertise address of a remote maanger if available. todo: change to array/connect with info

func (*Cluster) GetService

func (c *Cluster) GetService(input string) (types.Service, error)

GetService returns a service based on a ID or name.

func (*Cluster) GetServices

func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Service, error)

GetServices returns all services of a managed swarm cluster.

func (*Cluster) GetTask

func (c *Cluster) GetTask(input string) (types.Task, error)

GetTask returns a task by an ID.

func (*Cluster) GetTasks

func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, error)

GetTasks returns a list of tasks matching the filter options.

func (*Cluster) Info

func (c *Cluster) Info() types.Info

Info returns information about the current cluster state.

func (*Cluster) Init

func (c *Cluster) Init(req types.InitRequest) (string, error)

Init initializes new cluster from user provided request.

func (*Cluster) Inspect

func (c *Cluster) Inspect() (types.Swarm, error)

Inspect retrives the confuguration properties of managed swarm cluster.

func (*Cluster) IsAgent

func (c *Cluster) IsAgent() bool

IsAgent returns true is Cluster is participating as a worker/agent.

func (*Cluster) IsManager

func (c *Cluster) IsManager() bool

IsManager returns true is Cluster is participating as a manager.

func (*Cluster) Join

func (c *Cluster) Join(req types.JoinRequest) error

Join makes current Cluster part of an existing swarm cluster.

func (*Cluster) Leave

func (c *Cluster) Leave(force bool) error

Leave shuts down Cluster and removes current state.

func (*Cluster) ListenClusterEvents

func (c *Cluster) ListenClusterEvents() <-chan struct{}

ListenClusterEvents returns a channel that receives messages on cluster participation changes. todo: make cancelable and accessible to multiple callers

func (*Cluster) RemoveNetwork

func (c *Cluster) RemoveNetwork(input string) error

RemoveNetwork removes a cluster network.

func (*Cluster) RemoveNode

func (c *Cluster) RemoveNode(input string) error

RemoveNode removes a node from a cluster

func (*Cluster) RemoveService

func (c *Cluster) RemoveService(input string) error

RemoveService removes a service from a managed swarm cluster.

func (*Cluster) Update

func (c *Cluster) Update(version uint64, spec types.Spec) error

Update updates configuration of a managed swarm cluster.

func (*Cluster) UpdateNode

func (c *Cluster) UpdateNode(nodeID string, version uint64, spec types.NodeSpec) error

UpdateNode updates existing nodes properties.

func (*Cluster) UpdateService

func (c *Cluster) UpdateService(serviceID string, version uint64, spec types.ServiceSpec) error

UpdateService updates existing service to match new properties.

type Config

type Config struct {
	Root    string
	Name    string
	Backend executorpkg.Backend
}

Config provides values for Cluster.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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