Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Processor ¶
type Processor[Q, R any, C comparable, QQ ~[]Q, RR ~[]R] struct { // ProcessJobs processes job batches. ProcessJobs func(jobs QQ) (RR, error) // CorrelateQ maps each job to a correlation ID. CorrelateQ func(job Q) C // CorrelateR maps each result to a correlation ID. CorrelateR func(jobResult R) C // ErrNoResult is sent if there is no matching result for a job. ErrNoResult error // ErrDuplicateID is sent if there is a duplicate correlation ID. ErrDuplicateID error }
Processor handles batch processing of jobs and results.
This structure serves two purposes:
- It is read-only after construction and therefore thread-safe.
- It isolates collector logic from correlation types.
func (*Processor[Q, R, _, _, _]) Process ¶
func (p *Processor[Q, R, _, _, _]) Process(requests []internal.BatchRequest[Q, R])
Process takes a batch of requests and handles processing.
Click to show internal directories.
Click to hide internal directories.