Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MoonshotPool ¶
type MoonshotPool struct { Tasks []*MoonshotTask // contains filtered or unexported fields }
MoonshotPool is a worker group that runs a number of tasks at a configured concurrency.
func NewMoonshotPool ¶
func NewMoonshotPool(tasks []*MoonshotTask, concurrency int) *MoonshotPool
NewMoonshotPool initializes a new pool with the given tasks and at the given concurrency.
func (*MoonshotPool) Run ¶
func (p *MoonshotPool) Run()
Run runs all work within the pool and blocks until it's finished.
type MoonshotTask ¶
type MoonshotTask struct { // Err holds an error that occurred during a task. Its // result is only meaningful after Run has been called // for the pool that holds it. Err error Body []byte MetricType string Device string // contains filtered or unexported fields }
MoonshotTask encapsulates a work item that should go in a moonshot work pool.
func NewMoonshotTask ¶
func NewMoonshotTask(f func() ([]byte, string, string, error)) *MoonshotTask
NewMoonshotTask initializes a new task based on a given HPE moonshot work function.
func (*MoonshotTask) Run ¶
func (t *MoonshotTask) Run(wg *sync.WaitGroup)
Run runs a Task and does appropriate accounting via a given sync.WorkGroup.
type Pool ¶
type Pool struct { Tasks []*Task // contains filtered or unexported fields }
Pool is a worker group that runs a number of tasks at a configured concurrency.
type Task ¶
type Task struct { // Err holds an error that occurred during a task. Its // result is only meaningful after Run has been called // for the pool that holds it. Err error Body []byte MetricHandlers []common.Handler URL string // contains filtered or unexported fields }
Task encapsulates a work item that should go in a work pool
Click to show internal directories.
Click to hide internal directories.