runner

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRetry = RetryOpts{
	MaxAttempts: 3,
	BaseDelay:   200 * time.Millisecond,
	MaxDelay:    5 * time.Second,
	Multiplier:  2.0,
}

DefaultRetry is the default retry configuration used with ErrorPolicyRetry.

Functions

This section is empty.

Types

type ErrorPolicy

type ErrorPolicy int

ErrorPolicy controls what happens when a job fails.

const (
	ErrorPolicySkip  ErrorPolicy = iota // record error and continue
	ErrorPolicyStop                     // abort all remaining jobs
	ErrorPolicyRetry                    // retry with backoff
)

func ParseErrorPolicy

func ParseErrorPolicy(s string) (ErrorPolicy, error)

ParseErrorPolicy parses a string error policy name.

type Job

type Job struct {
	Source source.SourceFile
	Route  *router.Route
	Sink   *sink.Sink
	Opts   backend.Options
	// BackendExtraArgs maps backend name → extra pandoc/ffmpeg/etc. args
	// sourced from config.toml ([backend.<name>] extra_args = [...]).
	// Merged into Opts.ExtraArgs at step-execution time; CLI-supplied args
	// stay last so they override config.
	BackendExtraArgs map[string][]string
}

Job is a single conversion unit.

type RetryOpts

type RetryOpts struct {
	MaxAttempts int           // total attempts (1 = no retry, 0 defaults to DefaultRetry)
	BaseDelay   time.Duration // delay before second attempt
	MaxDelay    time.Duration
	Multiplier  float64 // delay multiplier per attempt (e.g. 2.0)
}

RetryOpts configures exponential backoff retry behaviour.

type RunOpts

type RunOpts struct {
	Workers    int
	OnError    ErrorPolicy
	OnConflict sink.ConflictPolicy
	Retry      RetryOpts
	DryRun     bool
	Reporter   progress.Reporter // nil → Noop
}

RunOpts configures the runner.

type Summary

type Summary struct {
	OK       int64
	Fail     int64
	Skip     int64
	Warnings []string
}

Summary holds aggregate conversion counts.

func Execute

func Execute(ctx context.Context, jobs []Job, opts RunOpts) (*Summary, error)

Execute runs all jobs and returns a summary.

Jump to

Keyboard shortcuts

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