Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoEndpoint = errors.New("no endpoint configured") ErrClosed = errors.New("dispatcher closed") )
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher[I, O any] struct { // contains filtered or unexported fields }
Dispatcher runs calls on a pool of workers shared across providers. Every worker takes the next call from one queue as soon as it is free, so load follows each provider's capacity (its Workers count and speed) and a call never waits behind a busy provider while another one is idle.
func NewDispatcher ¶
func NewDispatcher[I, O any](providers []ocrs.ProviderConfig[I, O]) (*Dispatcher[I, O], error)
func (*Dispatcher[I, O]) Close ¶
func (d *Dispatcher[I, O]) Close()
Close stops the workers after their current calls; pending and later Handle calls return ErrClosed.
Click to show internal directories.
Click to hide internal directories.