spore

package module
v0.0.0-...-8537215 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2016 License: MIT Imports: 7 Imported by: 0

README

Spore

Spore is simple clustering for aliyun ECS.

Documentation

Index

Constants

View Source
const (
	AppName = "spore"
)

Variables

View Source
var (
	ListenAddr  string
	AppConfPath string
	IsProMode   bool

	LogLevel log.Level
	LogFile  string

	AliyunAppKey          string
	AliyunAppSecrety      string
	AliyunRegionId        string
	AliyunZoneId          string
	AliyunSecurityGroupId string
	UsedInstanceTag       map[string]string

	RefreshMinInterval time.Duration
	RefreshMaxInterval time.Duration
)

Functions

func AliyunClient

func AliyunClient() *ecs.Client

func NewPagination

func NewPagination() common.Pagination

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster() (*Cluster, error)

func (*Cluster) Find

func (c *Cluster) Find(instanceId string) *Instance

find instance based on instance id

func (*Cluster) GetInstance

func (c *Cluster) GetInstance(imageId string) *Instance

get a instance from running instance based on image

func (*Cluster) RefreshDisks

func (c *Cluster) RefreshDisks() error

get all disks

func (*Cluster) RefreshInstances

func (c *Cluster) RefreshInstances() error

get all instances, instance is processed differently based on status, instance have four status: Starting, Running, Stoping, Stopped, refer: https://help.aliyun.com/document_detail/ecs/open-api/appendix/instancestatustable.html Running: instance with status running may being used or may be available Sopped: instance with status soppend shoult to be started, into starting status

func (*Cluster) StopInstance

func (c *Cluster) StopInstance(instanceId string) error

stop a instance with running status

type Instance

type Instance struct {
	Attrs ecs.InstanceAttributesType
	Disk  ecs.DiskItemType
	// contains filtered or unexported fields
}

func (*Instance) SetUsedTag

func (instance *Instance) SetUsedTag() error

set instance tag

func (*Instance) Start

func (instance *Instance) Start() error

func (*Instance) Stop

func (instance *Instance) Stop() error

remove instance tag

type InstanceList

type InstanceList struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewInstanceList

func NewInstanceList() *InstanceList

func (*InstanceList) Find

func (l *InstanceList) Find(imageId string) *Instance

func (*InstanceList) Init

func (l *InstanceList) Init() *InstanceList

func (*InstanceList) Len

func (l *InstanceList) Len() int

func (*InstanceList) Push

func (l *InstanceList) Push(e *Instance) *Instance

func (*InstanceList) Remove

func (l *InstanceList) Remove(e *Instance) *Instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL