batch

package
v1.6.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Poller

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

Poller polls vendor APIs for batch job status and cleans up expired results.

func NewPoller

func NewPoller(
	db PollerDB,
	snapshots SnapshotProvider,
	throttle router.Throttle,
	tracker llm.UsageTracker,
	pollInterval, retentionPeriod time.Duration,
) *Poller

func (*Poller) CleanupOnce

func (p *Poller) CleanupOnce(ctx context.Context) (int64, error)

CleanupOnce executes one retention cleanup run.

func (*Poller) PollOnce

func (p *Poller) PollOnce(ctx context.Context)

PollOnce executes one round of leased batch polling.

func (*Poller) Start

func (p *Poller) Start(ctx context.Context)

Start launches background polling and cleanup loops until ctx is cancelled.

func (*Poller) Stop

func (p *Poller) Stop()

Stop stops the poller.

type PollerDB

type PollerDB interface {
	LeaseUnfinishedBatches(ctx context.Context, leaseDuration time.Duration, limit int) ([]*proxydb.Batch, error)
	UpdateBatchRunning(ctx context.Context, id string, total, done, failed int32) error
	CompleteBatch(ctx context.Context, id string, finalState string, doneCount, failedCount int32, completedAt time.Time, items []*proxydb.BatchItem) error
	ExpireBatch(ctx context.Context, id string, expiredAt time.Time) error
	ListAllBatchItems(ctx context.Context, batchID string) ([]*proxydb.BatchItem, error)
	DeleteBatchesOlderThan(ctx context.Context, cutoff time.Time) (int64, error)
}

PollerDB defines the DB operations needed by the poller.

type SnapshotProvider

type SnapshotProvider interface {
	Snapshot() *registry.Snapshot
}

SnapshotProvider provides the current routing snapshot.

Jump to

Keyboard shortcuts

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