task

package
v0.0.0-...-426bf0d Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package task exposes the Task interface and some utils related to it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is(t, target Task) bool

Is compares to tasks to determine if they match.

A task is considered to match a target if it is equal to that target or if it implements a method Is(Task) bool such that Is(target) returns true.

func MarshalYAML

func MarshalYAML(tasks []Task) (out []byte, err error)

MarshalYAML marshals a slice of tasks in YAML format.

func Register

func Register[T Task]()

Register registers a task type to the gobal registry. This is needed to deserialize tasks. Call Register[YourTask] to the module's init in order to use it.

Types

type Connection

type Connection interface {
	SendProAttachment(proToken string) error
	SendLandscapeConfig(lpeConfig string) error
}

Connection is a connection to the WSL-Pro-Service that allows for sending commands.

type NeedsRetryError

type NeedsRetryError struct {
	SourceErr error
}

NeedsRetryError is an error that should be emitted by tasks that, in case of failure, should be retried at the next startup sequence.

func (NeedsRetryError) Error

func (e NeedsRetryError) Error() string

type Task

type Task interface {
	Execute(context.Context, Connection) error
}

Task represents a given task that is ging to be executed by a distro.

func UnmarshalYAML

func UnmarshalYAML(in []byte) (tasks []Task, err error)

UnmarshalYAML unmarshals a slice of tasks from a YAML document.

Jump to

Keyboard shortcuts

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