state

package
v0.0.0-...-191742e Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

To avoid needing to store the entire state even when not needed, jobs 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 ProgressState

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

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

type State

type State interface {
	// GetTransport returns the http transport to use for jobs
	//
	// 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 job
	Context() context.Context
}

Jump to

Keyboard shortcuts

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