tasks

package
v0.0.0-...-7b96089 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	psi.NodeBase
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) PsiNodeName

func (m *Manager) PsiNodeName() string

func (*Manager) SpawnTask

func (m *Manager) SpawnTask(ctx context.Context, taskFn TaskFunc) Task

type Task

type Task interface {
	psi.Node
	Name() string
	Description() string
	Progress() float64

	IsCompleted() bool
	Error() error

	Done() <-chan struct{}
}

type TaskFunc

type TaskFunc func(progress TaskProgress) error

func (TaskFunc) Run

func (f TaskFunc) Run(progress TaskProgress) error

type TaskHandle

type TaskHandle interface {
	Context() context.Context

	Cancel()
	Wait()
	Err() error
}

type TaskProgress

type TaskProgress interface {
	Context() context.Context
	Update(current, total int)
}

Jump to

Keyboard shortcuts

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