nodeaction

package
v3.0.0-rc40 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalFirst

func LocalFirst() funcopt.O

LocalFirst makes actions not explicitly Local nor remoted via NodeSelector be treated as local (CRM level).

func WithAsyncFunc

func WithAsyncFunc(f func(context.Context) (uuid.UUID, error)) funcopt.O

WithAsyncFunc sets a function to run if the action is async

func WithAsyncTarget

func WithAsyncTarget(s string) funcopt.O

WithAsyncTarget is the node or object state the daemons should orchestrate to reach.

func WithAsyncTime

func WithAsyncTime(d time.Duration) funcopt.O

WithAsyncTime is the maximum duration to wait for an async action It needs WithAsyncWait(true)

func WithAsyncWait

func WithAsyncWait(v bool) funcopt.O

WithAsyncWait runs an event-watcher waiting for target state, global expect reached

func WithAsyncWatch

func WithAsyncWatch(v bool) funcopt.O

WithAsyncWatch runs an event-driven monitor on the selected objects after setting a new target. So the operator can see the orchestration unfolding.

func WithColor

func WithColor(s string) funcopt.O

WithColor activates the colorization of outputs auto => yes if os.Stdout is a tty yes no

func WithFormat

func WithFormat(s string) funcopt.O

WithFormat controls the output data format. <empty> => human readable format json => json machine readable format flat => flattened json (<k>=<v>) machine readable format flat_json => same as flat (backward compat)

func WithLocal

func WithLocal(v bool) funcopt.O

WithLocal routes the action to the CRM instead of remoting it via orchestration or remote execution.

func WithLocalFunc

func WithLocalFunc(f func() (any, error)) funcopt.O

WithLocalFunc sets a function to run if the action is local

func WithRemoteFunc

func WithRemoteFunc(f func(context.Context, string) (any, error)) funcopt.O

WithRemoteFunc sets a function to run if the action is remote

func WithRemoteNodes

func WithRemoteNodes(s string) funcopt.O

WithRemoteNodes expands into a selection of nodes to execute the action on.

func WithSort

func WithSort(s string) funcopt.O

WithSort sets the order of the result table.

An action reaching several nodes answers a row per run, and they arrive in whatever order the nodes answered in.

Types

type T

type T struct {
	actionrouter.T
	// AsyncFunc submits the action and answers the orchestration it was
	// accepted as, which is what a wait waits for.
	AsyncFunc  func(context.Context) (uuid.UUID, error)
	LocalFunc  func() (any, error)
	RemoteFunc func(context.Context, string) (any, error)
}

T has is an actionrouter.T with a node func

func New

func New(opts ...funcopt.O) *T

func (T) Do

func (t T) Do() error

func (T) DoAsync

func (t T) DoAsync() error

DoAsync uses the agent API to submit a target state to reach via an orchestration.

func (T) DoLocal

func (t T) DoLocal() error

func (T) DoRemote

func (t T) DoRemote() error

DoRemote posts the action to a peer node agent API, for synchronous execution.

func (T) HasLocal

func (t T) HasLocal() bool

func (T) Options

func (t T) Options() actionrouter.T

Options returns the base Action struct

Jump to

Keyboard shortcuts

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