Documentation
¶
Index ¶
- Constants
- type CircularList
- func (c *CircularList) AppendNode(data interface{}) *CircularNode
- func (c *CircularList) DeleteNode(node *CircularNode) bool
- func (c *CircularList) ForEach(f ForEachFunc) bool
- func (c *CircularList) GetCurNode() *CircularNode
- func (c *CircularList) GetCurNodeWithNoCopied() *CircularNode
- func (c *CircularList) RightShiftCurPointer() bool
- func (c *CircularList) RightShiftCurPointerAndUpdate(data interface{}) bool
- func (c *CircularList) RightShiftCurPointerToCertainNode(dstNode *CircularNode) bool
- type CircularNode
- type ForEachFunc
- type Gradienter
- type Handler
- type Monitor
- type Request
- type Scheduler
- func (s *Scheduler) Close()
- func (s *Scheduler) PublishRequest(req *Request)
- func (s *Scheduler) SetDefaultHandler(handler Handler)
- func (s *Scheduler) SetMaxGoroutines(maxCountGoroutines int64)
- func (s *Scheduler) SetMaxProcessedReqs(maxProcessedReqs int64)
- func (s *Scheduler) SetMaxRate(rate float64)
- func (s *Scheduler) SetMonitor(monitor Monitor)
- func (s *Scheduler) SetStrategy(strategy Strategy)
- func (s *Scheduler) StartSchedule()
- type Strategy
Constants ¶
View Source
const ( NoNeedUpdating = iota NumActivesNeedsExpansion NumActivesNeedsShrinking MaxProcessedReqsNeedsExpansion MaxProcessedReqsNeedsShrinking MaxRateNeedsExpansion MaxRateNeedsShrinking )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CircularList ¶
type CircularList struct {
// contains filtered or unexported fields
}
func NewCircularList ¶
func NewCircularList() *CircularList
func (*CircularList) AppendNode ¶
func (c *CircularList) AppendNode(data interface{}) *CircularNode
func (*CircularList) DeleteNode ¶
func (c *CircularList) DeleteNode(node *CircularNode) bool
func (*CircularList) ForEach ¶
func (c *CircularList) ForEach(f ForEachFunc) bool
func (*CircularList) GetCurNode ¶
func (c *CircularList) GetCurNode() *CircularNode
func (*CircularList) GetCurNodeWithNoCopied ¶
func (c *CircularList) GetCurNodeWithNoCopied() *CircularNode
func (*CircularList) RightShiftCurPointer ¶
func (c *CircularList) RightShiftCurPointer() bool
func (*CircularList) RightShiftCurPointerAndUpdate ¶
func (c *CircularList) RightShiftCurPointerAndUpdate(data interface{}) bool
func (*CircularList) RightShiftCurPointerToCertainNode ¶
func (c *CircularList) RightShiftCurPointerToCertainNode(dstNode *CircularNode) bool
type CircularNode ¶
type CircularNode struct {
// contains filtered or unexported fields
}
type ForEachFunc ¶
type ForEachFunc func(node *CircularNode) error
type Gradienter ¶
type Gradienter struct {
// contains filtered or unexported fields
}
func NewGradienter ¶
func NewGradienter() *Gradienter
func (*Gradienter) ExpandOrShrink ¶
func (g *Gradienter) ExpandOrShrink(ir int64, pr int64, numActives int64) (diff int64)
func (*Gradienter) SetMaxActives ¶
func (g *Gradienter) SetMaxActives(maxActives int64)
already locked at sheduler
func (*Gradienter) SetMaxProcessedReqs ¶
func (g *Gradienter) SetMaxProcessedReqs(maxProcessedReqs int64)
func (*Gradienter) SetMaxRate ¶
func (g *Gradienter) SetMaxRate(maxRate float64)
type Monitor ¶
type Monitor func(incomingReqsLastInterval, processedReqsLastInterval, shift, numActives int64)
type Scheduler ¶
type Scheduler struct { //the interval of goroutines number changing, min 200ms, default 1s //should be set before Schedule called Interval time.Duration // contains filtered or unexported fields }
func NewScheduler ¶
func NewScheduler() *Scheduler
func (*Scheduler) PublishRequest ¶
func (*Scheduler) SetDefaultHandler ¶
func (*Scheduler) SetMaxGoroutines ¶
max number of active goroutines, -1 means not limited default -1, can be set at any runtime
func (*Scheduler) SetMaxProcessedReqs ¶
max number of request processed per second, -1 means not limited default -1, can be set at any runtime
func (*Scheduler) SetMaxRate ¶
max rate of (incoming requests)/(processed requests), should between 0 and 1 default 1
func (*Scheduler) SetMonitor ¶
func (*Scheduler) SetStrategy ¶
func (*Scheduler) StartSchedule ¶
func (s *Scheduler) StartSchedule()
Click to show internal directories.
Click to hide internal directories.