Documentation ¶
Overview ¶
Package workman is a Worker Manager Code based on http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang/
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Flags ¶
type Flags struct { MaxWorkers int `long:"max_worker" default:"2" description:"Number of workers"` MaxQueue int `long:"max_queue" default:"100" description:"Max queue len"` }
Flags is a package flags sample in form ready for use with github.com/jessevdk/go-flags
type Result ¶
type Result struct { Success bool `json:"success"` Error interface{} `json:"error,omitempty"` Result *json.RawMessage `json:"result,omitempty"` }
Result stores RPC result
type WorkMan ¶
type WorkMan struct { JobQueue chan Job // A buffered channel that we can send work requests on. WorkerPool chan chan Job // A pool of workers channels that are registered with the WorkMan QuitPool chan chan bool // A pool of channels listens for quit QuitMain chan bool WorkerFunc WorkerFunc Config *Flags WG *sync.WaitGroup Log *logger.Log }
WorkMan struct holds worker manager attributes
type Worker ¶
type Worker struct { WorkerPool chan chan Job WorkerFunc WorkerFunc JobChannel chan Job QuitChannel chan bool Log *logger.Log // contains filtered or unexported fields }
Worker represents the worker that executes the job
type WorkerFunc ¶
WorkerFunc is a function to be run by workers
Click to show internal directories.
Click to hide internal directories.