Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
PoolBusyErr = perrors.New("pool is busy")
)
Functions ¶
This section is empty.
Types ¶
type ConnectionPool ¶ added in v1.11.16
type ConnectionPool struct {
// contains filtered or unexported fields
}
func (ConnectionPool) NumWorkers ¶ added in v1.11.16
func (p ConnectionPool) NumWorkers() int32
func (*ConnectionPool) Submit ¶ added in v1.11.16
func (p *ConnectionPool) Submit(t task) error
func (*ConnectionPool) SubmitSync ¶ added in v1.11.16
func (p *ConnectionPool) SubmitSync(t task) error
type GenericTaskPool ¶ added in v1.9.6
type GenericTaskPool interface { // AddTask wait idle worker add task AddTask(t task) bool // AddTaskAlways add task to queues or do it immediately AddTaskAlways(t task) // AddTaskBalance add task to idle queue AddTaskBalance(t task) // Close use to close the task pool Close() // IsClosed use to check pool status. IsClosed() bool }
GenericTaskPool represents an generic task pool.
func NewTaskPool ¶
func NewTaskPool(opts ...TaskPoolOption) GenericTaskPool
NewTaskPool build a task pool
func NewTaskPoolSimple ¶ added in v1.9.6
func NewTaskPoolSimple(size int) GenericTaskPool
NewTaskPoolSimple build a simple task pool
type TaskPool ¶
type TaskPool struct { TaskPoolOptions // contains filtered or unexported fields }
/////////////////////////////////////// Task Pool /////////////////////////////////////// task pool: manage task ts
func (*TaskPool) AddTaskAlways ¶ added in v1.7.0
func (p *TaskPool) AddTaskAlways(t task)
func (*TaskPool) AddTaskBalance ¶ added in v1.7.0
func (p *TaskPool) AddTaskBalance(t task)
do it immediately when no idle queue
type TaskPoolOption ¶
type TaskPoolOption func(*TaskPoolOptions)
func WithTaskPoolTaskPoolSize ¶
func WithTaskPoolTaskPoolSize(size int) TaskPoolOption
WithTaskPoolTaskPoolSize set @size of the task queue pool size
func WithTaskPoolTaskQueueLength ¶
func WithTaskPoolTaskQueueLength(length int) TaskPoolOption
WithTaskPoolTaskQueueLength set @length of the task queue length
func WithTaskPoolTaskQueueNumber ¶
func WithTaskPoolTaskQueueNumber(number int) TaskPoolOption
WithTaskPoolTaskQueueNumber set @number of the task queue number
type TaskPoolOptions ¶
type TaskPoolOptions struct {
// contains filtered or unexported fields
}
TaskPoolOptions is optional settings for task pool
type WorkerPool ¶ added in v1.11.16
type WorkerPool interface { // Submit adds a task to queue asynchronously. Submit(task) error // SubmitSync adds a task to queue synchronously. SubmitSync(task) error // Close closes the worker pool Close() // IsClosed returns close status of the worker pool IsClosed() bool // NumWorkers returns the number of workers NumWorkers() int32 }
func NewConnectionPool ¶ added in v1.11.16
func NewConnectionPool(config WorkerPoolConfig) WorkerPool
Click to show internal directories.
Click to hide internal directories.