juju: github.com/wallyworld/juju/worker/uniter/runcommands Index | Files

package runcommands

import "github.com/wallyworld/juju/worker/uniter/runcommands"


Package Files


func NewCommandsResolver Uses

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 Uses

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 Uses

func NewCommands() Commands

Package runcommands imports 5 packages (graph). Updated 2020-08-06. Refresh now. Tools for package owners.