Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidMaxItemsForBatching is an error. ErrInvalidMaxItemsForBatching = errors.New("max items for batching must be more than zero") // ErrNilExpensiveOperation is an error. ErrNilExpensiveOperation = errors.New("there is not expensive operation") // ErrInvalidMaxTimeoutForBatching is an error. ErrInvalidMaxTimeoutForBatching = errors.New("max timeout for matching must be more than 1 millisecond") // ErrInvalidAddPoolSize is an error. ErrInvalidAddPoolSize = errors.New("add pool size must be more than zero") // ErrInvalidCallbackPoolSize is an error. ErrInvalidCallbackPoolSize = errors.New("callback pool size must be more than zero") // ErrInvalidExpensivePoolSize is an error. ErrInvalidExpensivePoolSize = errors.New("expensive pool size must be more than zero") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[I, O any] struct { MaxItemsForBatching int MaxTimeoutForBatching time.Duration Logger Logger AddPoolSize int CallbackPoolSize int ExpensivePoolSize int ExpensiveOperation expensiveOperation[I, O] }
Config holds configuration for the sink.
type Sink ¶
type Sink[I, O any] struct { // contains filtered or unexported fields }
Sink is a struct to process different request simultaneously.
type SinkWithContext ¶
type SinkWithContext[I, O any] struct { // contains filtered or unexported fields }
SinkWithContext is a struct to process different request simultaneously.
func NewSinkWithContext ¶
func NewSinkWithContext[I, O any](ctx context.Context, config Config[I, O]) (*SinkWithContext[I, O], error)
NewSinkWithContext initializes a sink with the provided config and context.
func (*SinkWithContext[I, O]) Add ¶
func (s *SinkWithContext[I, O]) Add(value I) (O, error)
Add adds a value to the sink and waits for result.
Click to show internal directories.
Click to hide internal directories.