Documentation ¶
Index ¶
- Variables
- type Config
- type Factory
- type Resource
- type ResourcePool
- type Worker
- type WorkerPool
- func (p *WorkerPool) Close() (err error)
- func (p *WorkerPool) Execute(ctx context.Context, fn func()) (err error)
- func (p *WorkerPool) Get(ctx context.Context) (w *Worker, err error)
- func (p *WorkerPool) Open() (err error)
- func (p *WorkerPool) Put(w *Worker) (err error)
- func (p *WorkerPool) Wait() (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PoolClosedError = errors.New("pool closed") PoolIsFullError = errors.New("pool is full") )
Functions ¶
This section is empty.
Types ¶
type ResourcePool ¶
type ResourcePool struct {
// contains filtered or unexported fields
}
func NewResourcePool ¶
func NewResourcePool(ctx context.Context, config Config, factory Factory) (p *ResourcePool)
func (*ResourcePool) Close ¶
func (p *ResourcePool) Close() (err error)
func (*ResourcePool) Open ¶
func (p *ResourcePool) Open() (err error)
func (*ResourcePool) Put ¶
func (p *ResourcePool) Put(r Resource) (err error)
func (*ResourcePool) Wait ¶
func (p *ResourcePool) Wait() (err error)
type Worker ¶
type Worker struct { *supervisor.Control // contains filtered or unexported fields }
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool uses pool of workers to execute tasks
func NewWorkerPool ¶
func NewWorkerPool(ctx context.Context, config Config) (p *WorkerPool)
func (*WorkerPool) Close ¶
func (p *WorkerPool) Close() (err error)
func (*WorkerPool) Execute ¶
func (p *WorkerPool) Execute(ctx context.Context, fn func()) (err error)
func (*WorkerPool) Get ¶
func (p *WorkerPool) Get(ctx context.Context) (w *Worker, err error)
Take worker from pool
func (*WorkerPool) Open ¶
func (p *WorkerPool) Open() (err error)
func (*WorkerPool) Put ¶
func (p *WorkerPool) Put(w *Worker) (err error)
func (*WorkerPool) Wait ¶
func (p *WorkerPool) Wait() (err error)
Click to show internal directories.
Click to hide internal directories.