module

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Status           api.TaskStatus
	InitData         interface{}
	IntermediateData interface{}
	FinalData        interface{}
}

type Decider

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

func NewDecider

func NewDecider(pool *WorkerPool, taskQ <-chan *Task) *Decider

func (*Decider) Start

func (d *Decider) Start()

type Job

type Job interface {
	Spliterator
	Id() string
	GetResult() map[string]interface{}
}

type JobRunner

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

func NewJobRunner

func NewJobRunner(taskQ chan<- *Task, store JobStore) *JobRunner

func (JobRunner) InterruptCurrentJob

func (j JobRunner) InterruptCurrentJob()

func (*JobRunner) ShutDown

func (j *JobRunner) ShutDown()

func (*JobRunner) Start

func (j *JobRunner) Start()

func (*JobRunner) Submit

func (j *JobRunner) Submit(job Job)

type JobStore

type JobStore interface {
	Store(job Job)
	Load(jobId string) (job Job, exist bool)
}

func NewSimpleStore

func NewSimpleStore() JobStore

type Spliterator

type Spliterator interface {
	TryAdvance(func(task *Task)) (finished bool)
}

type Task

type Task struct {
	Id            string
	JobId         string
	Ctx           *Context
	FuncId        string
	UpdateHandler func(*Task)
}

type WorkerPool

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

func NewWorkerPool

func NewWorkerPool() *WorkerPool

func (*WorkerPool) Add

func (w *WorkerPool) Add(id string, ch chan *api.Msg)

func (*WorkerPool) InterruptJobTasks

func (w *WorkerPool) InterruptJobTasks(jobId string)

func (*WorkerPool) Remove

func (w *WorkerPool) Remove(id string)

func (*WorkerPool) UpdateStatus

func (w *WorkerPool) UpdateStatus(id string, payload *api.StatusPayload) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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