package cluster
import "github.com/docker/swarm/cluster"
Index ¶
- Constants
- func ConsolidateResourceFields(c *OldContainerConfig)
- func FullStateString(state *types.ContainerState) string
- func HealthString(state *types.ContainerState) string
- func IsConnectionError(err error) bool
- func NewHTTPClientTimeout(daemonURL string, tlsConfig *tls.Config, timeout time.Duration, setUserTimeout tcpFunc) (*http.Client, *url.URL, error)
- func ParseRepositoryTag(repos string) (string, string)
- func StateString(state *types.ContainerState) string
- type APIEventHandler
- func NewAPIEventHandler() *APIEventHandler
- func (eh *APIEventHandler) Handle(e *Event) error
- func (eh *APIEventHandler) Size() int
- func (eh *APIEventHandler) Watch() (chan events.Event, func())
- type Cluster
- type ClusterEventHandlers
- func NewClusterEventHandlers() ClusterEventHandlers
- func (eh *ClusterEventHandlers) CloseWatchQueues()
- func (eh *ClusterEventHandlers) Handle(e *Event) error
- func (eh *ClusterEventHandlers) RegisterEventHandler(h EventHandler) error
- func (eh *ClusterEventHandlers) UnregisterEventHandler(h EventHandler)
- type Container
- type ContainerConfig
- func BuildContainerConfig(c container.Config, h container.HostConfig, n network.NetworkingConfig) *ContainerConfig
- func (c *ContainerConfig) AddAffinity(affinity string) error
- func (c *ContainerConfig) AddConstraint(constraint string) error
- func (c *ContainerConfig) AddWhitelist(whitelist string) error
- func (c *ContainerConfig) Affinities() []string
- func (c *ContainerConfig) Constraints() []string
- func (c *ContainerConfig) HasReschedulePolicy(p string) bool
- func (c *ContainerConfig) HaveNodeConstraint() bool
- func (c *ContainerConfig) RemoveAffinity(affinity string) error
- func (c *ContainerConfig) RemoveWhitelist(whitelist string) error
- func (c *ContainerConfig) SetSwarmID(id string)
- func (c *ContainerConfig) SwarmID() string
- func (c *ContainerConfig) Validate() error
- func (c *ContainerConfig) Whitelists() []string
- type Containers
- type DriverOpts
- func (do DriverOpts) Bool(key, env string) (bool, bool)
- func (do DriverOpts) Float(key, env string) (float64, bool)
- func (do DriverOpts) IP(key, env string) (net.IP, bool)
- func (do DriverOpts) Int(key, env string) (int64, bool)
- func (do DriverOpts) String(key, env string) (string, bool)
- func (do DriverOpts) Uint(key, env string) (uint64, bool)
- type Engine
- func NewEngine(addr string, overcommitRatio float64, opts *EngineOpts) *Engine
- func (e *Engine) AddContainer(container *Container) error
- func (e *Engine) AddNetwork(network *Network)
- func (e *Engine) BuildImage(buildContext io.Reader, buildImage *types.ImageBuildOptions, callback func(msg JSONMessage)) error
- func (e *Engine) CheckConnectionErr(err error)
- func (e *Engine) Connect(config *tls.Config) error
- func (e *Engine) ConnectWithClient(apiClient swarmclient.SwarmAPIClient) error
- func (e *Engine) Containers() Containers
- func (e *Engine) CreateContainer(config *ContainerConfig, name string, pullImage bool, authConfig *types.AuthConfig) (*Container, error)
- func (e *Engine) CreateContainerExec(id string, config types.ExecConfig) (types.IDResponse, error)
- func (e *Engine) CreateNetwork(name string, request *types.NetworkCreate) (*types.NetworkCreateResponse, error)
- func (e *Engine) CreateVolume(request *volume.VolumesCreateBody) (*types.Volume, error)
- func (e *Engine) DeleteNetwork(network *Network)
- func (e *Engine) Disconnect()
- func (e *Engine) EngineToContainerNode() *types.ContainerNode
- func (e *Engine) ErrMsg() string
- func (e *Engine) HTTPClientAndScheme() (*http.Client, string, error)
- func (e *Engine) HandleIDConflict(otherAddr string)
- func (e *Engine) HealthIndicator() int64
- func (e *Engine) Image(IDOrName string) *Image
- func (e *Engine) Images() Images
- func (e *Engine) Import(source string, ref string, tag string, imageReader io.Reader, callback func(msg JSONMessage)) error
- func (e *Engine) InspectContainer(id string) (*types.ContainerJSON, error)
- func (e *Engine) IsHealthy() bool
- func (e *Engine) Load(reader io.Reader, callback func(msg JSONMessage)) error
- func (e *Engine) NetworkDisconnect(container *Container, network string, force bool) error
- func (e *Engine) Networks() Networks
- func (e *Engine) Pull(image string, authConfig *types.AuthConfig, callback func(msg JSONMessage)) error
- func (e *Engine) RefreshContainers(full bool) error
- func (e *Engine) RefreshEngine(hostname string) error
- func (e *Engine) RefreshImages() error
- func (e *Engine) RefreshNetworks() error
- func (e *Engine) RefreshVolumes() error
- func (e *Engine) RegisterEventHandler(h EventHandler) error
- func (e *Engine) RemoveContainer(container *Container, force, volumes bool) error
- func (e *Engine) RemoveImage(name string, force bool) ([]types.ImageDeleteResponseItem, error)
- func (e *Engine) RemoveNetwork(network *Network) error
- func (e *Engine) RemoveVolume(name string) error
- func (e *Engine) RenameContainer(container *Container, newName string) error
- func (e *Engine) StartContainer(container *Container) error
- func (e *Engine) StartMonitorEvents()
- func (e *Engine) Status() string
- func (e *Engine) String() string
- func (e *Engine) TagImage(IDOrName string, ref string, force bool) error
- func (e *Engine) TimeToValidate() bool
- func (e *Engine) TotalCpus() int64
- func (e *Engine) TotalMemory() int64
- func (e *Engine) UpdateNetworkContainers(containerID string, full bool) error
- func (e *Engine) UpdatedAt() time.Time
- func (e *Engine) UsedCpus() int64
- func (e *Engine) UsedMemory() int64
- func (e *Engine) ValidationComplete()
- func (e *Engine) Volumes() Volumes
- type EngineOpts
- type EngineSorter
- func (s EngineSorter) Len() int
- func (s EngineSorter) Less(i, j int) bool
- func (s EngineSorter) Swap(i, j int)
- type Event
- type EventHandler
- type EventsMonitor
- func NewEventsMonitor(cli swarmclient.SwarmAPIClient, handler func(msg events.Message) error) *EventsMonitor
- func (em *EventsMonitor) Start(ec chan error)
- func (em *EventsMonitor) Stop()
- type Image
- type ImageFilterOptions
- type Images
- func (images Images) Filter(opts ImageFilterOptions) Images
- func (images Images) GetImageFromField(field string, opts ImageFilterOptions) *Image
- type JSONError
- type JSONMessage
- type JSONMessageWrapper
- type JSONProgress
- type Network
- type Networks
- func (networks Networks) Filter(filter filters.Args) Networks
- func (networks Networks) Get(IDOrName string) *Network
- func (networks Networks) Uniq() Networks
- type OldContainerConfig
- type Volume
- type Volumes
- type Watchdog
Constants ¶
const SwarmLabelNamespace = "com.docker.swarm"
SwarmLabelNamespace defines the key prefix in all custom labels
Functions ¶
func ConsolidateResourceFields ¶
func ConsolidateResourceFields(c *OldContainerConfig)
ConsolidateResourceFields is a temporary fix to handle forward/backward compatibility between Docker <1.6 and >=1.7
func FullStateString ¶
func FullStateString(state *types.ContainerState) string
FullStateString returns human-readable description of the state
func HealthString ¶
func HealthString(state *types.ContainerState) string
HealthString returns a single string to describe health status.
func IsConnectionError ¶
IsConnectionError returns true when err is connection problem
func NewHTTPClientTimeout ¶
func NewHTTPClientTimeout(daemonURL string, tlsConfig *tls.Config, timeout time.Duration, setUserTimeout tcpFunc) (*http.Client, *url.URL, error)
NewHTTPClientTimeout is used to create the HTTP Client and URL
func ParseRepositoryTag ¶
ParseRepositoryTag gets a repos name and returns the right reposName + tag|digest The tag can be confusing because of a port in a repository name.
Ex: localhost.localdomain:5000/samalba/hipache:latest Digest ex: localhost:5000/foo/bar@sha256:bc8813ea7b3603864987522f02a76101c17ad122e1c46d790efc0fca78ca7bfb
func StateString ¶
func StateString(state *types.ContainerState) string
StateString returns a single string to describe state
Types ¶
type APIEventHandler ¶
type APIEventHandler struct {
// contains filtered or unexported fields
}
APIEventHandler broadcasts events to multiple client listeners.
func NewAPIEventHandler ¶
func NewAPIEventHandler() *APIEventHandler
NewAPIEventHandler creates a new APIEventsHandler for a cluster. The new eventsHandler is initialized with no writers or channels.
func (*APIEventHandler) Handle ¶
func (eh *APIEventHandler) Handle(e *Event) error
Handle writes information about a cluster event to each remote address in the cluster that has been added to the events handler. After an unsuccessful write to a remote address, the associated channel is closed and the address is removed from the events handler.
func (*APIEventHandler) Size ¶
func (eh *APIEventHandler) Size() int
Size returns the number of event queues currently listening for events
func (*APIEventHandler) Watch ¶
func (eh *APIEventHandler) Watch() (chan events.Event, func())
Watch adds the writer and a new channel for the remote address.
type Cluster ¶
type Cluster interface { // CreateContainer creates a container. CreateContainer(config *ContainerConfig, name string, authConfig *types.AuthConfig) (*Container, error) // RemoveContainer removes a container. RemoveContainer(container *Container, force, volumes bool) error // Images returns all images. Images() Images // Image returns one image matching `IDOrName`. Image(IDOrName string) *Image // RemoveImages removes images from the cluster. RemoveImages(name string, force bool) ([]types.ImageDeleteResponseItem, error) // Containers returns all containers. Containers() Containers // StartContainer starts a container. StartContainer(container *Container) error // Container returns the container matching `IDOrName`. // TODO: remove this method from the interface as we can use // cluster.Containers().Get(IDOrName). Container(IDOrName string) *Container // Networks returns all networks. Networks() Networks // CreateNetwork creates a network. CreateNetwork(name string, request *types.NetworkCreate) (*types.NetworkCreateResponse, error) // RemoveNetwork removes a network from the cluster. RemoveNetwork(network *Network) error // CreateVolume creates a volume. CreateVolume(request *volume.VolumesCreateBody) (*types.Volume, error) // Volumes returns all volumes. Volumes() Volumes // RemoveVolumes removes volumes from the cluster. RemoveVolumes(name string) (bool, error) // Pull images // `callback` can be called multiple time Pull(name string, authConfig *types.AuthConfig, callback func(msg JSONMessageWrapper)) // Import image // `callback` can be called multiple time Import(source string, ref string, tag string, imageReader io.Reader, callback func(msg JSONMessageWrapper)) // Load images // `callback` can be called multiple time Load(imageReader io.Reader, callback func(msg JSONMessageWrapper)) // Info returns some info about the cluster, like nb of containers / images. // It is pretty open, so the implementation decides what to return. Info() [][2]string // TotalMemory returns the total memory of the cluster. TotalMemory() int64 // TotalCpus returns the number of CPUs in the cluster. TotalCpus() int64 // RegisterEventHandler registers an event handler for cluster-wide events. RegisterEventHandler(h EventHandler) error // UnregisterEventHandler unregisters an event handler. UnregisterEventHandler(h EventHandler) // NewAPIEventHandler creates a new API events handler NewAPIEventHandler() *APIEventHandler // CloseWatchQueues unregisters all API event handlers (the ones with // watch queues) and closes the respective queues. This should be // called when the manager shuts down CloseWatchQueues() // FIXME: remove this method // RANDOMENGINE returns a random engine. RANDOMENGINE() (*Engine, error) // RenameContainer renames a container. RenameContainer(container *Container, newName string) error // BuildImage builds an image. BuildImage(io.Reader, *types.ImageBuildOptions, func(msg JSONMessageWrapper)) error // TagImage tags an image. TagImage(IDOrName string, ref string, force bool) error // RefreshEngine refreshes a single cluster engine. RefreshEngine(hostname string) error // RefreshEngines refreshes all engines in the cluster. RefreshEngines() error }
Cluster is exported
type ClusterEventHandlers ¶
ClusterEventHandlers is a map of EventHandler
func NewClusterEventHandlers ¶
func NewClusterEventHandlers() ClusterEventHandlers
NewClusterEventHandlers initializes and returns a ClusterEventHandlers object
func (*ClusterEventHandlers) CloseWatchQueues ¶
func (eh *ClusterEventHandlers) CloseWatchQueues()
CloseWatchQueues unregisters all API event handlers (the ones with watch queues) and closes the respective queues. This should be called when the manager shuts down
func (*ClusterEventHandlers) Handle ¶
func (eh *ClusterEventHandlers) Handle(e *Event) error
HandleAll callbacks for the events
func (*ClusterEventHandlers) RegisterEventHandler ¶
func (eh *ClusterEventHandlers) RegisterEventHandler(h EventHandler) error
RegisterEventHandler registers an event handler.
func (*ClusterEventHandlers) UnregisterEventHandler ¶
func (eh *ClusterEventHandlers) UnregisterEventHandler(h EventHandler)
UnregisterEventHandler unregisters a previously registered event handler.
type Container ¶
type Container struct { types.Container Config *ContainerConfig Info types.ContainerJSON Engine *Engine }
Container is exported
func (*Container) Refresh ¶
Refresh container
type ContainerConfig ¶
type ContainerConfig struct { container.Config HostConfig container.HostConfig NetworkingConfig network.NetworkingConfig }
ContainerConfig is exported TODO store affinities and constraints in their own fields
func BuildContainerConfig ¶
func BuildContainerConfig(c container.Config, h container.HostConfig, n network.NetworkingConfig) *ContainerConfig
BuildContainerConfig creates a cluster.ContainerConfig from a Config, HostConfig, and NetworkingConfig
func (*ContainerConfig) AddAffinity ¶
func (c *ContainerConfig) AddAffinity(affinity string) error
AddAffinity to config
func (*ContainerConfig) AddConstraint ¶
func (c *ContainerConfig) AddConstraint(constraint string) error
AddConstraint to config
func (*ContainerConfig) AddWhitelist ¶
func (c *ContainerConfig) AddWhitelist(whitelist string) error
AddWhitelist to config
func (*ContainerConfig) Affinities ¶
func (c *ContainerConfig) Affinities() []string
Affinities returns all the affinities from the ContainerConfig
func (*ContainerConfig) Constraints ¶
func (c *ContainerConfig) Constraints() []string
Constraints returns all the constraints from the ContainerConfig
func (*ContainerConfig) HasReschedulePolicy ¶
func (c *ContainerConfig) HasReschedulePolicy(p string) bool
HasReschedulePolicy returns true if the specified policy is part of the config
func (*ContainerConfig) HaveNodeConstraint ¶
func (c *ContainerConfig) HaveNodeConstraint() bool
HaveNodeConstraint in config
func (*ContainerConfig) RemoveAffinity ¶
func (c *ContainerConfig) RemoveAffinity(affinity string) error
RemoveAffinity from config
func (*ContainerConfig) RemoveWhitelist ¶
func (c *ContainerConfig) RemoveWhitelist(whitelist string) error
RemoveWhitelist from config
func (*ContainerConfig) SetSwarmID ¶
func (c *ContainerConfig) SetSwarmID(id string)
SetSwarmID sets or overrides the Swarm ID in the Config.
func (*ContainerConfig) SwarmID ¶
func (c *ContainerConfig) SwarmID() string
SwarmID extracts the Swarm ID from the Config. May return an empty string if not set.
func (*ContainerConfig) Validate ¶
func (c *ContainerConfig) Validate() error
Validate returns an error if the config isn't valid
func (*ContainerConfig) Whitelists ¶
func (c *ContainerConfig) Whitelists() []string
Whitelists returns all the whitelists from the ContainerConfig
type Containers ¶
type Containers []*Container
Containers represents a list of containers
func (Containers) Get ¶
func (containers Containers) Get(IDOrName string) *Container
Get returns a container using its ID or Name
type DriverOpts ¶
type DriverOpts []string
DriverOpts are key=values options
func (DriverOpts) Bool ¶
func (do DriverOpts) Bool(key, env string) (bool, bool)
Bool returns a boolean from the driver options
func (DriverOpts) Float ¶
func (do DriverOpts) Float(key, env string) (float64, bool)
Float returns a float64 from the driver options
func (DriverOpts) IP ¶
func (do DriverOpts) IP(key, env string) (net.IP, bool)
IP returns an IP address from the driver options
func (DriverOpts) Int ¶
func (do DriverOpts) Int(key, env string) (int64, bool)
Int returns an int64 from the driver options
func (DriverOpts) String ¶
func (do DriverOpts) String(key, env string) (string, bool)
String returns a string from the driver options
func (DriverOpts) Uint ¶
func (do DriverOpts) Uint(key, env string) (uint64, bool)
Uint returns an int64 from the driver options
type Engine ¶
type Engine struct { sync.RWMutex ID string IP string Addr string Name string Cpus int64 Memory int64 Labels map[string]string Version string DeltaDuration time.Duration // swarm's systime - engine's systime // contains filtered or unexported fields }
Engine represents a docker engine
func NewEngine ¶
func NewEngine(addr string, overcommitRatio float64, opts *EngineOpts) *Engine
NewEngine is exported
func (*Engine) AddContainer ¶
AddContainer injects a container into the internal state.
func (*Engine) AddNetwork ¶
AddNetwork adds a network to the internal engine state.
func (*Engine) BuildImage ¶
func (e *Engine) BuildImage(buildContext io.Reader, buildImage *types.ImageBuildOptions, callback func(msg JSONMessage)) error
BuildImage builds an image
func (*Engine) CheckConnectionErr ¶
CheckConnectionErr checks error from client response and adjusts engine healthy indicators
func (*Engine) Connect ¶
Connect will initialize a connection to the Docker daemon running on the host, gather machine specs (memory, cpu, ...) and monitor state changes.
func (*Engine) ConnectWithClient ¶
func (e *Engine) ConnectWithClient(apiClient swarmclient.SwarmAPIClient) error
ConnectWithClient is exported
func (*Engine) Containers ¶
func (e *Engine) Containers() Containers
Containers returns all the containers in the engine.
func (*Engine) CreateContainer ¶
func (e *Engine) CreateContainer(config *ContainerConfig, name string, pullImage bool, authConfig *types.AuthConfig) (*Container, error)
CreateContainer creates a new container
func (*Engine) CreateContainerExec ¶
func (e *Engine) CreateContainerExec(id string, config types.ExecConfig) (types.IDResponse, error)
CreateContainerExec creates a container exec
func (*Engine) CreateNetwork ¶
func (e *Engine) CreateNetwork(name string, request *types.NetworkCreate) (*types.NetworkCreateResponse, error)
CreateNetwork creates a network in the engine
func (*Engine) CreateVolume ¶
CreateVolume creates a volume in the engine
func (*Engine) DeleteNetwork ¶
DeleteNetwork deletes a network from the internal engine state.
func (*Engine) Disconnect ¶
func (e *Engine) Disconnect()
Disconnect will stop all monitoring of the engine. The Engine object cannot be further used without reconnecting it first.
func (*Engine) EngineToContainerNode ¶
func (e *Engine) EngineToContainerNode() *types.ContainerNode
EngineToContainerNode constructs types.ContainerNode from engine
func (*Engine) ErrMsg ¶
ErrMsg returns error message for the engine
func (*Engine) HTTPClientAndScheme ¶
HTTPClientAndScheme returns the underlying HTTPClient and the scheme used by the engine
func (*Engine) HandleIDConflict ¶
HandleIDConflict handles ID duplicate with existing engine
func (*Engine) HealthIndicator ¶
HealthIndicator returns degree of healthiness between 0 and 100. 0 means node is not healthy (unhealthy, pending), 100 means last connectivity was successful other values indicate recent failures but haven't moved engine out of healthy state
func (*Engine) Image ¶
Image returns the image with IDOrName in the engine
func (*Engine) Images ¶
Images returns all the images in the engine
func (*Engine) Import ¶
func (e *Engine) Import(source string, ref string, tag string, imageReader io.Reader, callback func(msg JSONMessage)) error
Import image
func (*Engine) InspectContainer ¶
func (e *Engine) InspectContainer(id string) (*types.ContainerJSON, error)
InspectContainer inspects a container
func (*Engine) IsHealthy ¶
IsHealthy returns true if the engine is healthy
func (*Engine) Load ¶
func (e *Engine) Load(reader io.Reader, callback func(msg JSONMessage)) error
Load an image on the engine
func (*Engine) NetworkDisconnect ¶
NetworkDisconnect disconnects a container from a network
func (*Engine) Networks ¶
Networks returns all the networks in the engine
func (*Engine) Pull ¶
func (e *Engine) Pull(image string, authConfig *types.AuthConfig, callback func(msg JSONMessage)) error
Pull an image on the engine
func (*Engine) RefreshContainers ¶
RefreshContainers will refresh the list and status of containers running on the engine. If `full` is true, each container will be inspected. FIXME: unexport this method after mesos scheduler stops using it directly
func (*Engine) RefreshEngine ¶
RefreshEngine refreshes container records from an engine
func (*Engine) RefreshImages ¶
RefreshImages refreshes the list of images on the engine.
func (*Engine) RefreshNetworks ¶
RefreshNetworks refreshes the list of networks on the engine.
func (*Engine) RefreshVolumes ¶
RefreshVolumes refreshes the list of volumes on the engine.
func (*Engine) RegisterEventHandler ¶
func (e *Engine) RegisterEventHandler(h EventHandler) error
RegisterEventHandler registers an event handler.
func (*Engine) RemoveContainer ¶
RemoveContainer removes a container from the engine.
func (*Engine) RemoveImage ¶
RemoveImage deletes an image from the engine.
func (*Engine) RemoveNetwork ¶
RemoveNetwork removes a network from the engine.
func (*Engine) RemoveVolume ¶
RemoveVolume deletes a volume from the engine.
func (*Engine) RenameContainer ¶
RenameContainer renames a container
func (*Engine) StartContainer ¶
StartContainer starts a container
func (*Engine) StartMonitorEvents ¶
func (e *Engine) StartMonitorEvents()
StartMonitorEvents monitors events from the engine
func (*Engine) Status ¶
Status returns the health status of the Engine: Healthy or Unhealthy
func (*Engine) String ¶
func (*Engine) TagImage ¶
TagImage tags an image
func (*Engine) TimeToValidate ¶
TimeToValidate returns true if a pending node is up for validation
func (*Engine) TotalCpus ¶
TotalCpus returns the total cpus + overcommit
func (*Engine) TotalMemory ¶
TotalMemory returns the total memory + overcommit
func (*Engine) UpdateNetworkContainers ¶
UpdateNetworkContainers updates the list of containers attached to each network. This is required because the RefreshNetworks uses NetworkList which has stopped returning this information for recent API versions. Note that the container cache is used to obtain this information, which means that if the container cache isn't up to date for whatever reason, then the network information might be out of date as well. This needs to be considered while designing networking related functionality. Ideally, this function should only be used in the refresh loop, and called AFTER RefreshNetworks() because RefreshNetworks() will not populate network information correctly if container refresh hasn't taken place. The containerID argument can be provided along with a full argument can be used to limit the update as it concerns only one container instead of doing it for all containers. The idea is that sometimes only things about one container may have changed, and we don't need to run the loop over all containers.
func (*Engine) UpdatedAt ¶
UpdatedAt returns the previous updatedAt time
func (*Engine) UsedCpus ¶
UsedCpus returns the sum of CPUs reserved by containers.
func (*Engine) UsedMemory ¶
UsedMemory returns the sum of memory reserved by containers.
func (*Engine) ValidationComplete ¶
func (e *Engine) ValidationComplete()
ValidationComplete transitions engine state from statePending to stateHealthy
func (*Engine) Volumes ¶
Volumes returns all the volumes in the engine
type EngineOpts ¶
type EngineOpts struct { RefreshMinInterval time.Duration RefreshMaxInterval time.Duration FailureRetry int }
EngineOpts represents the options for an engine
type EngineSorter ¶
type EngineSorter []*Engine
EngineSorter implements the Sort interface to sort Cluster.Engine. It is not guaranteed to be a stable sort.
func (EngineSorter) Len ¶
func (s EngineSorter) Len() int
Len returns the number of engines to be sorted.
func (EngineSorter) Less ¶
func (s EngineSorter) Less(i, j int) bool
Less reports whether the engine with index i should sort before the engine with index j. Engines are sorted chronologically by name.
func (EngineSorter) Swap ¶
func (s EngineSorter) Swap(i, j int)
Swap exchanges the engine elements with indices i and j.
type Event ¶
Event is exported
type EventHandler ¶
EventHandler is exported
type EventsMonitor ¶
type EventsMonitor struct {
// contains filtered or unexported fields
}
EventsMonitor monitors events
func NewEventsMonitor ¶
func NewEventsMonitor(cli swarmclient.SwarmAPIClient, handler func(msg events.Message) error) *EventsMonitor
NewEventsMonitor returns an EventsMonitor
func (*EventsMonitor) Start ¶
func (em *EventsMonitor) Start(ec chan error)
Start starts the EventsMonitor
func (*EventsMonitor) Stop ¶
func (em *EventsMonitor) Stop()
Stop stops the EventsMonitor
type Image ¶
type Image struct { types.ImageSummary Engine *Engine }
Image is exported
func (*Image) Match ¶
Match is exported
type ImageFilterOptions ¶
type ImageFilterOptions struct { types.ImageListOptions }
ImageFilterOptions is the set of filtering options supported by Images.Filter()
func (ImageFilterOptions) GetIDOrName ¶
func (opts ImageFilterOptions) GetIDOrName(field string) string
helper func for filtering
type Images ¶
type Images []*Image
Images is a collection of Image objects that can be filtered
func (Images) Filter ¶
func (images Images) Filter(opts ImageFilterOptions) Images
Filter returns a new sequence of Images filtered to only the images that matched the filtering parameters
func (Images) GetImageFromField ¶
func (images Images) GetImageFromField(field string, opts ImageFilterOptions) *Image
type JSONError ¶
type JSONError struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` }
JSONError represents a JSON Error
type JSONMessage ¶
type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` ProgressMessage string `json:"progress,omitempty"` //deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` ErrorMessage string `json:"error,omitempty"` //deprecated // Aux contains out-of-band data, such as digests for push signing. Aux *json.RawMessage `json:"aux,omitempty"` }
JSONMessage represents a JSON-encoded message regarding the status of a stream
type JSONMessageWrapper ¶
type JSONMessageWrapper struct { Msg JSONMessage EngineName string Err error Success bool }
JSONMessageWrapper is used in callback functions for API calls that send back JSONMessages; this allows us to pass info around within Swarm classic.
type JSONProgress ¶
type JSONProgress struct { //terminalFd uintptr Current int64 `json:"current,omitempty"` Total int64 `json:"total,omitempty"` Start int64 `json:"start,omitempty"` }
JSONProgress represents a JSON-encoded progress instance
type Network ¶
type Network struct { types.NetworkResource Engine *Engine }
Network is exported
func (*Network) RemoveDuplicateEndpoints ¶
RemoveDuplicateEndpoints returns a copy of input network where duplicate container endpoints in the network are removed. See https://github.com/docker/swarm/issues/1969 This function should be disabled when the bug is fixed in Docker network
type Networks ¶
type Networks []*Network
Networks represents an array of networks
func (Networks) Filter ¶
Filter returns networks filtered by names, IDs, nodes, labels, etc.
func (Networks) Get ¶
Get returns a network using its ID or Name
func (Networks) Uniq ¶
Uniq returns all uniq networks
type OldContainerConfig ¶
type OldContainerConfig struct { ContainerConfig Memory int64 MemorySwap int64 int64 `json:"CpuShares"` CPUSet string `json:"Cpuset"` }
OldContainerConfig contains additional fields for backward compatibility This should be removed after we stop supporting API versions <= 1.8 TODO(nishanttotla): Remove this field
type Volume ¶
Volume is exported
type Volumes ¶
type Volumes []*Volume
Volumes represents an array of volumes
func (Volumes) Get ¶
Get returns a volume using its ID or Name
type Watchdog ¶
Watchdog listens to cluster events and handles container rescheduling
func NewWatchdog ¶
NewWatchdog creates a new watchdog
func (*Watchdog) Handle ¶
Handle handles cluster callbacks
Source Files ¶
api_events.go cluster.go config.go container.go engine.go engine_sorter.go event_map.go event_monitor.go events.go httpclient.go image.go jsonmessage.go network.go options.go volume.go watchdog.go
Directories ¶
Path | Synopsis |
---|---|
cluster/swarm |
- Version
- v1.2.9 (latest)
- Published
- Jun 1, 2018
- Platform
- linux/amd64
- Imports
- 35 packages
- Last checked
- 3 weeks ago –
Tools for package owners.