jobs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextDependencies

type ContextDependencies struct {
	Alive *broadcast.BroadcastChannel[string]
	Logs  *broadcast.BroadcastChannel[string]
	Stats *broadcast.BroadcastChannel[feeder.Stats]
	Jobs  *JobCollection
}

func NewContextDependencies

func NewContextDependencies() *ContextDependencies

type JobCollection

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

func NewJobCollection

func NewJobCollection() *JobCollection

func (*JobCollection) Add

func (jc *JobCollection) Add(id, path string)

func (*JobCollection) Get

func (jc *JobCollection) Get(id string) (*PlotJob, error)

func (*JobCollection) Remove

func (jc *JobCollection) Remove(id string)

func (*JobCollection) SetCancel

func (jc *JobCollection) SetCancel(id string, cancel context.CancelFunc) error

func (*JobCollection) UpdateState

func (jc *JobCollection) UpdateState(id string, state JobState) error

type JobConfig

type JobConfig struct {
	DryRun       bool
	PrintOnly    bool
	SerialDevice *string
}

type JobState

type JobState string
const (
	JobStateNew     JobState = "new"
	JobStateWorking JobState = "working"
	JobStateDone    JobState = "done"
	JobStateError   JobState = "error"
)

type PlotJob

type PlotJob struct {
	ID     string
	Path   string
	State  JobState
	Cancel *context.CancelFunc
}

func NewPlotJob

func NewPlotJob(path string) *PlotJob

func (PlotJob) Run

func (j PlotJob) Run(ctx context.Context, deps *ContextDependencies, config JobConfig) error

Jump to

Keyboard shortcuts

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