manager

package
v0.0.0-...-f0b9b21 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTaskError

func NewTaskError(
	id uuid.UUID,
	name string,
	parentError error,
) error

Types

type IdentMap

type IdentMap[N Identifiable] interface {
	Add(n N)
	Set(n N)
	Remove(n N)
	Has(n N) (has bool)
	Len() (n int)
	Entries() []N
	Range(func(n N) (next bool))
	First(func(n N) (condition bool)) (n N)
	FirstByID(id uuid.UUID) (n N)
}

type Identifiable

type Identifiable interface{ ID() uuid.UUID }

type Manager

type Manager interface {
	Register(tasker task.Tasker, settings Settings)
	Unregister(tasker task.Tasker)

	Enable(id uuid.UUID) (err error)
	Disable(id uuid.UUID) (err error)

	Run(ctx context.Context, id uuid.UUID) (err error)
	Stop(ctx context.Context, id uuid.UUID) (err error)

	StartAll(ctx context.Context) (err error)

	Get(id uuid.UUID) (taskInfo task.Info, err error)

	Info() []task.Info

	Errors() <-chan error

	Close()
}

func New

func New(hub websocket.Hub) Manager

type Settings

type Settings struct {
	Disable bool
	Period  time.Duration
	Manual  bool
}

type TaskError

type TaskError struct {
	ID   uuid.UUID
	Name string
	Err  error
}

func (TaskError) Error

func (e TaskError) Error() string

type TaskInfo

type TaskInfo struct {
	State task.State

	LastActivity time.Time
	StartedAt    *time.Time
	EndedAt      *time.Time

	CancelFunc context.CancelFunc
	Settings   Settings
	Config     any

	Trigger chan struct{}
	// contains filtered or unexported fields
}

func TaskInfoFor

func TaskInfoFor(tasker task.Tasker, settings Settings) *TaskInfo

func (*TaskInfo) Active

func (s *TaskInfo) Active(cancelFunc context.CancelFunc) *TaskInfo

func (*TaskInfo) Disable

func (s *TaskInfo) Disable() *TaskInfo

func (*TaskInfo) Enable

func (s *TaskInfo) Enable() *TaskInfo

func (*TaskInfo) ID

func (s *TaskInfo) ID() uuid.UUID

func (*TaskInfo) Info

func (s *TaskInfo) Info() task.Info

func (*TaskInfo) L

func (s *TaskInfo) L(ctx context.Context) *zap.Logger

func (*TaskInfo) Name

func (s *TaskInfo) Name() string

func (*TaskInfo) Passive

func (s *TaskInfo) Passive() *TaskInfo

func (*TaskInfo) Run

func (s *TaskInfo) Run(ctx context.Context) error

func (*TaskInfo) StateIs

func (s *TaskInfo) StateIs(states ...task.State) bool

Jump to

Keyboard shortcuts

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