Documentation ¶
Overview ¶
sender provides async http(s) egress functionality over a channel. The code follows a
[driver] -> [channel] -> [worker(s)]
pattern that is common in Go. Requests are sent over a channel and response body is currently ignored. Each worker will wait for http request to finish. Caller is expected to create multiple worker independently for throughput. One worker will only have one outstanding http request. Parallelism is controlled entirely by how many workers are created by the caller. TODO: track and record request status by X-Request-ID
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Worker)
Option controlls a set of options that can be set on Worker This is to make it convenient to control settings without the New method taking tens of arguments
func ExitOnFirstError ¶
func ExtractToFile ¶
func MatchReqID ¶
func MinDelayMS ¶
func OutputDirectory ¶
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
func NewWorker ¶
func NewWorker(reqChan chan *request.UnmarshalledRequest, errorRespChan chan bool, targetHost string, wg *sync.WaitGroup, grID int) (wrk *Worker)
NewWorker creates a new instance of an 'http egress worker' with a few datastructures it keeps track of. Please note that NewWorker does not start a thread or go-routine, caller must call `go worker.Run()` when all options have been set and it ready to start the job. Job details are consumed over a channel, `reqChan`, created by the caller and a given worker will process an unlimited number of tasks. Caller must close the `reqChan` to indicate end of job. Caller must also listen to (and consume) `errorRespChan` for errors If caller does not consume errorRespChan, deadlocks will occur.