Versions in this module Expand all Collapse all v0 v0.1.9 Mar 20, 2017 Changes in this version + const APP_STATE_CANCEL_UPDATE + const APP_STATE_CREATING + const APP_STATE_DELETING + const APP_STATE_SCALE_DOWN + const APP_STATE_SCALE_UP + const APP_STATE_UPDATING + var ValidNextTransitionState = []string + func StateMachineToRaft(machine *StateMachine) *rafttypes.StateMachine + func StateToRaft(state State) *rafttypes.State type App + Slots map[int]*Slot + StateMachine *StateMachine + func (app *App) Step() + func (app *App) TransitTo(targetState string, args ...interface{}) error + type State interface + CanTransitTo func(targetState string) bool + OnEnter func() + OnExit func() + StateName func() string + Step func() + func StateFromRaft(app *App, state *rafttypes.State) State + type StateCancelUpdate struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + TargetSlotIndex int + func NewStateCancelUpdate(app *App) *StateCancelUpdate + func (cancelUpdate *StateCancelUpdate) CanTransitTo(targetState string) bool + func (cancelUpdate *StateCancelUpdate) OnEnter() + func (cancelUpdate *StateCancelUpdate) OnExit() + func (cancelUpdate *StateCancelUpdate) StateName() string + func (cancelUpdate *StateCancelUpdate) Step() + type StateCreating struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + TargetSlotIndex int + func NewStateCreating(app *App) *StateCreating + func (creating *StateCreating) CanTransitTo(targetState string) bool + func (creating *StateCreating) OnEnter() + func (creating *StateCreating) OnExit() + func (creating *StateCreating) StateName() string + func (creating *StateCreating) Step() + type StateDeleting struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + TargetSlotIndex int + func NewStateDeleting(app *App) *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 struct + func NewStateMachine() *StateMachine + func StateMachineFromRaft(app *App, machine *rafttypes.StateMachine) *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 struct + App *App + Name string + func NewStateNormal(app *App) *StateNormal + func (normal *StateNormal) CanTransitTo(targetState string) bool + func (normal *StateNormal) OnEnter() + func (normal *StateNormal) OnExit() + func (normal *StateNormal) StateName() string + func (normal *StateNormal) Step() + type StateScaleDown struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + TargetSlotIndex int + func NewStateScaleDown(app *App) *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 struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + TargetSlotIndex int + func NewStateScaleUp(app *App) *StateScaleUp + func (scaleUp *StateScaleUp) CanTransitTo(targetState string) bool + func (scaleUp *StateScaleUp) OnEnter() + func (scaleUp *StateScaleUp) OnExit() + func (scaleUp *StateScaleUp) StateName() string + func (scaleUp *StateScaleUp) Step() + type StateUpdating struct + App *App + CurrentSlot *Slot + CurrentSlotIndex int + Name string + SlotCountNeedUpdate int + TargetSlotIndex int + func NewStateUpdating(app *App, slotCountNeedUpdate int) *StateUpdating + func (updating *StateUpdating) CanTransitTo(targetState string) bool + func (updating *StateUpdating) OnEnter() + func (updating *StateUpdating) OnExit() + func (updating *StateUpdating) StateName() string + func (updating *StateUpdating) Step() v0.1.7 Mar 6, 2017 v0.1.5 Feb 27, 2017 Changes in this version + const EQUAL + type EqualStatement struct + Regex string + What string + func (ls *EqualStatement) Eval() bool + func (ls *EqualStatement) SetContext(ctx *ConstraintParamHolder) + func (ls *EqualStatement) Valid() error v0.1.3 Feb 17, 2017 Changes in this version + const AND + const CONTAINS + const IDENTIFIER + const LIKE + const NOT + const OR + const UNIQUE + type AndStatement struct + Op1 Statement + Op2 Statement + func (as *AndStatement) Eval() bool + func (as *AndStatement) SetContext(ctx *ConstraintParamHolder) + func (as *AndStatement) Valid() error type App + func (app *App) ServiceDiscoveryURL() string + type AppsByUpdated []*App + func (a AppsByUpdated) Len() int + func (a AppsByUpdated) Less(i, j int) bool + func (a AppsByUpdated) Swap(i, j int) + type ConstraintParamHolder struct + Offer *mesos.Offer + Slot *Slot + type ConstraintParser struct + func (l *ConstraintParser) Error(e string) + func (l *ConstraintParser) Lex(lval *yySymType) int + type ContainsStatement struct + Regex string + What string + func (cs *ContainsStatement) Eval() bool + func (cs *ContainsStatement) SetContext(ctx *ConstraintParamHolder) + func (cs *ContainsStatement) Valid() error + type LikeStatement struct + Regex string + What string + func (ls *LikeStatement) Eval() bool + func (ls *LikeStatement) SetContext(ctx *ConstraintParamHolder) + func (ls *LikeStatement) Valid() error + type NotStatement struct + Op1 Statement + func (ns *NotStatement) Eval() bool + func (ns *NotStatement) SetContext(ctx *ConstraintParamHolder) + func (ns *NotStatement) Valid() error type OfferAllocator + AllocatedOffer map[string]*OfferInfo + func (allocator *OfferAllocator) RemoveSlotFromAllocator(slot *Slot) + func (allocator *OfferAllocator) RetrieveSlotIdWithOfferId(offerId string) (string, error) + func (allocator *OfferAllocator) SlotsByAgentID(agentID string) []string + func (allocator *OfferAllocator) SlotsByHostname(hostname string) []string + type OfferInfo struct + AgentID string + AgentIP string + Hostname string + OfferID string + type OrStatement struct + Op1 Statement + Op2 Statement + func (os *OrStatement) Eval() bool + func (os *OrStatement) SetContext(ctx *ConstraintParamHolder) + func (os *OrStatement) Valid() error type Slot + func (slot *Slot) ServiceDiscoveryURL() string + type Statement interface + Eval func() bool + SetContext func(ctx *ConstraintParamHolder) + Valid func() error + func ParseConstraint(c string) (Statement, error) type Task + ArchivedAt time.Time + type UniqueStatment struct + What string + func (us *UniqueStatment) Eval() bool + func (us *UniqueStatment) SetContext(ctx *ConstraintParamHolder) + func (us *UniqueStatment) Valid() error v0.1.1 Jan 17, 2017 Changes in this version + const APP_STATE_MARK_FOR_CANCEL_UPDATE + const APP_STATE_MARK_FOR_CREATING + const APP_STATE_MARK_FOR_DELETION + const APP_STATE_MARK_FOR_SCALE_DOWN + const APP_STATE_MARK_FOR_SCALE_UP + const APP_STATE_MARK_FOR_UPDATING + const APP_STATE_NORMAL + const SLOT_STATE_PENDING_KILL + const SLOT_STATE_PENDING_OFFER + const SLOT_STATE_REAP + const SLOT_STATE_TASK_DROPPED + const SLOT_STATE_TASK_ERROR + const SLOT_STATE_TASK_FAILED + const SLOT_STATE_TASK_FINISHED + const SLOT_STATE_TASK_GONE + const SLOT_STATE_TASK_GONE_BY_OPERATOR + const SLOT_STATE_TASK_KILLED + const SLOT_STATE_TASK_KILLING + const SLOT_STATE_TASK_LOST + const SLOT_STATE_TASK_RUNNING + const SLOT_STATE_TASK_STAGING + const SLOT_STATE_TASK_STARTING + const SLOT_STATE_TASK_UNKNOWN + const SLOT_STATE_TASK_UNREACHABLE + const SWAN_RESERVED_NETWORK + func AppToRaft(app *App) *rafttypes.Application + func CommandFromRaft(raftCommand *rafttypes.Command) *types.Command + func CommandToRaft(command *types.Command) *rafttypes.Command + 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]*mesos.OfferID, error) + func OfferAllocatorItemFromRaft(item *rafttypes.OfferAllocatorItem) (slotID, offerID string) + func OfferAllocatorItemToRaft(slotID, offerID string) *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 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 App struct + ClusterID string + Created time.Time + CurrentVersion *types.Version + ID string + Mode AppMode + Name string + ProposedVersion *types.Version + State string + Updated time.Time + UserEventChan chan *event.UserEvent + Versions []*types.Version + func NewApp(version *types.Version, userEventChan chan *event.UserEvent) (*App, error) + func (app *App) BeginTx() + func (app *App) BuildAppEvent(eventType string) *swanevent.Event + func (app *App) CanBeCleanAfterDeletion() bool + func (app *App) CancelUpdate() error + func (app *App) Commit() + func (app *App) Delete() error + func (app *App) EmitAppEvent(eventType string) + func (app *App) EmitEvent(swanEvent *swanevent.Event) + 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) MarkForDeletionInstances() int + func (app *App) ProceedingRollingUpdate(instances int) error + func (app *App) Reevaluate() + func (app *App) Remove() + func (app *App) RemoveSlot(index int) + func (app *App) RollingUpdateInstances() int + func (app *App) RunningInstances() int + func (app *App) ScaleDown(removeInstances int) error + func (app *App) ScaleUp(newInstances int, newIps []string) error + func (app *App) SetSlot(index int, slot *Slot) + func (app *App) SetState(state string) + func (app *App) StateIs(state string) bool + func (app *App) Touch(force bool) + func (app *App) Update(version *types.Version, store store.Store) error + type AppMode string + var APP_MODE_FIXED AppMode = "fixed" + var APP_MODE_REPLICATES AppMode = "replicates" + type OfferAllocator struct + BySlotId map[string]*mesos.OfferID + PendingOfferSlots []*Slot + func OfferAllocatorInstance() *OfferAllocator + func (allocator *OfferAllocator) PopNextPendingOffer() *Slot + func (allocator *OfferAllocator) PutSlotBackToPendingQueue(slot *Slot) + func (allocator *OfferAllocator) RemoveOfferSlotMapByOfferId(offerId *mesos.OfferID) + func (allocator *OfferAllocator) RemoveOfferSlotMapBySlot(slot *Slot) + func (allocator *OfferAllocator) RemoveSlot(slot *Slot) + func (allocator *OfferAllocator) RemoveSlotFromPendingOfferQueue(slot *Slot) + func (allocator *OfferAllocator) RetriveSlotIdWithOfferId(offerId *mesos.OfferID) (string, error) + func (allocator *OfferAllocator) SetOfferSlotMap(offerID *mesos.OfferID, slot *Slot) + type OfferWrapper struct + CpusUsed float64 + DiskUsed float64 + MemUsed float64 + Offer *mesos.Offer + PortUsedSize int + func NewOfferWrapper(offer *mesos.Offer) *OfferWrapper + func (ow *OfferWrapper) CpuRemain() float64 + func (ow *OfferWrapper) DiskRemain() float64 + func (ow *OfferWrapper) MemRemain() float64 + func (ow *OfferWrapper) PortsRemain() []uint64 + type RestartPolicy struct + BackoffFactor float64 + BackoffSeconds time.Duration + MaxLaunchDelaySeconds time.Duration + func NewRestartPolicy(slot *Slot, BackoffSeconds time.Duration, BackoffFactor float64, ...) *RestartPolicy + func (rs *RestartPolicy) Stop() + type Slot struct + AgentHostName string + AgentID string + App *App + CurrentTask *Task + ID string + Index int + Ip string + OfferID string + State string + TaskHistory []*Task + Version *types.Version + func LoadAppSlots(app *App) ([]*Slot, error) + func NewSlot(app *App, version *types.Version, index int) *Slot + func SlotFromRaft(raftSlot *rafttypes.Slot) *Slot + func (slot *Slot) Abnormal() bool + func (slot *Slot) Archive() + func (slot *Slot) BeginTx() + func (slot *Slot) BuildTaskEvent(eventType string) *swanevent.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) Kill() + func (slot *Slot) KillTask() + func (slot *Slot) MarkForDeletion() bool + func (slot *Slot) MarkForRollingUpdate() bool + func (slot *Slot) Normal() bool + 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) SetHealthy(healthy bool) + func (slot *Slot) SetMarkForDeletion(deletion bool) + func (slot *Slot) SetMarkForRollingUpdate(rollingUpdate 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 + func (slot *Slot) UpdateTask(version *types.Version, isRollingUpdate bool) + type SlotResource struct + CPU float64 + Disk float64 + Mem float64 + type SlotsById []*Slot + func (a SlotsById) Len() int + func (a SlotsById) Less(i, j int) bool + func (a SlotsById) Swap(i, j int) + type Task struct + AgentHostName string + AgentID string + Created time.Time + HostPorts []uint64 + ID string + Ip string + Message string + OfferID string + Reason string + Slot *Slot + Source string + State string + Stderr string + Stdout string + TaskInfoID string + Version *types.Version + func NewTask(version *types.Version, slot *Slot) *Task + func TaskFromRaft(raftTask *rafttypes.Task) *Task + func (task *Task) Kill() + func (task *Task) PrepareTaskInfo(ow *OfferWrapper) *mesos.TaskInfo + type TaskBuilder struct + HostPorts []uint64 + func NewTaskBuilder(task *Task) *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(healthChecks []*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 func(slot *Slot) bool