sweep

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WORKER_STARTED   = "dash_started"
	WORKER_COMPLETED = "dash_complete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type string
	Data interface{}
}

type Manager

type Manager struct {
	Cancel context.CancelFunc
	// contains filtered or unexported fields
}

func CreateManager

func CreateManager() Manager

func (Manager) Child

func (m Manager) Child() Manager

func (Manager) IsDone

func (m Manager) IsDone() bool

type Sweep

type Sweep[C any, R any] struct {
	Generator     func(config chan C, manager Manager)
	Worker        func(config C, results chan R, events chan Event, manager Manager)
	OnEvent       func(event WorkerEvent[C])
	GetWorkerName func(config C) string
	MaxWorkers    int
}

func (Sweep[C, R]) Run

func (s Sweep[C, R]) Run() []WorkerResult[C, R]

* Complete all generated work units in parallel. *

type WorkerDescription

type WorkerDescription[C any] struct {
	ID        int
	Config    C
	Name      string
	StartTime time.Time
	EndTime   time.Time
}

type WorkerEvent

type WorkerEvent[C any] struct {
	Description WorkerDescription[C]
	Event       Event
	Time        time.Time
}

type WorkerResult

type WorkerResult[C any, R any] struct {
	Description WorkerDescription[C]
	Result      R
	Time        time.Time
}

Jump to

Keyboard shortcuts

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