worker

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 5 Imported by: ? 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 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