Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct {
// contains filtered or unexported fields
}
Backoff implements an exponential backoff algorithm
type Client ¶
type Client interface { Send(Request) error Receive(*Response) error Close() error Reconnect() error }
Client interacts with a worker
type Loop ¶
type Loop struct {
// contains filtered or unexported fields
}
Loop represents the processing loop of a worker
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents a pool of workers
func (*Pool) AddWorker ¶
func (p *Pool) AddWorker(worker *PoolWorker)
AddWorker adds a worker to the pool
type PoolWorker ¶
type PoolWorker struct {
// contains filtered or unexported fields
}
PoolWorker represents a worker in a pool
func NewPoolWorker ¶
func NewPoolWorker(client Client) *PoolWorker
NewPoolWorker creates a pool worker
func (*PoolWorker) Run ¶
func (pw *PoolWorker) Run(handler ResponseHandler, wg *sync.WaitGroup)
Run starts the pool worker
type RequestHandler ¶
RequestHandler handles a request from a manager
type ResponseHandler ¶
type ResponseHandler func(Response)
ResponseHandler handles a response from a worker
type WebsocketClient ¶
type WebsocketClient struct {
// contains filtered or unexported fields
}
WebsocketClient interacts with a worker using a websocket
func NewWebsocketClient ¶
func NewWebsocketClient(endpoint string) (*WebsocketClient, error)
NewWebsocketClient creates a websocket client
func (*WebsocketClient) Close ¶
func (wc *WebsocketClient) Close() error
Close closes the websocket connection
func (*WebsocketClient) Connect ¶
func (wc *WebsocketClient) Connect() error
Connect establishes a websocket connection
func (*WebsocketClient) Receive ¶
func (wc *WebsocketClient) Receive(res *Response) error
Receive receives a response from a worker
func (*WebsocketClient) Reconnect ¶
func (wc *WebsocketClient) Reconnect() error
Reconnect reestablishes a websocket connection
func (*WebsocketClient) Send ¶
func (wc *WebsocketClient) Send(req Request) error
Send sends a request to a worker
type WebsocketServer ¶
type WebsocketServer struct {
// contains filtered or unexported fields
}
WebsocketServer interacts with a manager using a websocket
func NewWebsocketServer ¶
func NewWebsocketServer(conn *websocket.Conn) *WebsocketServer
NewWebsocketServer creates a websocket server
func (*WebsocketServer) Close ¶
func (ws *WebsocketServer) Close() error
Close closes the websocket connection
func (*WebsocketServer) Receive ¶
func (ws *WebsocketServer) Receive(req *Request) error
Receive receives a request from a manager
func (*WebsocketServer) Send ¶
func (ws *WebsocketServer) Send(res Response) error
Send sens a response back to a manager