Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultMinWorkerQuantity is the default minWorkerQuantity DefaultMinWorkerQuantity = 10 // DefaultMaxWorkerQuantity is the default maxWorkerQuantity DefaultMaxWorkerQuantity = 20 // DefaultScaleUpThreshold is the default scaleUpThreshold DefaultScaleUpThreshold = 1 * time.Second // DefaultScaleDownThreshold is the default scaleDownThreshold DefaultScaleDownThreshold = 1 * time.Minute )
Variables ¶
View Source
var ( // ErrNotChanType means object is not channel, but used as channel ErrNotChanType = errors.New("not chan type") // ErrChanClosed means the channel waited from is closed ErrChanClosed = errors.New("chan closed") // ErrTimeout means waiting is timeout ErrTimeout = errors.New("wait chan timeout") // ErrOutOfRange should never be used ErrOutOfRange = errors.New("index out of range") // should never happen )
Functions ¶
func ClearChannel ¶
func ClearChannel(ch interface{}) error
ClearChannel clear all content in channel
func ReadChanWithTimeout ¶
ReadChanWithTimeout read something from channel with timeout
func WriteChanWithTimeout ¶
WriteChanWithTimeout write something to channel with timeout
Types ¶
type Autoscaler ¶
type Autoscaler struct {
// contains filtered or unexported fields
}
Autoscaler struct
func NewAutoscaler ¶
func NewAutoscaler(minWorkerQuantity, maxWorkerQuantity int, scaleUpThreshold, scaleDownThreshold time.Duration) *Autoscaler
NewAutoscaler return new Autoscaler object
func (*Autoscaler) ActiveWorkerCount ¶
func (s *Autoscaler) ActiveWorkerCount() int
ActiveWorkerCount return the count of active worker
func (*Autoscaler) AddJobBlocked ¶
func (s *Autoscaler) AddJobBlocked(job Job) error
AddJobBlocked add new job to autoscaler
func (*Autoscaler) WaitForAllJobsDone ¶
func (s *Autoscaler) WaitForAllJobsDone()
WaitForAllJobsDone wait for all job submitted done
Click to show internal directories.
Click to hide internal directories.