Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Broadcast ¶
type Broadcast struct {
// contains filtered or unexported fields
}
A Broadcast is used to run given number of workers to process jobs.
func NewBroadcast ¶
NewBroadcast returns a Broadcast with given job and workers.
type PerpetualMotion ¶
type PerpetualMotion struct {
Debug bool
// contains filtered or unexported fields
}
A PerpetualMotion is used to run given number of workers to process jobs.
func NewPerpetualMotion ¶
func NewPerpetualMotion(job func(ctx context.Context) (time.Duration, error), workers int) PerpetualMotion
NewPerpetualMotion returns a NewPerpetualMotion with given job and workers.
func (PerpetualMotion) Stop ¶
func (m PerpetualMotion) Stop() error
type PoolWithFunc ¶
type PoolWithFunc struct {
// contains filtered or unexported fields
}
func NewPoolWithFunc ¶
func NewPoolWithFunc(size int, pf func(context.Context, interface{})) (pwf *PoolWithFunc, err error)
func (*PoolWithFunc) Close ¶
func (p *PoolWithFunc) Close()
func (*PoolWithFunc) Submit ¶
func (p *PoolWithFunc) Submit(i interface{}) error
type RoutineGroup ¶
type RoutineGroup struct {
// contains filtered or unexported fields
}
A RoutineGroup is used to group goroutines together and all wait all goroutines to be done.
func (*RoutineGroup) Run ¶
func (g *RoutineGroup) Run(fn func())
Run runs the given fn in RoutineGroup. Don't reference the variables from outside, because outside variables can be changed by other goroutines
func (*RoutineGroup) RunSafe ¶
func (g *RoutineGroup) RunSafe(fn func())
RunSafe runs the given fn in RoutineGroup, and avoid panics. Don't reference the variables from outside, because outside variables can be changed by other goroutines
func (*RoutineGroup) Wait ¶
func (g *RoutineGroup) Wait()
Wait waits all running functions to be done.
type Watch ¶ added in v0.0.16
type Watch struct {
// contains filtered or unexported fields
}
A Watch is used to run given number of workers to process jobs.
type WorkerGroup ¶
type WorkerGroup struct {
// contains filtered or unexported fields
}
A WorkerGroup is used to run given number of workers to process jobs.
func NewWorkerGroup ¶
func NewWorkerGroup(job func(), workers int) WorkerGroup
NewWorkerGroup returns a WorkerGroup with given job and workers.