operation

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 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.

Documentation

Overview

Package operation polls Control Plane operations until they reach a terminal state. It is the `--wait` primitive for every mutation command.

Index

Constants

View Source
const (
	DefaultTimeout = 10 * time.Minute
)

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(status string) bool

IsTerminal reports whether a canonical operation status will never change.

func Wait

func Wait(ctx context.Context, poller Poller, initial client.OperationEnvelope, options Options) (client.OperationEnvelope, error)

Wait polls the operation until it is terminal, the timeout elapses, or the context is cancelled. The returned envelope is always the last document the caller can render, even when err is non-nil. Wait never cancels remotely.

Types

type Options

type Options struct {
	Timeout     time.Duration
	Interval    time.Duration
	MaxInterval time.Duration
	Now         func() time.Time
	Sleep       func(context.Context, time.Duration) error
	// Jitter bounds the random spread added to a computed delay. Nil uses
	// up to 25 percent of the delay; tests inject a deterministic function.
	Jitter func(time.Duration) time.Duration
	// Progress is called after every poll that returned an operation.
	Progress func(client.Operation)
}

type Poller

type Poller interface {
	ShowOperation(ctx context.Context, operationID string) (client.OperationEnvelope, error)
}

Poller is the read primitive used between polls; *client.Client satisfies it.

Jump to

Keyboard shortcuts

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