httphandler

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Tasks

A task is a single unit of asynchronous work - such as transcoding a file or probing a stream - tracked under a unique uuid. Tasks are created and started elsewhere in the system; this API lets you list them, inspect an individual task's progress and result, and cancel one that's still running.

Each task moves through a small set of states, reported as state in its status:

  • not_started - registered, but not yet running.
  • running - currently executing.
  • done - finished successfully.
  • error - finished, but returned an error.
  • cancelled - cancellation was requested, and the task has since stopped.

A task starts in not_started, moves to running once started, and ends in exactly one of done, error, or cancelled. Cancelling a task only requests that it stop - it stays in running until it actually does, at which point it settles into cancelled. A task's final status remains available through this API even after it finishes.

GET /task

Returns a list of tasks tracked by the manager, in the order they were added. Filter by state, and page through results with offset and limit.

GET /task/event

Streams every task event as it happens - a task being added, started, reporting progress or a result, cancelled, finishing, or removed - as server-sent events. Each event's event: field is the event name (e.g. started, progress, finished) and its data: field is the task's status at that moment, JSON- encoded the same way as GET /task/{uuid}.

Filter by uuid to only stream events for one task, and/or by event (repeatable) to only stream specific event names, e.g. ?event=started&event=finished.

The stream stays open until the client disconnects.

GET /task/{uuid}

Returns the current status of the task with the given uuid.

DELETE /task/{uuid}

Cancels the task with the given uuid. It's a no-op if the task has already finished or was never started. Returns the task's status after the cancellation request.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTaskHandlers

func RegisterTaskHandlers(manager *manager.Manager, router *httprouter.Router) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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