Documentation ¶
Index ¶
- Constants
- Variables
- func CleanUpPool()
- type Bucket
- type BucketIndex
- type Cluster
- type DefaultGroupIndex
- type Group
- func (g *Group) All() []*GroupInstance
- func (g *Group) EndIndex() DefaultGroupIndex
- func (g *Group) Expand(n int) (DefaultGroupIndex, error)
- func (g *Group) Expire(n int) error
- func (g *Group) Instance(idx GroupIndex) *lambdastore.Instance
- func (g *Group) Len() int
- func (g *Group) Reserve(idx GroupIndex, d types.LambdaDeployment) *GroupInstance
- func (g *Group) Set(ins *GroupInstance)
- func (g *Group) StartIndex() DefaultGroupIndex
- func (g *Group) SubGroup(start GroupIndex, end GroupIndex) []*GroupInstance
- func (g *Group) Swap(gins1 *GroupInstance, gins2 *GroupInstance)
- type GroupIndex
- type GroupInstance
- type GroupInstanceEnumerator
- type MovingWindow
- func (mw *MovingWindow) AllClustersStats() types.Iterator
- func (mw *MovingWindow) Close()
- func (mw *MovingWindow) ClusterLen() int
- func (mw *MovingWindow) ClusterStats(idx int) types.ClusterStats
- func (mw *MovingWindow) ClusterStatsFromIterator(iter types.Iterator) (int, types.ClusterStats)
- func (mw *MovingWindow) CollectData()
- func (mw *MovingWindow) Daemon()
- func (mw *MovingWindow) DegradeCheck() int
- func (mw *MovingWindow) ExpireCheck() int
- func (mw *MovingWindow) GetActiveInstances(num int) lambdastore.InstanceEnumerator
- func (mw *MovingWindow) GetBackupCandidates() mapreduce.Iterator
- func (mw *MovingWindow) GetCurrentBucket() *Bucket
- func (mw *MovingWindow) GetDelegates() []*lambdastore.Instance
- func (mw *MovingWindow) GetPlacer() metastore.Placer
- func (mw *MovingWindow) GetSlice(size int) metastore.Slice
- func (mw *MovingWindow) Instance(id uint64) *lambdastore.Instance
- func (mw *MovingWindow) LoadCandidates(queue *lambdastore.CandidateQueue, buf []*lambdastore.Instance) int
- func (mw *MovingWindow) MetaStats() types.MetaStoreStats
- func (mw *MovingWindow) Recycle(ins types.LambdaDeployment) error
- func (mw *MovingWindow) Relocate(meta interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, error)
- func (mw *MovingWindow) Rotate() (old *Bucket, inherited int, err error)
- func (mw *MovingWindow) Start() error
- func (mw *MovingWindow) Trigger(event int, args ...interface{})
- func (mw *MovingWindow) TryRelocate(meta interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, bool, error)
- func (mw *MovingWindow) WaitReady()
- type Pool
- func (s *Pool) Clear(g *Group)
- func (s *Pool) ClearAll()
- func (s *Pool) Deployment(id uint64) (types.LambdaDeployment, bool)
- func (s *Pool) GetDestination(lambdaId uint64) (types.LambdaDeployment, error)
- func (s *Pool) GetForGroup(g *Group, idx GroupIndex) *GroupInstance
- func (s *Pool) Instance(id uint64) *lambdastore.Instance
- func (s *Pool) InstanceIndex(id uint64) (*GroupInstance, bool)
- func (s *Pool) NumActives() int
- func (s *Pool) NumAvailable() int
- func (s *Pool) Recycle(dp types.LambdaDeployment)
- func (s *Pool) ReserveForGroup(g *Group, idx GroupIndex) (*GroupInstance, error)
- func (s *Pool) ReserveForInstance(insId uint64) (*GroupInstance, error)
- func (s *Pool) StartMigrator(lambdaId uint64) (string, error)
- type ServerProvider
- type Slice
- type SliceInitializer
- type StaticCluster
- func (c *StaticCluster) AllInstancesStats() types.Iterator
- func (c *StaticCluster) Close()
- func (c *StaticCluster) CollectData()
- func (c *StaticCluster) GetActiveInstances(num int) lambdastore.InstanceEnumerator
- func (c *StaticCluster) GetBackupCandidates() mapreduce.Iterator
- func (c *StaticCluster) GetDelegates() []*lambdastore.Instance
- func (c *StaticCluster) GetPlacer() metastore.Placer
- func (c *StaticCluster) GetSlice(size int) metastore.Slice
- func (c *StaticCluster) Instance(id uint64) *lambdastore.Instance
- func (c *StaticCluster) InstanceLen() int
- func (c *StaticCluster) InstanceStats(idx int) types.InstanceStats
- func (c *StaticCluster) InstanceStatsFromIterator(iter types.Iterator) (int, types.InstanceStats)
- func (c *StaticCluster) MetaStats() types.MetaStoreStats
- func (c *StaticCluster) Recycle(ins types.LambdaDeployment) error
- func (c *StaticCluster) Relocate(obj interface{}, chunk int, cmd types.Command) (*lambdastore.Instance, error)
- func (c *StaticCluster) Start() error
- func (c *StaticCluster) Trigger(event int, args ...interface{})
- func (c *StaticCluster) TryRelocate(o interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, bool, error)
- func (c *StaticCluster) WaitReady()
Constants ¶
const ( BUCKET_EXPIRE = 0 BUCKET_COLD = 1 BUCKET_ACTIVE = 2 )
const DEP_STATUS_ACTIVATING = 2
const DEP_STATUS_ACTIVE = 1
const DEP_STATUS_POOLED = 0
const IN_DEPLOYMENT_MIGRATION = true
Variables ¶
var ( ErrNotActiveBucket = errors.New("scale out failed, not in active bucket") BucketFlushInactiveTimeout = time.Second )
var ( ErrUnsupported = errors.New("unsupported") ErrClusterClosed = errors.New("err cluster closed") )
var ( MaxBackingNodes = 5 ErrInvalidInstance = errors.New("invalid instance") )
var (
ErrInsufficientDeployments = errors.New("insufficient lambda deployments")
)
var (
ErrOutOfBound = errors.New("instance is not active")
)
Functions ¶
func CleanUpPool ¶
func CleanUpPool()
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
A bucket is a view of a group
func (*Bucket) AllInstancesStats ¶
func (*Bucket) InstanceStats ¶
func (b *Bucket) InstanceStats(idx int) types.InstanceStats
func (*Bucket) InstanceStatsFromIterator ¶
func (*Bucket) MetaStats ¶
func (b *Bucket) MetaStats() types.MetaStoreStats
type BucketIndex ¶
type BucketIndex struct { DefaultGroupIndex BucketId int }
type Cluster ¶
type Cluster interface { lambdastore.InstanceManager lambdastore.Relocator metastore.ClusterManager Start() error WaitReady() GetPlacer() metastore.Placer CollectData() Close() }
type DefaultGroupIndex ¶
type DefaultGroupIndex int
func (DefaultGroupIndex) Idx ¶
func (i DefaultGroupIndex) Idx() int
func (*DefaultGroupIndex) Next ¶
func (i *DefaultGroupIndex) Next() DefaultGroupIndex
func (*DefaultGroupIndex) NextN ¶
func (i *DefaultGroupIndex) NextN(n int) DefaultGroupIndex
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) All ¶
func (g *Group) All() []*GroupInstance
func (*Group) EndIndex ¶
func (g *Group) EndIndex() DefaultGroupIndex
func (*Group) Instance ¶
func (g *Group) Instance(idx GroupIndex) *lambdastore.Instance
func (*Group) Reserve ¶
func (g *Group) Reserve(idx GroupIndex, d types.LambdaDeployment) *GroupInstance
func (*Group) Set ¶
func (g *Group) Set(ins *GroupInstance)
func (*Group) StartIndex ¶
func (g *Group) StartIndex() DefaultGroupIndex
func (*Group) SubGroup ¶
func (g *Group) SubGroup(start GroupIndex, end GroupIndex) []*GroupInstance
func (*Group) Swap ¶
func (g *Group) Swap(gins1 *GroupInstance, gins2 *GroupInstance)
type GroupIndex ¶
type GroupIndex interface {
Idx() int
}
type GroupInstance ¶
type GroupInstance struct { types.LambdaDeployment // contains filtered or unexported fields }
func (*GroupInstance) Idx ¶
func (gins *GroupInstance) Idx() int
func (*GroupInstance) Instance ¶
func (gins *GroupInstance) Instance() *lambdastore.Instance
func (*GroupInstance) IsRetired ¶
func (gins *GroupInstance) IsRetired() bool
func (*GroupInstance) Retire ¶
func (gins *GroupInstance) Retire() bool
type GroupInstanceEnumerator ¶
type GroupInstanceEnumerator struct {
mapreduce.Enumerator
}
func NewGroupInstanceEnumerator ¶
func NewGroupInstanceEnumerator(ginstances []*GroupInstance) *GroupInstanceEnumerator
func (*GroupInstanceEnumerator) Instance ¶
func (enum *GroupInstanceEnumerator) Instance(i int) *lambdastore.Instance
type MovingWindow ¶
type MovingWindow struct { ServerProvider // contains filtered or unexported fields }
reuse window and interval should be MINUTES
func NewMovingWindow ¶
func NewMovingWindow(server ServerProvider) *MovingWindow
func NewMovingWindowWithOptions ¶
func NewMovingWindowWithOptions(server ServerProvider, numFuncSteps int) *MovingWindow
func (*MovingWindow) AllClustersStats ¶
func (mw *MovingWindow) AllClustersStats() types.Iterator
func (*MovingWindow) Close ¶
func (mw *MovingWindow) Close()
func (*MovingWindow) ClusterLen ¶
func (mw *MovingWindow) ClusterLen() int
GroupedClusterStatus implementation
func (*MovingWindow) ClusterStats ¶
func (mw *MovingWindow) ClusterStats(idx int) types.ClusterStats
func (*MovingWindow) ClusterStatsFromIterator ¶
func (mw *MovingWindow) ClusterStatsFromIterator(iter types.Iterator) (int, types.ClusterStats)
func (*MovingWindow) CollectData ¶
func (mw *MovingWindow) CollectData()
func (*MovingWindow) Daemon ¶
func (mw *MovingWindow) Daemon()
func (*MovingWindow) DegradeCheck ¶
func (mw *MovingWindow) DegradeCheck() int
func (*MovingWindow) ExpireCheck ¶
func (mw *MovingWindow) ExpireCheck() int
func (*MovingWindow) GetActiveInstances ¶
func (mw *MovingWindow) GetActiveInstances(num int) lambdastore.InstanceEnumerator
metastore.InstanceManger implementation
func (*MovingWindow) GetBackupCandidates ¶
func (mw *MovingWindow) GetBackupCandidates() mapreduce.Iterator
func (*MovingWindow) GetCurrentBucket ¶
func (mw *MovingWindow) GetCurrentBucket() *Bucket
func (*MovingWindow) GetDelegates ¶
func (mw *MovingWindow) GetDelegates() []*lambdastore.Instance
func (*MovingWindow) GetPlacer ¶
func (mw *MovingWindow) GetPlacer() metastore.Placer
func (*MovingWindow) Instance ¶
func (mw *MovingWindow) Instance(id uint64) *lambdastore.Instance
lambdastore.InstanceManager implementation
func (*MovingWindow) LoadCandidates ¶
func (mw *MovingWindow) LoadCandidates(queue *lambdastore.CandidateQueue, buf []*lambdastore.Instance) int
lambdastore.CandidateProvider implementation
func (*MovingWindow) MetaStats ¶
func (mw *MovingWindow) MetaStats() types.MetaStoreStats
func (*MovingWindow) Recycle ¶
func (mw *MovingWindow) Recycle(ins types.LambdaDeployment) error
func (*MovingWindow) Relocate ¶
func (mw *MovingWindow) Relocate(meta interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, error)
lambdastore.Relocator implementation
func (*MovingWindow) Rotate ¶
func (mw *MovingWindow) Rotate() (old *Bucket, inherited int, err error)
func (*MovingWindow) Start ¶
func (mw *MovingWindow) Start() error
func (*MovingWindow) Trigger ¶
func (mw *MovingWindow) Trigger(event int, args ...interface{})
func (*MovingWindow) TryRelocate ¶
func (mw *MovingWindow) TryRelocate(meta interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, bool, error)
func (*MovingWindow) WaitReady ¶
func (mw *MovingWindow) WaitReady()
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) Deployment ¶
func (s *Pool) Deployment(id uint64) (types.LambdaDeployment, bool)
func (*Pool) GetDestination ¶
func (s *Pool) GetDestination(lambdaId uint64) (types.LambdaDeployment, error)
func (*Pool) GetForGroup ¶
func (s *Pool) GetForGroup(g *Group, idx GroupIndex) *GroupInstance
Get a instance at ith position for the group. There is no border check for the index, which means the group should solely responsible for the validity of the index, and the index can be a virtual one. This operation will be blocked if no more deployment available
func (*Pool) InstanceIndex ¶
func (s *Pool) InstanceIndex(id uint64) (*GroupInstance, bool)
func (*Pool) NumActives ¶
func (*Pool) NumAvailable ¶
func (*Pool) Recycle ¶
func (s *Pool) Recycle(dp types.LambdaDeployment)
Recycle lambda deployment for later use Instead of removing instance from actives, placehold a legacy instance to keep track delegate information. TODO: Relocate meta to reflect delegated placements.
func (*Pool) ReserveForGroup ¶
func (s *Pool) ReserveForGroup(g *Group, idx GroupIndex) (*GroupInstance, error)
Reserve a deployment at ith position in the group. The group may choose to instancize it later or not. This operation will return err if no more deployment available
func (*Pool) ReserveForInstance ¶
func (s *Pool) ReserveForInstance(insId uint64) (*GroupInstance, error)
Reserve a deployment to replace specified instance. Can be a different deployment other than the instance's for different mode.
type ServerProvider ¶
type ServerProvider interface { GetServePort(uint64) int GetPersistCache() types.PersistCache }
type Slice ¶
type Slice struct {
// contains filtered or unexported fields
}
func NewSlice ¶
func NewSlice(size int, initializer SliceInitializer) *Slice
type SliceInitializer ¶
type StaticCluster ¶
type StaticCluster struct { ServerProvider // contains filtered or unexported fields }
func NewStaticCluster ¶
func NewStaticCluster(server ServerProvider, size int) *StaticCluster
initial lambda group
func (*StaticCluster) AllInstancesStats ¶
func (c *StaticCluster) AllInstancesStats() types.Iterator
func (*StaticCluster) Close ¶
func (c *StaticCluster) Close()
func (*StaticCluster) CollectData ¶
func (c *StaticCluster) CollectData()
func (*StaticCluster) GetActiveInstances ¶
func (c *StaticCluster) GetActiveInstances(num int) lambdastore.InstanceEnumerator
metastore.InstanceManger implementation
func (*StaticCluster) GetBackupCandidates ¶
func (c *StaticCluster) GetBackupCandidates() mapreduce.Iterator
func (*StaticCluster) GetDelegates ¶
func (c *StaticCluster) GetDelegates() []*lambdastore.Instance
func (*StaticCluster) GetPlacer ¶
func (c *StaticCluster) GetPlacer() metastore.Placer
func (*StaticCluster) Instance ¶
func (c *StaticCluster) Instance(id uint64) *lambdastore.Instance
lambdastore.InstanceManager implementation
func (*StaticCluster) InstanceLen ¶
func (c *StaticCluster) InstanceLen() int
ClusterStatus implementation
func (*StaticCluster) InstanceStats ¶
func (c *StaticCluster) InstanceStats(idx int) types.InstanceStats
func (*StaticCluster) InstanceStatsFromIterator ¶
func (c *StaticCluster) InstanceStatsFromIterator(iter types.Iterator) (int, types.InstanceStats)
func (*StaticCluster) MetaStats ¶
func (c *StaticCluster) MetaStats() types.MetaStoreStats
func (*StaticCluster) Recycle ¶
func (c *StaticCluster) Recycle(ins types.LambdaDeployment) error
func (*StaticCluster) Relocate ¶
func (c *StaticCluster) Relocate(obj interface{}, chunk int, cmd types.Command) (*lambdastore.Instance, error)
lambdastore.Relocator implementation
func (*StaticCluster) Start ¶
func (c *StaticCluster) Start() error
func (*StaticCluster) Trigger ¶
func (c *StaticCluster) Trigger(event int, args ...interface{})
func (*StaticCluster) TryRelocate ¶
func (c *StaticCluster) TryRelocate(o interface{}, chunkId int, cmd types.Command) (*lambdastore.Instance, bool, error)
func (*StaticCluster) WaitReady ¶
func (c *StaticCluster) WaitReady()