Documentation
¶
Index ¶
- Variables
- func IsResourceSeize(item *common.ScaleItem) bool
- func NewCluster(scheduler *scheduler.Scheduler, TLSConfig *tls.Config, ...) (cluster.Cluster, error)
- func StopContainer(container *cluster.Container, timeout time.Duration) error
- type Cluster
- func (c *Cluster) BuildImage(buildContext io.Reader, buildImage *types.ImageBuildOptions, out io.Writer) error
- func (c *Cluster) Container(IDOrName string) *cluster.Container
- func (c *Cluster) Containers() cluster.Containers
- func (c *Cluster) CreateContainer(config *cluster.ContainerConfig, name string, authConfig *types.AuthConfig) (*cluster.Container, error)
- func (c *Cluster) CreateNetwork(name string, request *types.NetworkCreate) (response *types.NetworkCreateResponse, err error)
- func (c *Cluster) CreateVolume(request *volume.VolumesCreateBody) (*types.Volume, error)
- func (c *Cluster) Handle(e *cluster.Event) error
- func (c *Cluster) Image(IDOrName string) *cluster.Image
- func (c *Cluster) Images() cluster.Images
- func (c *Cluster) Import(source string, ref string, tag string, imageReader io.Reader, ...)
- func (c *Cluster) Info() [][2]string
- func (c *Cluster) Load(imageReader io.Reader, callback func(where, status string, err error))
- func (c *Cluster) Networks() cluster.Networks
- func (c *Cluster) Pull(name string, authConfig *types.AuthConfig, ...)
- func (c *Cluster) RANDOMENGINE() (*cluster.Engine, error)
- func (c *Cluster) RefreshEngine(hostname string) error
- func (c *Cluster) RefreshEngines() error
- func (c *Cluster) RegisterEventHandler(h cluster.EventHandler) error
- func (c *Cluster) RemoveContainer(container *cluster.Container, force, volumes bool) error
- func (c *Cluster) RemoveImages(name string, force bool) ([]types.ImageDelete, error)
- func (c *Cluster) RemoveNetwork(network *cluster.Network) error
- func (c *Cluster) RemoveVolumes(name string) (bool, error)
- func (c *Cluster) RenameContainer(container *cluster.Container, newName string) error
- func (c *Cluster) Scale(scaleConfig common.ScaleAPI) []string
- func (c *Cluster) StartContainer(container *cluster.Container, hostConfig *dockerclient.HostConfig) error
- func (c *Cluster) TagImage(IDOrName string, ref string, force bool) error
- func (c *Cluster) TotalCpus() int64
- func (c *Cluster) TotalMemory() int64
- func (c *Cluster) UnregisterEventHandler(h cluster.EventHandler)
- func (c *Cluster) Volumes() cluster.Volumes
- type ContainerFilter
- type ContainerFilterBase
- func (f *ContainerFilterBase) AddTasks(tasks *Tasks)
- func (f *ContainerFilterBase) Filter() cluster.Containers
- func (f *ContainerFilterBase) GetContainers() cluster.Containers
- func (f *ContainerFilterBase) GetItem() *common.ScaleItem
- func (f *ContainerFilterBase) GetTaskType() int
- func (f *ContainerFilterBase) SetContainers(containers cluster.Containers)
- func (f *ContainerFilterBase) SetItem(item *common.ScaleItem)
- type CreateContainerFilter
- type CreateTaskFilter
- type DestroyContainerFilter
- type DestroyTaskFilter
- type LocalProcessor
- type SeizeContainer
- type SeizeNode
- type SeizeResourceFilter
- type StartContainerFilter
- type StartTaskFilter
- type StopContainerFilter
- type StopTaskFilter
- type Task
- type TaskFilter
- type TaskProssesor
- type Tasks
Constants ¶
This section is empty.
Variables ¶
var DefaultTaskRetry = 3
DefaultTaskRetry is
Functions ¶
func IsResourceSeize ¶
IsResourceSeize is, if has constaint and inaffinity and is scale up, we decide it is seize resource
func NewCluster ¶
func NewCluster(scheduler *scheduler.Scheduler, TLSConfig *tls.Config, discovery discovery.Backend, options cluster.DriverOpts, engineOptions *cluster.EngineOpts) (cluster.Cluster, error)
NewCluster is exported
Types ¶
type Cluster ¶
type Cluster struct { sync.RWMutex TLSConfig *tls.Config // contains filtered or unexported fields }
Cluster is exported
func (*Cluster) BuildImage ¶
func (c *Cluster) BuildImage(buildContext io.Reader, buildImage *types.ImageBuildOptions, out io.Writer) error
BuildImage builds an image
func (*Cluster) Containers ¶
func (c *Cluster) Containers() cluster.Containers
Containers returns all the containers in the cluster.
func (*Cluster) CreateContainer ¶
func (c *Cluster) CreateContainer(config *cluster.ContainerConfig, name string, authConfig *types.AuthConfig) (*cluster.Container, error)
CreateContainer aka schedule a brand new container into the cluster.
func (*Cluster) CreateNetwork ¶
func (c *Cluster) CreateNetwork(name string, request *types.NetworkCreate) (response *types.NetworkCreateResponse, err error)
CreateNetwork creates a network in the cluster
func (*Cluster) CreateVolume ¶
CreateVolume creates a volume in the cluster
func (*Cluster) Import ¶
func (c *Cluster) Import(source string, ref string, tag string, imageReader io.Reader, callback func(what, status string, err error))
Import image
func (*Cluster) Pull ¶
func (c *Cluster) Pull(name string, authConfig *types.AuthConfig, callback func(where, status string, err error))
Pull is exported
func (*Cluster) RANDOMENGINE ¶
RANDOMENGINE returns a random engine.
func (*Cluster) RefreshEngine ¶
RefreshEngine refreshes all containers in a specific engine
func (*Cluster) RefreshEngines ¶
RefreshEngines refreshes all containers in the cluster
func (*Cluster) RegisterEventHandler ¶
func (c *Cluster) RegisterEventHandler(h cluster.EventHandler) error
RegisterEventHandler registers an event handler.
func (*Cluster) RemoveContainer ¶
RemoveContainer aka Remove a container from the cluster.
func (*Cluster) RemoveImages ¶
RemoveImages removes all the images that match `name` from the cluster
func (*Cluster) RemoveNetwork ¶
RemoveNetwork removes a network from the cluster
func (*Cluster) RemoveVolumes ¶
RemoveVolumes removes all the volumes that match `name` from the cluster
func (*Cluster) RenameContainer ¶
RenameContainer renames a container
func (*Cluster) StartContainer ¶
func (c *Cluster) StartContainer(container *cluster.Container, hostConfig *dockerclient.HostConfig) error
StartContainer starts a container
func (*Cluster) TotalMemory ¶
TotalMemory returns the total memory of the cluster
func (*Cluster) UnregisterEventHandler ¶
func (c *Cluster) UnregisterEventHandler(h cluster.EventHandler)
UnregisterEventHandler unregisters a previously registered event handler.
type ContainerFilter ¶
type ContainerFilter interface { // now filter type has container filter and service filter Filter() cluster.Containers AddTasks(*Tasks) }
ContainerFilter is
func NewFilter ¶
func NewFilter(c *Cluster, item *common.ScaleItem) (filter ContainerFilter)
NewFilter is
func NewSeizeResourceFilter ¶
func NewSeizeResourceFilter(c *Cluster, item *common.ScaleItem) ContainerFilter
NewSeizeResourceFilter is
type ContainerFilterBase ¶
type ContainerFilterBase struct {
// contains filtered or unexported fields
}
ContainerFilterBase is
func (*ContainerFilterBase) AddTasks ¶
func (f *ContainerFilterBase) AddTasks(tasks *Tasks)
AddTasks is
func (*ContainerFilterBase) Filter ¶
func (f *ContainerFilterBase) Filter() cluster.Containers
Filter is
func (*ContainerFilterBase) GetContainers ¶
func (f *ContainerFilterBase) GetContainers() cluster.Containers
GetContainers is
func (*ContainerFilterBase) GetItem ¶
func (f *ContainerFilterBase) GetItem() *common.ScaleItem
GetItem is
func (*ContainerFilterBase) GetTaskType ¶
func (f *ContainerFilterBase) GetTaskType() int
GetTaskType is
func (*ContainerFilterBase) SetContainers ¶
func (f *ContainerFilterBase) SetContainers(containers cluster.Containers)
SetContainers is
func (*ContainerFilterBase) SetItem ¶
func (f *ContainerFilterBase) SetItem(item *common.ScaleItem)
SetItem is
type CreateContainerFilter ¶
type CreateContainerFilter struct {
*ContainerFilterBase
}
CreateContainerFilter is
func (*CreateContainerFilter) AddTasks ¶
func (f *CreateContainerFilter) AddTasks(tasks *Tasks)
AddTasks is
func (*CreateContainerFilter) Filter ¶
func (f *CreateContainerFilter) Filter() cluster.Containers
Filter is
type CreateTaskFilter ¶
type CreateTaskFilter struct { }
CreateTaskFilter is
func (*CreateTaskFilter) DoContainers ¶
func (cf *CreateTaskFilter) DoContainers(node *SeizeNode, f *SeizeResourceFilter)
DoContainers is
func (*CreateTaskFilter) FilterContainer ¶
func (cf *CreateTaskFilter) FilterContainer(filters []common.Filter, container *cluster.Container) bool
FilterContainer is
type DestroyContainerFilter ¶
type DestroyContainerFilter struct {
*ContainerFilterBase
}
DestroyContainerFilter is
type DestroyTaskFilter ¶
type DestroyTaskFilter struct { }
DestroyTaskFilter is
func (*DestroyTaskFilter) DoContainers ¶
func (df *DestroyTaskFilter) DoContainers(node *SeizeNode, f *SeizeResourceFilter)
DoContainers is
func (*DestroyTaskFilter) FilterContainer ¶
func (df *DestroyTaskFilter) FilterContainer(filters []common.Filter, container *cluster.Container) bool
FilterContainer is
type LocalProcessor ¶
type LocalProcessor struct {
Cluster *Cluster
}
LocalProcessor is a synchronization task processor
type SeizeContainer ¶
type SeizeContainer struct {
// contains filtered or unexported fields
}
SeizeContainer is
type SeizeResourceFilter ¶
type SeizeResourceFilter struct { ScaleUpTaskType int ScaleDownTaskType int Constraints []common.Filter Inaffinities []common.Filter Filters []common.Filter AppLots int NodesPool []SeizeNode FreeNodesPool []SeizeNode // contains filtered or unexported fields }
SeizeResourceFilter is
func (*SeizeResourceFilter) AddTasks ¶
func (f *SeizeResourceFilter) AddTasks(tasks *Tasks)
AddTasks is
func (*SeizeResourceFilter) Filter ¶
func (f *SeizeResourceFilter) Filter() cluster.Containers
Filter is
type StartContainerFilter ¶
type StartContainerFilter struct {
*ContainerFilterBase
}
StartContainerFilter is
func (*StartContainerFilter) AddTasks ¶
func (f *StartContainerFilter) AddTasks(tasks *Tasks)
AddTasks is
func (*StartContainerFilter) Filter ¶
func (f *StartContainerFilter) Filter() cluster.Containers
Filter is
type StartTaskFilter ¶
type StartTaskFilter struct { }
StartTaskFilter is
func (*StartTaskFilter) DoContainers ¶
func (sf *StartTaskFilter) DoContainers(node *SeizeNode, f *SeizeResourceFilter)
DoContainers is
func (*StartTaskFilter) FilterContainer ¶
func (sf *StartTaskFilter) FilterContainer(filters []common.Filter, container *cluster.Container) bool
FilterContainer is
type StopContainerFilter ¶
type StopContainerFilter struct {
*ContainerFilterBase
}
StopContainerFilter is
func (*StopContainerFilter) Filter ¶
func (f *StopContainerFilter) Filter() cluster.Containers
Filter is
type StopTaskFilter ¶
type StopTaskFilter struct { }
StopTaskFilter is
func (*StopTaskFilter) DoContainers ¶
func (sf *StopTaskFilter) DoContainers(node *SeizeNode, f *SeizeResourceFilter)
DoContainers is
func (*StopTaskFilter) FilterContainer ¶
func (sf *StopTaskFilter) FilterContainer(filters []common.Filter, container *cluster.Container) bool
FilterContainer is
type Task ¶
type Task struct { TaskID int TaskType int Retry int //Default retry is 3 Container *cluster.Container }
Task contains task info
type TaskFilter ¶
type TaskFilter interface { FilterContainer(filters []common.Filter, container *cluster.Container) bool DoContainers(*SeizeNode, *SeizeResourceFilter) }
TaskFilter is
type TaskProssesor ¶
type TaskProssesor interface { //Product(config common.ScaleConfig) error //Consume() error Do(*Task) (string, error) }
TaskProssesor is a scale task interface, local implement or distribute queue implement
type Tasks ¶
type Tasks struct { Head *ring.Ring Current *ring.Ring Processor TaskProssesor }
Tasks is a set of task