Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatcher ¶ added in v0.4.0
func Dispatcher[D any, O any](dispatch func(*Item[D, O]) ([]*Item[D, O], error), work func(*Item[D, O]) (O, error), items []*Item[D, O], concurrency int) error
Dispatcher models two-way communication between 1 dispatcher and n=concurrency workers.
It reads from input channel, calls dispatch, sends resulting items into dispatch channel, and waits for processed items from workers via input channel to continue the process.
Each worker reads from dispatch channel, calls work on received items, and sends them back to the dispatcher. Dispatcher terminates when input channel is completely drained no new items are generated from dispatch.
Types ¶
Click to show internal directories.
Click to hide internal directories.