scheduler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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.

func (*Dispatcher[I, O]) Handle

func (d *Dispatcher[I, O]) Handle(ctx context.Context, data I) (O, error)

Jump to

Keyboard shortcuts

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