router

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CircuitBreaker

type CircuitBreaker struct {
	// contains filtered or unexported fields
}

CircuitBreaker tracks failure rates and opens when an upstream fails repeatedly.

New code uses execution.HealthTracker, which adds per-key policies, an injectable clock and outcomes read from classified errors.

func NewCircuitBreaker

func NewCircuitBreaker(threshold int, cooldown time.Duration) *CircuitBreaker

func (*CircuitBreaker) Allow

func (cb *CircuitBreaker) Allow(provider string) bool

func (*CircuitBreaker) RecordFailure

func (cb *CircuitBreaker) RecordFailure(provider string)

func (*CircuitBreaker) RecordSuccess

func (cb *CircuitBreaker) RecordSuccess(provider string)

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router resolves requested model strings into ordered targets.

func NewRouter

func NewRouter(routes map[string]core.RouteConfig, policy core.PolicyGate) *Router

func (*Router) RecordResult

func (r *Router) RecordResult(provider string, err error)

func (*Router) Resolve

func (r *Router) Resolve(ctx context.Context, principal *core.Principal, requested string) ([]core.Target, error)

Resolve returns ordered valid targets for a given model request and principal.

func (*Router) ResolveResolution added in v0.1.1

func (r *Router) ResolveResolution(ctx context.Context, principal *core.Principal, requested string) (core.Resolution, error)

ResolveResolution returns ordered valid targets and category name for a given model request and principal.

Jump to

Keyboard shortcuts

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