worker

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder creates a configured conduit with processors using builder pattern.

Example:

conduit, err := worker.New().
    Blueprint(bp).
    Job("process").
    Concurrency(4).
    Build()

func New

func New() *Builder

New creates a new conduit builder with default configuration.

func (*Builder) Build

func (b *Builder) Build() (*ConduitWithReporter, error)

Build creates the configured conduit with blueprint processor. Returns a wrapped conduit that includes progress reporter in context.

func (*Builder) Cache added in v0.2.0

func (b *Builder) Cache(path string) *Builder

func (*Builder) Concurrency

func (b *Builder) Concurrency(n int) *Builder

Concurrency sets the number of parallel processing workers. Default is 1 (sequential processing).

func (*Builder) ErrorMode

func (b *Builder) ErrorMode(mode conduit.ErrorMode) *Builder

ErrorMode sets how errors are handled during processing. Options: conduit.FailFast (default) or conduit.SkipError.

func (*Builder) ListCollector added in v0.2.0

func (b *Builder) ListCollector(enable bool) *Builder

ArrayMode enables batch processing by collecting all documents into array. When enabled, adds ArrayCollector processor as first stage after Runtime. ArrayCollector buffers all documents until EOF, then emits them as array.

Use cases:

  • Process JSON array files
  • Batch process split documents
  • Enable foreach with selector: document

Memory warning: All documents buffered in memory until EOF. Not suitable for very large document streams.

func (*Builder) Metrics

func (b *Builder) Metrics(fn conduit.MetricsFunc) *Builder

Metrics sets a callback for periodic metrics updates.

func (*Builder) Progress

func (b *Builder) Progress(fn conduit.ProgressFunc) *Builder

Progress sets a callback for progress updates after each document.

func (*Builder) Reporter

func (b *Builder) Reporter(r *progress.Reporter) *Builder

Reporter sets the progress reporter and wires up callbacks

func (*Builder) Runtime

func (b *Builder) Runtime() *Builder

func (*Builder) Splitter

func (b *Builder) Splitter(conf processor.ChunkConfig) *Builder

func (*Builder) TextCollector added in v0.2.0

func (b *Builder) TextCollector(enable bool) *Builder

func (*Builder) Workflow

func (b *Builder) Workflow(file string, llm chatter.Chatter, sink iosystem.Sink) *Builder

Workflow sets the blueprint to use for creating processors. This is required.

type ConduitWithReporter

type ConduitWithReporter struct {
	*conduit.Conduit
	// contains filtered or unexported fields
}

ConduitWithReporter wraps a conduit and injects progress reporter into context

func (*ConduitWithReporter) Run

Run executes the pipeline with progress reporter in context

Jump to

Keyboard shortcuts

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