tasks

package
v0.0.0-...-20d0dac Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout        = 60 * time.Second
	DefaultPollDuration   = time.Millisecond * 500
	DefaultSpinnerCharSet = 9 // Classic Unix quiet |/-\|

)

Variables

This section is empty.

Functions

func GetWaitCmd

func GetWaitCmd(task proxmox.Task) string

func TaskStatus

func TaskStatus(ctx context.Context, task proxmox.Task) (string, error)

TaskStatus updates the task and returns a message explaining the task's status

func WaitTask

func WaitTask(ctx context.Context, task *proxmox.Task, opts ...WaitOption) (err error)

func Watch

func Watch(ctx context.Context, start int, t *proxmox.Task) (chan string, error)

Types

type PollingOption

type PollingOption func(c *pollingConfig)

PollingOption is a function used to set items in the pollingConfig struct.

func WithPollDuration

func WithPollDuration(pollDuration time.Duration) PollingOption

WithPollDuration sets the interval between task polls.

func WithTimeout

func WithTimeout(timeout time.Duration, stopTaskOnTimeout bool) PollingOption

WithTimeout is a PollingOption that starts a timeout (for `timeout`). The timeout will optionally stop the task on timeout (stopTaskOnTimeout)

type SpinnerOption

type SpinnerOption func(c *spinnerConfig)

func WithSpinnerCharSet

func WithSpinnerCharSet(charset int) SpinnerOption

func WithSpinnerSpeed

func WithSpinnerSpeed(speed time.Duration) SpinnerOption

type WaitOption

type WaitOption func(c *waitConfig)

func WithOutput

func WithOutput() WaitOption

func WithPolling

func WithPolling(opts ...PollingOption) WaitOption

WithPolling enables polling the task every pollDuration. WithPolling also optionally enables a timeout (WithTimeout).

func WithSpinner

func WithSpinner(opts ...SpinnerOption) WaitOption

Jump to

Keyboard shortcuts

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