Documentation ¶
Index ¶
- Constants
- Variables
- func AppToRaft(app *App) *rafttypes.Application
- func ContainerFromRaft(raftContainer *rafttypes.Container) *types.Container
- func ContainerToRaft(container *types.Container) *rafttypes.Container
- func DockerFromRaft(raftDocker *rafttypes.Docker) *types.Docker
- func DockerToRaft(docker *types.Docker) *rafttypes.Docker
- func HealthCheckFromRaft(raftHealthCheck *rafttypes.HealthCheck) *types.HealthCheck
- func HealthCheckToRaft(healthCheck *types.HealthCheck) *rafttypes.HealthCheck
- func KillPolicyFromRaft(raftKillPolicy *rafttypes.KillPolicy) *types.KillPolicy
- func KillPolicyToRaft(killPolicy *types.KillPolicy) *rafttypes.KillPolicy
- func LoadAppData(userEventChan chan *event.UserEvent) (map[string]*App, error)
- func LoadOfferAllocatorMap() (map[string]*OfferInfo, error)
- func OfferAllocatorItemToRaft(slotID string, offerInfo *OfferInfo) *rafttypes.OfferAllocatorItem
- func ParameterFromRaft(raftParameter *rafttypes.Parameter) *types.Parameter
- func ParameterToRaft(parameter *types.Parameter) *rafttypes.Parameter
- func PortMappingFromRaft(raftPortMapping *rafttypes.PortMapping) *types.PortMapping
- func PortMappingToRaft(portMapping *types.PortMapping) *rafttypes.PortMapping
- func SetStore(newStore store.Store)
- func SlotToRaft(slot *Slot) *rafttypes.Slot
- func StateMachineToRaft(machine *StateMachine) *rafttypes.StateMachine
- func StateToRaft(state State) *rafttypes.State
- func TaskToRaft(task *Task) *rafttypes.Task
- func UpdatePolicyFromRaft(raftUpdatePolicy *rafttypes.UpdatePolicy) *types.UpdatePolicy
- func UpdatePolicyToRaft(updatePolicy *types.UpdatePolicy) *rafttypes.UpdatePolicy
- func VersionFromRaft(raftVersion *rafttypes.Version) *types.Version
- func VersionToRaft(version *types.Version, appID string) *rafttypes.Version
- func VolumeFromFaft(raftVolume *rafttypes.Volume) *types.Volume
- func VolumeToRaft(volume *types.Volume) *rafttypes.Volume
- func WithConvertApp(ctx context.Context, app *App, cb func(), ...) error
- func WithConvertSlot(ctx context.Context, slot *Slot, cb func(), ...) error
- func WithConvertTask(ctx context.Context, task *Task, cb func(), ...) error
- type AndStatement
- type App
- func (app *App) BeginTx()
- func (app *App) CancelUpdate() error
- func (app *App) Commit()
- func (app *App) Delete() error
- func (app *App) EmitAppEvent(stateString string)
- func (app *App) GetSlot(index int) (*Slot, bool)
- func (app *App) GetSlots() []*Slot
- func (app *App) IsFixed() bool
- func (app *App) IsReplicates() bool
- func (app *App) ProceedingRollingUpdate(instances int) error
- func (app *App) Remove()
- func (app *App) RemoveSlot(index int)
- func (app *App) ScaleDown(removeInstances int) error
- func (app *App) ScaleUp(newInstances int, newIps []string) error
- func (app *App) ServiceDiscoveryURL() string
- func (app *App) SetSlot(index int, slot *Slot)
- func (app *App) StateIs(state string) bool
- func (app *App) Step()
- func (app *App) Touch(force bool)
- func (app *App) TransitTo(targetState string, args ...interface{}) error
- func (app *App) Update(version *types.Version, store store.Store) error
- type AppMode
- type AppsByUpdated
- type ConstraintParamHolder
- type ConstraintParser
- type ContainsStatement
- type EqualStatement
- type LikeStatement
- type NotStatement
- type OfferAllocator
- func (allocator *OfferAllocator) PopNextPendingOffer() *Slot
- func (allocator *OfferAllocator) PutSlotBackToPendingQueue(slot *Slot)
- func (allocator *OfferAllocator) RemoveOfferSlotMapByOfferId(offerId string)
- func (allocator *OfferAllocator) RemoveOfferSlotMapBySlot(slot *Slot)
- func (allocator *OfferAllocator) RemoveSlotFromAllocator(slot *Slot)
- func (allocator *OfferAllocator) RemoveSlotFromPendingOfferQueue(slot *Slot)
- func (allocator *OfferAllocator) RetrieveSlotIdWithOfferId(offerId string) (string, error)
- func (allocator *OfferAllocator) SetOfferSlotMap(offer *mesos.Offer, slot *Slot)
- func (allocator *OfferAllocator) SlotsByAgentID(agentID string) []string
- func (allocator *OfferAllocator) SlotsByHostname(hostname string) []string
- type OfferInfo
- type OfferWrapper
- type OrStatement
- type RestartPolicy
- type Slot
- func (slot *Slot) Abnormal() bool
- func (slot *Slot) Archive()
- func (slot *Slot) BeginTx()
- func (slot *Slot) BuildTaskEvent(eventType string) *eventbus.Event
- func (slot *Slot) Commit()
- func (slot *Slot) DispatchNewTask(version *types.Version)
- func (slot *Slot) Dispatched() bool
- func (slot *Slot) EmitTaskEvent(eventType string)
- func (slot *Slot) Healthy() bool
- func (slot *Slot) KillTask()
- func (slot *Slot) Remove()
- func (slot *Slot) ReserveOfferAndPrepareTaskInfo(ow *OfferWrapper) (*OfferWrapper, *mesos.TaskInfo)
- func (slot *Slot) ResourcesNeeded() []*mesos.Resource
- func (slot *Slot) ResourcesUsed() *SlotResource
- func (slot *Slot) ServiceDiscoveryURL() string
- func (slot *Slot) SetHealthy(healthy bool)
- func (slot *Slot) SetState(state string) error
- func (slot *Slot) StateIs(state string) bool
- func (slot *Slot) StopRestartPolicy()
- func (slot *Slot) TestOfferMatch(ow *OfferWrapper) bool
- func (slot *Slot) Touch(force bool)
- func (slot *Slot) UpdateOfferInfo(offer *mesos.Offer) error
- type SlotResource
- type SlotsById
- type State
- type StateCancelUpdate
- type StateCreating
- type StateDeleting
- func (deleting *StateDeleting) CanTransitTo(targetState string) bool
- func (deleting *StateDeleting) OnEnter()
- func (deleting *StateDeleting) OnExit()
- func (deleting *StateDeleting) SlotSafeToRemoveFromApp(slot *Slot) bool
- func (deleting *StateDeleting) StateName() string
- func (deleting *StateDeleting) Step()
- type StateMachine
- func (machine *StateMachine) CanTransitTo(targetStateString string) bool
- func (machine *StateMachine) CurrentState() State
- func (machine *StateMachine) Is(stateExpected string) bool
- func (machine *StateMachine) ReadableState() string
- func (machine *StateMachine) Start(startState State)
- func (machine *StateMachine) Step()
- func (machine *StateMachine) TransitTo(targetState State) error
- type StateNormal
- type StateScaleDown
- func (scaleDown *StateScaleDown) CanTransitTo(targetState string) bool
- func (scaleDown *StateScaleDown) OnEnter()
- func (scaleDown *StateScaleDown) OnExit()
- func (scaleDown *StateScaleDown) SlotSafeToRemoveFromApp(slot *Slot) bool
- func (scaleDown *StateScaleDown) StateName() string
- func (scaleDown *StateScaleDown) Step()
- type StateScaleUp
- type StateUpdating
- type Statement
- type Task
- type TaskBuilder
- func (builder *TaskBuilder) AppendContainerDockerEnvironments(envs map[string]string) *TaskBuilder
- func (builder *TaskBuilder) AppendContainerDockerParameters(parameters []*types.Parameter) *TaskBuilder
- func (builder *TaskBuilder) AppendContainerDockerVolumes(volumes []*types.Volume) *TaskBuilder
- func (builder *TaskBuilder) AppendTaskInfoLabels(labelMap map[string]string) *TaskBuilder
- func (builder *TaskBuilder) GetTaskInfo() *mesos.TaskInfo
- func (builder *TaskBuilder) SetAgentId(agentId string) *TaskBuilder
- func (builder *TaskBuilder) SetCommand(needShell bool, cmd string, args []string) *TaskBuilder
- func (builder *TaskBuilder) SetContainerDockerForcePullImage(force bool) *TaskBuilder
- func (builder *TaskBuilder) SetContainerDockerImage(image string) *TaskBuilder
- func (builder *TaskBuilder) SetContainerDockerPrivileged(privileged bool) *TaskBuilder
- func (builder *TaskBuilder) SetContainerType(containerType string) *TaskBuilder
- func (builder *TaskBuilder) SetHealthCheck(healthCheck *types.HealthCheck) *TaskBuilder
- func (builder *TaskBuilder) SetName(name string) *TaskBuilder
- func (builder *TaskBuilder) SetNetwork(network string, portsAvailable []uint64) *TaskBuilder
- func (builder *TaskBuilder) SetResources(resources []*mesos.Resource) *TaskBuilder
- func (builder *TaskBuilder) SetTaskId(taskId string) *TaskBuilder
- func (builder *TaskBuilder) SetURIs(uriList []string) *TaskBuilder
- type TestAndRestartFunc
- type UniqueStatment
Constants ¶
const ( APP_STATE_NORMAL = "normal" APP_STATE_CREATING = "creating" APP_STATE_DELETING = "deleting" APP_STATE_UPDATING = "updating" APP_STATE_CANCEL_UPDATE = "cancel_update" APP_STATE_SCALE_UP = "scale_up" APP_STATE_SCALE_DOWN = "scale_down" )
const ( SLOT_STATE_PENDING_OFFER = "slot_task_pending_offer" SLOT_STATE_PENDING_KILL = "slot_task_pending_killed" SLOT_STATE_REAP = "slot_task_reap" SLOT_STATE_TASK_STAGING = "slot_task_staging" SLOT_STATE_TASK_STARTING = "slot_task_starting" SLOT_STATE_TASK_RUNNING = "slot_task_running" SLOT_STATE_TASK_KILLING = "slot_task_killing" SLOT_STATE_TASK_FINISHED = "slot_task_finished" SLOT_STATE_TASK_FAILED = "slot_task_failed" SLOT_STATE_TASK_KILLED = "slot_task_killed" SLOT_STATE_TASK_ERROR = "slot_task_error" SLOT_STATE_TASK_LOST = "slot_task_lost" SLOT_STATE_TASK_DROPPED = "slot_task_dropped" SLOT_STATE_TASK_UNREACHABLE = "slot_task_unreachable" SLOT_STATE_TASK_GONE = "slot_task_gone" SLOT_STATE_TASK_GONE_BY_OPERATOR = "slot_task_gone_by_operator" SLOT_STATE_TASK_UNKNOWN = "slot_task_unknown" )
const AND = 57346
const CONTAINS = 57350
const EQUAL = 57352
const IDENTIFIER = 57353
const LIKE = 57349
const NOT = 57351
const OR = 57347
const UNIQUE = 57348
Variables ¶
var ValidNextTransitionState = []string{ APP_STATE_CANCEL_UPDATE, APP_STATE_DELETING, APP_STATE_UPDATING, APP_STATE_NORMAL, }
Functions ¶
func AppToRaft ¶
func AppToRaft(app *App) *rafttypes.Application
func ContainerFromRaft ¶
func HealthCheckFromRaft ¶
func HealthCheckFromRaft(raftHealthCheck *rafttypes.HealthCheck) *types.HealthCheck
func HealthCheckToRaft ¶
func HealthCheckToRaft(healthCheck *types.HealthCheck) *rafttypes.HealthCheck
func KillPolicyFromRaft ¶
func KillPolicyFromRaft(raftKillPolicy *rafttypes.KillPolicy) *types.KillPolicy
func KillPolicyToRaft ¶
func KillPolicyToRaft(killPolicy *types.KillPolicy) *rafttypes.KillPolicy
func LoadAppData ¶
load app data frm persistent data
func LoadOfferAllocatorMap ¶
func OfferAllocatorItemToRaft ¶
func OfferAllocatorItemToRaft(slotID string, offerInfo *OfferInfo) *rafttypes.OfferAllocatorItem
func ParameterFromRaft ¶
func PortMappingFromRaft ¶
func PortMappingFromRaft(raftPortMapping *rafttypes.PortMapping) *types.PortMapping
func PortMappingToRaft ¶
func PortMappingToRaft(portMapping *types.PortMapping) *rafttypes.PortMapping
func SlotToRaft ¶
func StateMachineToRaft ¶ added in v0.1.9
func StateMachineToRaft(machine *StateMachine) *rafttypes.StateMachine
func StateToRaft ¶ added in v0.1.9
func TaskToRaft ¶
func UpdatePolicyFromRaft ¶
func UpdatePolicyFromRaft(raftUpdatePolicy *rafttypes.UpdatePolicy) *types.UpdatePolicy
func UpdatePolicyToRaft ¶
func UpdatePolicyToRaft(updatePolicy *types.UpdatePolicy) *rafttypes.UpdatePolicy
func WithConvertApp ¶
func WithConvertSlot ¶
Types ¶
type AndStatement ¶ added in v0.1.3
and (unique hostname) (unique ip) and (not (unique hostname)) (unique ip)
func (*AndStatement) Eval ¶ added in v0.1.3
func (as *AndStatement) Eval() bool
func (*AndStatement) SetContext ¶ added in v0.1.3
func (as *AndStatement) SetContext(ctx *ConstraintParamHolder)
func (*AndStatement) Valid ¶ added in v0.1.3
func (as *AndStatement) Valid() error
type App ¶
type App struct { ID string `json:"id"` Name string `json:"name"` Versions []*types.Version `json:"versions"` Slots map[int]*Slot `json:"slots"` // app run with CurrentVersion config CurrentVersion *types.Version `json:"current_version"` // use when app updated, ProposedVersion can either be commit or revert ProposedVersion *types.Version `json:"proposed_version"` Mode AppMode `json:"mode"` // fixed or repliactes Created time.Time Updated time.Time StateMachine *StateMachine ClusterID string UserEventChan chan *event.UserEvent // contains filtered or unexported fields }
func (*App) CancelUpdate ¶
func (*App) Commit ¶
func (app *App) Commit()
here we persist the app anyway, no matter it touched or not
func (*App) Delete ¶
delete a application and all related objects: versions, tasks, slots, proxies, dns record
func (*App) EmitAppEvent ¶
func (*App) IsReplicates ¶
func (*App) ProceedingRollingUpdate ¶
func (*App) Remove ¶
func (app *App) Remove()
1, remove app from persisted storage 2, other cleanup process
func (*App) RemoveSlot ¶
func (*App) ServiceDiscoveryURL ¶ added in v0.1.3
type AppsByUpdated ¶ added in v0.1.3
type AppsByUpdated []*App
func (AppsByUpdated) Len ¶ added in v0.1.3
func (a AppsByUpdated) Len() int
func (AppsByUpdated) Less ¶ added in v0.1.3
func (a AppsByUpdated) Less(i, j int) bool
func (AppsByUpdated) Swap ¶ added in v0.1.3
func (a AppsByUpdated) Swap(i, j int)
type ConstraintParamHolder ¶ added in v0.1.3
type ConstraintParser ¶ added in v0.1.3
func (*ConstraintParser) Error ¶ added in v0.1.3
func (l *ConstraintParser) Error(e string)
func (*ConstraintParser) Lex ¶ added in v0.1.3
func (l *ConstraintParser) Lex(lval *yySymType) int
type ContainsStatement ¶ added in v0.1.3
type ContainsStatement struct { ConstraintParamHolder What string Regex string }
contains hostname barfoo
func (*ContainsStatement) Eval ¶ added in v0.1.3
func (cs *ContainsStatement) Eval() bool
func (*ContainsStatement) SetContext ¶ added in v0.1.3
func (cs *ContainsStatement) SetContext(ctx *ConstraintParamHolder)
func (*ContainsStatement) Valid ¶ added in v0.1.3
func (cs *ContainsStatement) Valid() error
type EqualStatement ¶ added in v0.1.5
type EqualStatement struct { ConstraintParamHolder What string Regex string }
equal hostname xxxx
func (*EqualStatement) Eval ¶ added in v0.1.5
func (ls *EqualStatement) Eval() bool
func (*EqualStatement) SetContext ¶ added in v0.1.5
func (ls *EqualStatement) SetContext(ctx *ConstraintParamHolder)
func (*EqualStatement) Valid ¶ added in v0.1.5
func (ls *EqualStatement) Valid() error
type LikeStatement ¶ added in v0.1.3
type LikeStatement struct { ConstraintParamHolder What string Regex string }
like hostname foobar*
func (*LikeStatement) Eval ¶ added in v0.1.3
func (ls *LikeStatement) Eval() bool
func (*LikeStatement) SetContext ¶ added in v0.1.3
func (ls *LikeStatement) SetContext(ctx *ConstraintParamHolder)
func (*LikeStatement) Valid ¶ added in v0.1.3
func (ls *LikeStatement) Valid() error
type NotStatement ¶ added in v0.1.3
type NotStatement struct {
Op1 Statement
}
not (unique hostname)
func (*NotStatement) Eval ¶ added in v0.1.3
func (ns *NotStatement) Eval() bool
func (*NotStatement) SetContext ¶ added in v0.1.3
func (ns *NotStatement) SetContext(ctx *ConstraintParamHolder)
func (*NotStatement) Valid ¶ added in v0.1.3
func (ns *NotStatement) Valid() error
type OfferAllocator ¶
type OfferAllocator struct { PendingOfferSlots []*Slot AllocatedOffer map[string]*OfferInfo // we store every offer that are occupied by running slot // contains filtered or unexported fields }
func OfferAllocatorInstance ¶
func OfferAllocatorInstance() *OfferAllocator
func (*OfferAllocator) PopNextPendingOffer ¶
func (allocator *OfferAllocator) PopNextPendingOffer() *Slot
func (*OfferAllocator) PutSlotBackToPendingQueue ¶
func (allocator *OfferAllocator) PutSlotBackToPendingQueue(slot *Slot)
func (*OfferAllocator) RemoveOfferSlotMapByOfferId ¶
func (allocator *OfferAllocator) RemoveOfferSlotMapByOfferId(offerId string)
func (*OfferAllocator) RemoveOfferSlotMapBySlot ¶
func (allocator *OfferAllocator) RemoveOfferSlotMapBySlot(slot *Slot)
func (*OfferAllocator) RemoveSlotFromAllocator ¶ added in v0.1.3
func (allocator *OfferAllocator) RemoveSlotFromAllocator(slot *Slot)
func (*OfferAllocator) RemoveSlotFromPendingOfferQueue ¶
func (allocator *OfferAllocator) RemoveSlotFromPendingOfferQueue(slot *Slot)
func (*OfferAllocator) RetrieveSlotIdWithOfferId ¶ added in v0.1.3
func (allocator *OfferAllocator) RetrieveSlotIdWithOfferId(offerId string) (string, error)
func (*OfferAllocator) SetOfferSlotMap ¶
func (allocator *OfferAllocator) SetOfferSlotMap(offer *mesos.Offer, slot *Slot)
func (*OfferAllocator) SlotsByAgentID ¶ added in v0.1.3
func (allocator *OfferAllocator) SlotsByAgentID(agentID string) []string
func (*OfferAllocator) SlotsByHostname ¶ added in v0.1.3
func (allocator *OfferAllocator) SlotsByHostname(hostname string) []string
type OfferInfo ¶ added in v0.1.3
func OfferAllocatorItemFromRaft ¶
func OfferAllocatorItemFromRaft(item *rafttypes.OfferAllocatorItem) (slotID string, offerInfo *OfferInfo)
type OfferWrapper ¶
type OfferWrapper struct { Offer *mesos.Offer CpusUsed float64 MemUsed float64 DiskUsed float64 PortUsedSize int }
wrapper offer to record offer reserve history
func NewOfferWrapper ¶
func NewOfferWrapper(offer *mesos.Offer) *OfferWrapper
func (*OfferWrapper) CpuRemain ¶
func (ow *OfferWrapper) CpuRemain() float64
func (*OfferWrapper) DiskRemain ¶
func (ow *OfferWrapper) DiskRemain() float64
func (*OfferWrapper) MemRemain ¶
func (ow *OfferWrapper) MemRemain() float64
func (*OfferWrapper) PortsRemain ¶
func (ow *OfferWrapper) PortsRemain() []uint64
type OrStatement ¶ added in v0.1.3
type OrStatement struct { ConstraintParamHolder Op1 Statement Op2 Statement }
or (like ip foobar) (unique hostname)
func (*OrStatement) Eval ¶ added in v0.1.3
func (os *OrStatement) Eval() bool
func (*OrStatement) SetContext ¶ added in v0.1.3
func (os *OrStatement) SetContext(ctx *ConstraintParamHolder)
func (*OrStatement) Valid ¶ added in v0.1.3
func (os *OrStatement) Valid() error
type RestartPolicy ¶
type RestartPolicy struct { BackoffSeconds time.Duration BackoffFactor float64 MaxLaunchDelaySeconds time.Duration // contains filtered or unexported fields }
func NewRestartPolicy ¶
func NewRestartPolicy(slot *Slot, BackoffSeconds time.Duration, BackoffFactor float64, MaxLaunchDelaySeconds time.Duration, restartFunc TestAndRestartFunc) *RestartPolicy
func (*RestartPolicy) Stop ¶
func (rs *RestartPolicy) Stop()
type Slot ¶
type Slot struct { Index int ID string App *App Version *types.Version State string CurrentTask *Task TaskHistory []*Task OfferID string AgentID string Ip string AgentHostName string // contains filtered or unexported fields }
func LoadAppSlots ¶
func SlotFromRaft ¶
func (*Slot) Commit ¶
func (slot *Slot) Commit()
here we persist the app anyway, no matter it touched or not
func (*Slot) DispatchNewTask ¶
func (*Slot) Dispatched ¶
func (*Slot) EmitTaskEvent ¶
func (*Slot) KillTask ¶
func (slot *Slot) KillTask()
kill task doesn't need cleanup slot from app.Slots
func (*Slot) ReserveOfferAndPrepareTaskInfo ¶
func (slot *Slot) ReserveOfferAndPrepareTaskInfo(ow *OfferWrapper) (*OfferWrapper, *mesos.TaskInfo)
func (*Slot) ResourcesNeeded ¶
func (*Slot) ResourcesUsed ¶
func (slot *Slot) ResourcesUsed() *SlotResource
func (*Slot) ServiceDiscoveryURL ¶ added in v0.1.3
func (*Slot) SetHealthy ¶
func (*Slot) StopRestartPolicy ¶
func (slot *Slot) StopRestartPolicy()
func (*Slot) TestOfferMatch ¶
func (slot *Slot) TestOfferMatch(ow *OfferWrapper) bool
type SlotResource ¶
type State ¶ added in v0.1.9
type StateCancelUpdate ¶ added in v0.1.9
type StateCancelUpdate struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int // contains filtered or unexported fields }
func NewStateCancelUpdate ¶ added in v0.1.9
func NewStateCancelUpdate(app *App) *StateCancelUpdate
func (*StateCancelUpdate) CanTransitTo ¶ added in v0.1.9
func (cancelUpdate *StateCancelUpdate) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is cancelUpdate
func (*StateCancelUpdate) OnEnter ¶ added in v0.1.9
func (cancelUpdate *StateCancelUpdate) OnEnter()
func (*StateCancelUpdate) OnExit ¶ added in v0.1.9
func (cancelUpdate *StateCancelUpdate) OnExit()
func (*StateCancelUpdate) StateName ¶ added in v0.1.9
func (cancelUpdate *StateCancelUpdate) StateName() string
func (*StateCancelUpdate) Step ¶ added in v0.1.9
func (cancelUpdate *StateCancelUpdate) Step()
type StateCreating ¶ added in v0.1.9
type StateCreating struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int // contains filtered or unexported fields }
func NewStateCreating ¶ added in v0.1.9
func NewStateCreating(app *App) *StateCreating
func (*StateCreating) CanTransitTo ¶ added in v0.1.9
func (creating *StateCreating) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is creating
func (*StateCreating) OnEnter ¶ added in v0.1.9
func (creating *StateCreating) OnEnter()
func (*StateCreating) OnExit ¶ added in v0.1.9
func (creating *StateCreating) OnExit()
func (*StateCreating) StateName ¶ added in v0.1.9
func (creating *StateCreating) StateName() string
func (*StateCreating) Step ¶ added in v0.1.9
func (creating *StateCreating) Step()
type StateDeleting ¶ added in v0.1.9
type StateDeleting struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int // contains filtered or unexported fields }
func NewStateDeleting ¶ added in v0.1.9
func NewStateDeleting(app *App) *StateDeleting
func (*StateDeleting) CanTransitTo ¶ added in v0.1.9
func (deleting *StateDeleting) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is deleting
func (*StateDeleting) OnEnter ¶ added in v0.1.9
func (deleting *StateDeleting) OnEnter()
func (*StateDeleting) OnExit ¶ added in v0.1.9
func (deleting *StateDeleting) OnExit()
func (*StateDeleting) SlotSafeToRemoveFromApp ¶ added in v0.1.9
func (deleting *StateDeleting) SlotSafeToRemoveFromApp(slot *Slot) bool
func (*StateDeleting) StateName ¶ added in v0.1.9
func (deleting *StateDeleting) StateName() string
func (*StateDeleting) Step ¶ added in v0.1.9
func (deleting *StateDeleting) Step()
type StateMachine ¶ added in v0.1.9
type StateMachine struct {
// contains filtered or unexported fields
}
func NewStateMachine ¶ added in v0.1.9
func NewStateMachine() *StateMachine
default state for a new statemachine is creating
func StateMachineFromRaft ¶ added in v0.1.9
func StateMachineFromRaft(app *App, machine *rafttypes.StateMachine) *StateMachine
func (*StateMachine) CanTransitTo ¶ added in v0.1.9
func (machine *StateMachine) CanTransitTo(targetStateString string) bool
test if targetState is changable
func (*StateMachine) CurrentState ¶ added in v0.1.9
func (machine *StateMachine) CurrentState() State
func (*StateMachine) Is ¶ added in v0.1.9
func (machine *StateMachine) Is(stateExpected string) bool
test machine.state is stateExpected
func (*StateMachine) ReadableState ¶ added in v0.1.9
func (machine *StateMachine) ReadableState() string
func (*StateMachine) Start ¶ added in v0.1.9
func (machine *StateMachine) Start(startState State)
func (*StateMachine) Step ¶ added in v0.1.9
func (machine *StateMachine) Step()
move state machine step foward
func (*StateMachine) TransitTo ¶ added in v0.1.9
func (machine *StateMachine) TransitTo(targetState State) error
transition from one state to another, return error if not a valid transtion condition
type StateNormal ¶ added in v0.1.9
func NewStateNormal ¶ added in v0.1.9
func NewStateNormal(app *App) *StateNormal
func (*StateNormal) CanTransitTo ¶ added in v0.1.9
func (normal *StateNormal) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is normal
func (*StateNormal) OnEnter ¶ added in v0.1.9
func (normal *StateNormal) OnEnter()
func (*StateNormal) OnExit ¶ added in v0.1.9
func (normal *StateNormal) OnExit()
func (*StateNormal) StateName ¶ added in v0.1.9
func (normal *StateNormal) StateName() string
func (*StateNormal) Step ¶ added in v0.1.9
func (normal *StateNormal) Step()
type StateScaleDown ¶ added in v0.1.9
type StateScaleDown struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int // contains filtered or unexported fields }
func NewStateScaleDown ¶ added in v0.1.9
func NewStateScaleDown(app *App) *StateScaleDown
func (*StateScaleDown) CanTransitTo ¶ added in v0.1.9
func (scaleDown *StateScaleDown) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is scaleDown
func (*StateScaleDown) OnEnter ¶ added in v0.1.9
func (scaleDown *StateScaleDown) OnEnter()
func (*StateScaleDown) OnExit ¶ added in v0.1.9
func (scaleDown *StateScaleDown) OnExit()
func (*StateScaleDown) SlotSafeToRemoveFromApp ¶ added in v0.1.9
func (scaleDown *StateScaleDown) SlotSafeToRemoveFromApp(slot *Slot) bool
func (*StateScaleDown) StateName ¶ added in v0.1.9
func (scaleDown *StateScaleDown) StateName() string
func (*StateScaleDown) Step ¶ added in v0.1.9
func (scaleDown *StateScaleDown) Step()
type StateScaleUp ¶ added in v0.1.9
type StateScaleUp struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int // contains filtered or unexported fields }
func NewStateScaleUp ¶ added in v0.1.9
func NewStateScaleUp(app *App) *StateScaleUp
func (*StateScaleUp) CanTransitTo ¶ added in v0.1.9
func (scaleUp *StateScaleUp) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is scaleUp
func (*StateScaleUp) OnEnter ¶ added in v0.1.9
func (scaleUp *StateScaleUp) OnEnter()
func (*StateScaleUp) OnExit ¶ added in v0.1.9
func (scaleUp *StateScaleUp) OnExit()
func (*StateScaleUp) StateName ¶ added in v0.1.9
func (scaleUp *StateScaleUp) StateName() string
func (*StateScaleUp) Step ¶ added in v0.1.9
func (scaleUp *StateScaleUp) Step()
type StateUpdating ¶ added in v0.1.9
type StateUpdating struct { Name string App *App CurrentSlot *Slot CurrentSlotIndex int TargetSlotIndex int SlotCountNeedUpdate int // contains filtered or unexported fields }
func NewStateUpdating ¶ added in v0.1.9
func NewStateUpdating(app *App, slotCountNeedUpdate int) *StateUpdating
func (*StateUpdating) CanTransitTo ¶ added in v0.1.9
func (updating *StateUpdating) CanTransitTo(targetState string) bool
state machine can transit to any state if current state is updating
func (*StateUpdating) OnEnter ¶ added in v0.1.9
func (updating *StateUpdating) OnEnter()
func (*StateUpdating) OnExit ¶ added in v0.1.9
func (updating *StateUpdating) OnExit()
func (*StateUpdating) StateName ¶ added in v0.1.9
func (updating *StateUpdating) StateName() string
func (*StateUpdating) Step ¶ added in v0.1.9
func (updating *StateUpdating) Step()
type Statement ¶ added in v0.1.3
type Statement interface { Eval() bool Valid() error SetContext(ctx *ConstraintParamHolder) }
func ParseConstraint ¶ added in v0.1.3
type Task ¶
type Task struct { ID string Version *types.Version Slot *Slot State string Stdout string Stderr string HostPorts []uint64 OfferID string AgentID string Ip string AgentHostName string Reason string // mesos updateStatus field Message string // mesos updateStatus field Source string // mesos updateStatus field Created time.Time ArchivedAt time.Time // contains filtered or unexported fields }
func TaskFromRaft ¶
func (*Task) PrepareTaskInfo ¶
func (task *Task) PrepareTaskInfo(ow *OfferWrapper) *mesos.TaskInfo
type TaskBuilder ¶
type TaskBuilder struct { HostPorts []uint64 // contains filtered or unexported fields }
func NewTaskBuilder ¶
func NewTaskBuilder(task *Task) *TaskBuilder
func (*TaskBuilder) AppendContainerDockerEnvironments ¶
func (builder *TaskBuilder) AppendContainerDockerEnvironments(envs map[string]string) *TaskBuilder
func (*TaskBuilder) AppendContainerDockerParameters ¶
func (builder *TaskBuilder) AppendContainerDockerParameters(parameters []*types.Parameter) *TaskBuilder
func (*TaskBuilder) AppendContainerDockerVolumes ¶
func (builder *TaskBuilder) AppendContainerDockerVolumes(volumes []*types.Volume) *TaskBuilder
func (*TaskBuilder) AppendTaskInfoLabels ¶
func (builder *TaskBuilder) AppendTaskInfoLabels(labelMap map[string]string) *TaskBuilder
func (*TaskBuilder) GetTaskInfo ¶
func (builder *TaskBuilder) GetTaskInfo() *mesos.TaskInfo
func (*TaskBuilder) SetAgentId ¶
func (builder *TaskBuilder) SetAgentId(agentId string) *TaskBuilder
func (*TaskBuilder) SetCommand ¶
func (builder *TaskBuilder) SetCommand(needShell bool, cmd string, args []string) *TaskBuilder
func (*TaskBuilder) SetContainerDockerForcePullImage ¶
func (builder *TaskBuilder) SetContainerDockerForcePullImage(force bool) *TaskBuilder
func (*TaskBuilder) SetContainerDockerImage ¶
func (builder *TaskBuilder) SetContainerDockerImage(image string) *TaskBuilder
func (*TaskBuilder) SetContainerDockerPrivileged ¶
func (builder *TaskBuilder) SetContainerDockerPrivileged(privileged bool) *TaskBuilder
func (*TaskBuilder) SetContainerType ¶
func (builder *TaskBuilder) SetContainerType(containerType string) *TaskBuilder
func (*TaskBuilder) SetHealthCheck ¶
func (builder *TaskBuilder) SetHealthCheck(healthCheck *types.HealthCheck) *TaskBuilder
func (*TaskBuilder) SetName ¶
func (builder *TaskBuilder) SetName(name string) *TaskBuilder
func (*TaskBuilder) SetNetwork ¶
func (builder *TaskBuilder) SetNetwork(network string, portsAvailable []uint64) *TaskBuilder
func (*TaskBuilder) SetResources ¶
func (builder *TaskBuilder) SetResources(resources []*mesos.Resource) *TaskBuilder
func (*TaskBuilder) SetTaskId ¶
func (builder *TaskBuilder) SetTaskId(taskId string) *TaskBuilder
func (*TaskBuilder) SetURIs ¶
func (builder *TaskBuilder) SetURIs(uriList []string) *TaskBuilder
type TestAndRestartFunc ¶
type UniqueStatment ¶ added in v0.1.3
type UniqueStatment struct { ConstraintParamHolder What string }
(unique hostname)
func (*UniqueStatment) Eval ¶ added in v0.1.3
func (us *UniqueStatment) Eval() bool
func (*UniqueStatment) SetContext ¶ added in v0.1.3
func (us *UniqueStatment) SetContext(ctx *ConstraintParamHolder)
func (*UniqueStatment) Valid ¶ added in v0.1.3
func (us *UniqueStatment) Valid() error
Source Files ¶
- app.go
- app_state_machine.go
- constraints.go
- constraints_parser.y
- convert.go
- graceful.go
- offer_allocator.go
- offer_wrapper.go
- raft_helper.go
- recover.go
- slot.go
- state_cancel_update.go
- state_creating.go
- state_deleting.go
- state_normal.go
- state_scale_down.go
- state_scale_up.go
- state_updating.go
- task.go
- task_builder.go