Back to godoc.org
github.com/juju/juju / worker / uniter / runcommands

Package runcommands

v0.0.0-...-194c9aa
Latest Go to latest

The highest tagged major version is .

Published: Sep 21, 2020 | License: AGPL-3.0 | Module: github.com/juju/juju

Index

func NewCommandsResolver

func NewCommandsResolver(commands Commands, commandCompleted func(string)) resolver.Resolver

NewCommandsResolver returns a new Resolver that returns operations to execute "juju run" commands.

The returned resolver's NextOp method will return operations to execute run commands whenever the remote state's "Commands" is non-empty, by taking the first ID in the sequence and fetching the command arguments from the Commands interface passed into this function. When the command execution operation is committed, the ID of the command is passed to the "commandCompleted" callback.

type Commands

type Commands interface {
	// AddCommand adds the given command arguments and response function
	// and returns a unique identifier.
	AddCommand(operation.CommandArgs, operation.CommandResponseFunc) string

	// GetCommand returns the command arguments and response function
	// with the specified ID, as registered in AddCommand.
	GetCommand(id string) (operation.CommandArgs, operation.CommandResponseFunc)

	// RemoveCommand removes the command arguments and response function
	// associated with the specified ID.
	RemoveCommand(id string)
}

Commands is an interface providing a means of storing and retrieving arguments for running commands.

func NewCommands

func NewCommands() Commands

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier