Documentation ¶
Overview ¶
Classes that define relationships between containers (links) and simple strategies for placement.
Provides gear deployment and linking from a deployment descriptor.
Index ¶
- Constants
- func NewHttpClient(insecure bool, timeout time.Duration) *http.Client
- type Container
- type Containers
- type Deployment
- type Instance
- type InstanceLink
- type InstanceLinks
- type InstancePortTable
- type InstanceRefs
- type Instances
- type Link
- type Links
- type PlacementStrategy
- type PortAssignmentStrategy
- type PortMapping
- type PortMappings
- type SimplePlacement
Constants ¶
View Source
const DistributeAffinity = "distribute"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Container ¶
type Container struct { Name string Image string PublicPorts port.PortPairs `json:"PublicPorts,omitempty"` Links Links `json:"Links,omitempty"` Environment containers.EnvironmentVariables `json:",omitempty"` Count int Affinity string `json:"Affinity,omitempty"` // contains filtered or unexported fields }
A container description
func (*Container) AddInstance ¶
func (*Container) Instances ¶
func (c *Container) Instances() InstanceRefs
type Containers ¶
type Containers []Container
func (Containers) Copy ¶
func (c Containers) Copy() (dup Containers)
func (Containers) OrderLinks ¶
func (sources Containers) OrderLinks() (ordered containerLinks, err error)
Return the set of links that should be resolved
type Deployment ¶
type Deployment struct { Containers Containers Instances Instances IdPrefix string RandomizeIds bool }
A description of a deployment
func NewDeploymentFromFile ¶
func NewDeploymentFromFile(path string) (*Deployment, error)
func NewDeploymentFromURL ¶
func (Deployment) Describe ¶
func (d Deployment) Describe(placement PlacementStrategy, t transport.Transport) (next *Deployment, removed InstanceRefs, err error)
func (*Deployment) UpdateLinks ¶
func (d *Deployment) UpdateLinks()
Invoke to update instance links to the correct external ports.
type Instance ¶
type Instance struct { // The id of this instance Id containers.Identifier // The image used by this instance Image string // The container definition this is from From string // The deployed location - nil for not deployed On *string `json:"On,omitempty"` // The mapping of internal, external, and remote ports Ports PortMappings `json:"Ports,omitempty"` // Extra environment variables set for the instance Environment containers.EnvironmentVariables `json:",omitempty"` // contains filtered or unexported fields }
A container that has been created on a server
func (*Instance) EnvironmentVariables ¶
func (i *Instance) EnvironmentVariables() *containers.EnvironmentDescription
func (*Instance) MarkRemoved ¶
func (i *Instance) MarkRemoved()
func (*Instance) NetworkLinks ¶
func (i *Instance) NetworkLinks() containers.NetworkLinks
func (*Instance) ResolveHostname ¶
type InstanceLink ¶
type InstanceLink struct { containers.NetworkLink // contains filtered or unexported fields }
A materialized link between two instances
type InstanceLinks ¶
type InstanceLinks []InstanceLink
func (InstanceLinks) NetworkLinks ¶
func (links InstanceLinks) NetworkLinks() (dup containers.NetworkLinks)
type InstancePortTable ¶
type InstancePortTable struct {
// contains filtered or unexported fields
}
func NewInstancePortTable ¶
func NewInstancePortTable(sources Containers) (*InstancePortTable, error)
type InstanceRefs ¶
type InstanceRefs []*Instance
type Instances ¶
type Instances []Instance
func (Instances) Added ¶
func (refs Instances) Added() InstanceRefs
func (Instances) Find ¶
func (instances Instances) Find(id containers.Identifier) (*Instance, bool)
func (Instances) Linked ¶
func (refs Instances) Linked() InstanceRefs
func (Instances) References ¶
func (instances Instances) References() InstanceRefs
func (Instances) ReferencesFor ¶
func (instances Instances) ReferencesFor(name string) InstanceRefs
type Link ¶
type Link struct { To string NonLocal bool `json:"NonLocal,omitempty"` MatchPort bool `json:"MatchPort,omitempty"` Ports port.Ports `json:"Ports,omitempty"` AliasPorts port.PortPairs `json:"AliasPorts,omitempty"` // contains filtered or unexported fields }
A relationship between two containers
type PlacementStrategy ¶
type PlacementStrategy interface { // Return true if the location of an existing container is no // longer valid. RemoveFromLocation(locator transport.Locator) bool // Allow the strategy to determine which location will host a // container by setting Instance.On for each container in added. // Failing to set an "On" for a container will return an error. // // Placement strategies may optionally suggest containers to remove // when scaling down by invoking Instance.MarkRemoved(). The caller // will then use those suggestions when determining the containers // to purge. Assign(added InstanceRefs, containers Containers) error }
type PortAssignmentStrategy ¶
type PortMapping ¶
A port on a container instance that is linked elsewhere
type PortMappings ¶
type PortMappings []PortMapping
func (PortMappings) Find ¶
func (p PortMappings) Find(port port.Port) (*PortMapping, bool)
func (PortMappings) FindTarget ¶
func (p PortMappings) FindTarget(target port.HostPort) (*PortMapping, bool)
func (PortMappings) PortPairs ¶
func (ports PortMappings) PortPairs() (dup port.PortPairs)
type SimplePlacement ¶
func (SimplePlacement) Assign ¶
func (p SimplePlacement) Assign(added InstanceRefs, containers Containers) error
func (SimplePlacement) RemoveFromLocation ¶
func (p SimplePlacement) RemoveFromLocation(on transport.Locator) bool
Click to show internal directories.
Click to hide internal directories.