jobs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const WorkBuffer = 1000

Variables

This section is empty.

Functions

func Errors

func Errors() (chan<- error, *sync.WaitGroup)

Errors creates an input for errors to print and a bool of whether any errors have been printed.

Calls Done on the WaitGroup once the channel has been closed and all errors have been printed.

The returned channel must be closed before the WaitGroup is waited upon.

func IDs

func IDs(db *badger.DB, newProto NewProto, ids []uint, errs chan<- error) <-chan proto.Message

IDs returns a channel of protos.

func NewProtoWork

func NewProtoWork() chan proto.Message

func RunProto

func RunProto(parallel int, job Proto, work <-chan proto.Message, errs chan<- error) *sync.WaitGroup

Types

type NewProto

type NewProto func() proto.Message

type Page

type Page func(page *documents.Page) error

type Proto

type Proto func(proto proto.Message) error

type Run

type Run func(ctx context.Context) error

func PageWorker

func PageWorker(pages <-chan *documents.Page, job func(*documents.Page) error) Run

type Runner

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

func NewRunner

func NewRunner(parallel int) *Runner

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, run Run, errs chan<- error) *sync.WaitGroup

Jump to

Keyboard shortcuts

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