Help us shape the future of Go! Take the 2026 Go Developer Survey

task

package
v1.0.85 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register added in v1.0.84

func Register(action string, h Handler)

func RegisterDefaults added in v1.0.84

func RegisterDefaults()

RegisterDefaults wires the action names the backend enqueues. Each handler is a no-op when its post-condition already holds, which is what makes at-least-once delivery safe.

func ReportInstalledMods added in v1.0.84

func ReportInstalledMods(ctx context.Context, mods []v2.InstalledMod) error

ReportInstalledMods tells the backend what is actually on the agent's disk.

func SetClient added in v1.0.84

func SetClient(c pb.AgentTaskServiceClient)

SetClient wires the authenticated task client. It must be called before the executor starts, so a handler can never find a nil client.

Types

type Executor added in v1.0.84

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

Executor drains assignments one at a time. Serialization is the point: the backend's unique running-index guarantees it never sends a second task, and this goroutine guarantees we never start one.

func NewExecutor added in v1.0.84

func NewExecutor(client pb.AgentTaskServiceClient, ctx context.Context) *Executor

func (*Executor) DrainAndRelease added in v1.0.84

func (e *Executor) DrainAndRelease(ctx context.Context) error

DrainAndRelease cancels the running task and hands it back to the queue without spending an attempt. A rolling restart therefore neither burns retry budget nor waits out the lease: the install resumes seconds later in the new process.

func (*Executor) RunningTask added in v1.0.84

func (e *Executor) RunningTask() (string, string)

RunningTask lets the stream client re-announce in-flight work on reconnect.

func (*Executor) Start added in v1.0.84

func (e *Executor) Start()

func (*Executor) Submit added in v1.0.84

func (e *Executor) Submit(a *pb.TaskAssignment)

type Handler added in v1.0.84

type Handler func(ctx context.Context, data json.RawMessage, progress func(pct int32, msg string)) error

Handler runs one action. It must be idempotent: delivery is at-least-once, so a handler may see the same task twice.

Jump to

Keyboard shortcuts

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