Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface {
Execute()
}
Job defined an interface to allow worker pools to perform different kinds of work so long as the passed struct conforms to the Job interface
type PipedPool ¶
type PipedPool struct { Config PipedPoolConfig WorkInput chan Job // For client to send work to WorkOutput chan Job // For workers to send jobs to after completion BinderEnd chan bool // Used to notify binder the pool is stopping End chan bool Workers []PipedWorker WorkerChannel chan chan Job // contains filtered or unexported fields }
PipedPool will start a pool of workers and dispatch jobs to them
func NewPipedPool ¶
func NewPipedPool(cfg PipedPoolConfig) *PipedPool
NewPipedPool will return a configured PipedPool. You must call Start() to begin processing jobs
type PipedPoolConfig ¶
type PipedPoolConfig struct { Workers int EnableOutput bool BufferOutput bool OutputBufferLen int BufferInput bool InputBufferLen int }
PipedPoolConfig configures the pool
type PipedWorker ¶
type PipedWorker struct { ID int WorkerChannel chan chan Job WriteToOutChannel bool JobOutput chan Job // Job Output Channel JobInput chan Job // Job input channel End chan bool }
Worker is a goroutine that listens for work and processes incoming requests
type Pool ¶
type Pool struct { Config PoolConfig WorkInput chan Job // For client to send work to End chan bool Workers []Worker WorkerChannel chan chan Job }
func NewPool ¶
func NewPool(cfg PoolConfig) *Pool
NewPool will return a configured Pool. You must call Start() to begin processing jobs
type PoolConfig ¶
Click to show internal directories.
Click to hide internal directories.