processor

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL