taskstate

package
v0.0.0-...-4d84aa9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: AGPL-3.0 Imports: 4 Imported by: 1

Documentation

Overview

To avoid needing to store the entire state even when not needed, tasks defines a state interface to store and fetch only needed state

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {
	State string
	Data  map[string]any
}

type TaskProgressState

type TaskProgressState interface {
	// GetProgress returns the current progress of the task. This is useful
	// for resumable tasks like server restores
	GetProgress() (*Progress, error)

	// Sets/demarkates the progress of the task, if supported
	SetProgress(prog *Progress) error
}

type TaskState

type TaskState interface {
	// GetTransport returns the http transport to use for tasks
	//
	// E.g. localjobs uses a custom http transport to support local files via the file:// scheme
	Transport() *http.Transport

	// Returns the current operation mode of the service (jobserver/localjob etc.). Similar to webserver/state.CurrentOperationMode
	OperationMode() string

	// Returns a *discordgo.Session, the bots current user and a boolean indicating whether or not the gateway is available
	//
	// This boolean is currently unused
	Discord() (*discordgo.Session, *discordgo.User, bool)

	// Debug Info and extra debug info
	DebugInfo() *debug.BuildInfo

	// Context returns the context to use for the task
	Context() context.Context
}

Jump to

Keyboard shortcuts

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