runner

package
v2.3.24 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusRunning   = "running"
	StatusCompleted = "completed"
	StatusFailed    = "failed"
	StatusStopped   = "stopped"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID       int
	ClientID int
	Name     string
	Type     string
	Data     []byte
	RunFunc  RunFunc
}

type RunFunc

type RunFunc func(ctx context.Context, data []byte) (*model.Message, error)

type Runner

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

func NewRunner

func NewRunner(ctx context.Context) *Runner

func (*Runner) Run

func (r *Runner) Run(data Data)

func (*Runner) Stop

func (r *Runner) Stop(id int)

func (*Runner) TaskResults

func (r *Runner) TaskResults() chan TaskResult

type Task

type Task struct {
	ID       int
	ClientID int
	Name     string
	Type     string
	RanAt    time.Time
	EndedAt  time.Time
}

type TaskResult

type TaskResult struct {
	Task
	Status  string
	Message *model.Message
	Error   error
}

Jump to

Keyboard shortcuts

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