gxsync

package
v1.11.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 10 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) AddTask

func (p *TaskPool) AddTask(t task) (ok bool)

return false when the pool is stop

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

func (*TaskPool) Close

func (p *TaskPool) Close()

func (*TaskPool) IsClosed

func (p *TaskPool) IsClosed() bool

check whether the session has been closed.

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL