Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchExecutor ¶
type BatchExecutor[I any, O any] interface { // Execute processes the input and returns the result or an error. Execute(input I) (O, error) }
BatchExecutor executes operations on inputs and returns results with potential errors. Implementations may batch multiple Execute calls for efficiency.
func NewBatchExecutor ¶
func NewBatchExecutor[I, O any]( executor ExecuteFunc[I, Output[O]], capacity int, timeout time.Duration, ) BatchExecutor[I, O]
NewBatchExecutor creates a BatchExecutor that batches multiple Execute calls for efficiency. Batching occurs when capacity is reached or timeout expires. The executor function receives a batch of inputs and must return corresponding outputs.
func NewSerialExecutor ¶
func NewSerialExecutor[I, O any](executor ExecuteFunc[I, Output[O]]) BatchExecutor[I, O]
NewSerialExecutor creates a BatchExecutor that executes operations serially without batching. Each Execute call is processed immediately by invoking the executor function with a single-element slice.
type BatchRunner ¶
type BatchRunner[V any] interface { // Run processes the value and returns an error if the operation fails. Run(v V) error }
BatchRunner executes operations that may return errors. Implementations may batch multiple Run calls for efficiency.
func NewBatchRunner ¶
func NewBatchRunner[V any](runner func([]V) []error, capacity int, timeout time.Duration) BatchRunner[V]
NewBatchRunner creates a BatchRunner that batches multiple Run calls for efficiency. Batching occurs when capacity is reached or timeout expires. The runner function receives a batch of values and must return corresponding errors.
func NewSerialRunner ¶
func NewSerialRunner[V any](runner ExecuteFunc[V, error]) BatchRunner[V]
NewSerialRunner creates a BatchRunner that executes operations serially without batching. Each Run call is processed immediately by invoking the runner function with a single-element slice.
type ExecuteFunc ¶
ExecuteFunc is a function that processes a batch of inputs and returns corresponding outputs.