worker

package
v0.9.26 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 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 Config

type Config struct {
	Workers        int    // Number of concurrent workers
	EmbeddingModel string // For rate limiting
	QueueSize      int    // Task queue buffer size (default: workers * 2)
}

Config contains worker pool configuration

type Pool

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

Pool manages a pool of workers for parallel task processing

func NewPool

func NewPool(config Config) *Pool

NewPool creates a new worker pool

func (*Pool) GetStats

func (p *Pool) GetStats() Stats

GetStats returns current processing statistics

func (*Pool) IsRateLimited

func (p *Pool) IsRateLimited() bool

IsRateLimited returns true if rate limiting is active

func (*Pool) Provider

func (p *Pool) Provider() string

Provider returns the detected embedding provider

func (*Pool) Results

func (p *Pool) Results() <-chan Result

Results returns the results channel

func (*Pool) Start

func (p *Pool) Start()

Start begins the worker pool

func (*Pool) Stop

func (p *Pool) Stop()

Stop cancels all workers and waits for them to finish

func (*Pool) Submit

func (p *Pool) Submit(task Task)

Submit adds a task to the pool

func (*Pool) Wait

func (p *Pool) Wait()

Wait closes the task queue and waits for all workers to finish

type Result

type Result struct {
	TaskID   string
	FilePath string
	Error    error
	Success  bool
}

Result contains the outcome of processing a task

type Stats

type Stats struct {
	Processed int64
	Succeeded int64
	Failed    int64
}

Stats returns current processing statistics

type Task

type Task struct {
	ID       string
	FilePath string
	Process  func(context.Context) error
}

Task represents a unit of work to be processed

Jump to

Keyboard shortcuts

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