Documentation ¶
Index ¶
- Variables
- func NewPoolWorker(name string, concurrency uint64, scheduler PoolWorkerScheduler) *poolWorker
- type Interface
- type PeriodicTask
- type Pool
- func (p *Pool) Add(item PoolUniqueIDer)
- func (p *Pool) Complete(id PoolUniqueID)
- func (p *Pool) ForceRetry(id PoolUniqueID)
- func (p *Pool) Get(ctx context.Context) (item interface{}, err error)
- func (p *Pool) NumItemsPending() int
- func (p *Pool) RetryLater(id PoolUniqueID, when time.Time)
- func (p *Pool) Start() error
- type PoolUniqueID
- type PoolUniqueIDer
- type PoolWorker
- type PoolWorkerItem
- type PoolWorkerScheduler
- type Process
- func (p *Process) Autoclose()
- func (p *Process) AutocloseWithCleanup(closeFn func())
- func (p *Process) Close() error
- func (p *Process) Ctx() context.Context
- func (p *Process) Done() <-chan struct{}
- func (p *Process) Go(ctx context.Context, name string, fn func(ctx context.Context)) <-chan struct{}
- func (p *Process) Name() string
- func (p *Process) NewChild(ctx context.Context, name string) *Process
- func (p *Process) ProcessTree() map[string]interface{}
- func (p *Process) SpawnChild(ctx context.Context, child Spawnable) error
- func (p *Process) Start() error
- func (p *Process) State() State
- type ProcessTreer
- type Spawnable
- type State
- type StaticScheduler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnstarted = errors.New("unstarted") ErrClosed = errors.New("closed") )
Functions ¶
func NewPoolWorker ¶
func NewPoolWorker(name string, concurrency uint64, scheduler PoolWorkerScheduler) *poolWorker
Types ¶
type Interface ¶
type Interface interface { Spawnable ProcessTreer Autoclose() AutocloseWithCleanup(closeFn func()) Ctx() context.Context NewChild(ctx context.Context, name string) *Process SpawnChild(ctx context.Context, child Spawnable) error Go(ctx context.Context, name string, fn func(ctx context.Context)) <-chan struct{} }
type PeriodicTask ¶
type PeriodicTask struct { Process // contains filtered or unexported fields }
func NewPeriodicTask ¶
func (*PeriodicTask) AbortIfRunning ¶
func (task *PeriodicTask) AbortIfRunning()
func (*PeriodicTask) Close ¶
func (task *PeriodicTask) Close() error
func (*PeriodicTask) Enqueue ¶
func (task *PeriodicTask) Enqueue()
func (*PeriodicTask) ForceRerun ¶
func (task *PeriodicTask) ForceRerun()
func (*PeriodicTask) Start ¶
func (task *PeriodicTask) Start() error
type Pool ¶
type Pool struct { Process // contains filtered or unexported fields }
func (*Pool) Add ¶
func (p *Pool) Add(item PoolUniqueIDer)
func (*Pool) Complete ¶
func (p *Pool) Complete(id PoolUniqueID)
func (*Pool) ForceRetry ¶
func (p *Pool) ForceRetry(id PoolUniqueID)
func (*Pool) NumItemsPending ¶
func (*Pool) RetryLater ¶
func (p *Pool) RetryLater(id PoolUniqueID, when time.Time)
type PoolUniqueID ¶
type PoolUniqueID interface{}
type PoolUniqueIDer ¶
type PoolUniqueIDer interface {
ID() PoolUniqueID
}
type PoolWorker ¶
type PoolWorker interface { Interface Add(item PoolWorkerItem) ForceRetry(uniqueID PoolUniqueID) }
type PoolWorkerItem ¶
type PoolWorkerItem interface { PoolUniqueIDer Work(ctx context.Context) (retry bool) }
type PoolWorkerScheduler ¶
type PoolWorkerScheduler interface { CheckForRetriesInterval() time.Duration RetryWhen(item PoolWorkerItem) time.Time }
type Process ¶
func (*Process) AutocloseWithCleanup ¶
func (p *Process) AutocloseWithCleanup(closeFn func())
func (*Process) ProcessTree ¶
func (*Process) SpawnChild ¶
type ProcessTreer ¶
type StaticScheduler ¶
type StaticScheduler struct {
// contains filtered or unexported fields
}
func NewStaticScheduler ¶
func NewStaticScheduler(checkForRetriesInterval time.Duration, retryAfter time.Duration) StaticScheduler
func (StaticScheduler) CheckForRetriesInterval ¶
func (s StaticScheduler) CheckForRetriesInterval() time.Duration
func (StaticScheduler) RetryWhen ¶
func (s StaticScheduler) RetryWhen(item PoolWorkerItem) time.Time
Click to show internal directories.
Click to hide internal directories.