Documentation
¶
Overview ¶
Package repl provides a REPL and CLI functionality for aRPC connections.
Index ¶
- Constants
- Variables
- func AddErrSyntax(event *am.Event, mach *am.Machine, err error, args am.A) error
- func InspectingCmds(repl *Repl) []*cobra.Command
- func ListingFlags(cmd *cobra.Command)
- func LogArgs(args am.A) map[string]string
- func MutationCmds(repl *Repl) []*cobra.Command
- func MutationFlags(repl ReplApi, cmd *cobra.Command, groupCmd bool)
- func NewRootCommand(repl *Repl, cliArgs, osArgs []string) *cobra.Command
- func Pass(args *A) am.A
- func ReplCmds(repl *Repl) []*cobra.Command
- func SysCmds(repl *Repl) []*cobra.Command
- func WaitingCmds(repl *Repl) []*cobra.Command
- type A
- type History
- type HistoryItem
- type ListFilters
- type Repl
- func (r *Repl) AddrChangedEnter(e *am.Event) bool
- func (r *Repl) AddrChangedState(e *am.Event)
- func (r *Repl) CmdAddEnter(e *am.Event) bool
- func (r *Repl) CmdAddState(e *am.Event)
- func (r *Repl) CmdGroupAddEnter(e *am.Event) bool
- func (r *Repl) CmdGroupAddState(e *am.Event)
- func (r *Repl) CmdGroupRemoveEnter(e *am.Event) bool
- func (r *Repl) CmdGroupRemoveState(e *am.Event)
- func (r *Repl) CmdRemoveEnter(e *am.Event) bool
- func (r *Repl) CmdRemoveState(e *am.Event)
- func (r *Repl) ConnectedExit(e *am.Event) bool
- func (r *Repl) ConnectedFullyEnter(e *am.Event) bool
- func (r *Repl) ConnectedFullyExit(e *am.Event) bool
- func (r *Repl) ConnectedState(e *am.Event)
- func (r *Repl) ConnectingEnter(e *am.Event) bool
- func (r *Repl) ConnectingExit(e *am.Event) bool
- func (r *Repl) ConnectingState(e *am.Event)
- func (r *Repl) DisconnectedState(e *am.Event)
- func (r *Repl) DisconnectingState(e *am.Event)
- func (r *Repl) ErrNetworkState(e *am.Event)
- func (r *Repl) ListMachines(filters *ListFilters) ([]*arpc.Client, error)
- func (r *Repl) ListMachinesEnter(e *am.Event) bool
- func (r *Repl) ListMachinesState(e *am.Event)
- func (r *Repl) NetMach(machId string) *arpc.NetworkMachine
- func (r *Repl) NetMachArgs(machId string) []string
- func (r *Repl) Print(txt string, args ...any)
- func (r *Repl) PrintErr(txt string, args ...any)
- func (r *Repl) PrintMsg(txt string, args ...any)
- func (r *Repl) ReplModeState(e *am.Event)
- func (r *Repl) RpcConnEnter(e *am.Event) bool
- func (r *Repl) RpcConnState(e *am.Event)
- func (r *Repl) RpcDisconnEnter(e *am.Event) bool
- func (r *Repl) RpcDisconnState(e *am.Event)
- func (r *Repl) StartEnter(e *am.Event) bool
- func (r *Repl) StartState(e *am.Event)
- type ReplApi
- type S
- type T
Constants ¶
View Source
const APrefix = "am_repl"
Variables ¶
View Source
var ErrSyntax = errors.New("syntax error")
View Source
var Sp = utils.Sp
Functions ¶
func AddErrSyntax ¶
AddErrSyntax wraps an error in the ErrSyntax sentinel and adds to a machine.
func InspectingCmds ¶
func ListingFlags ¶
func MutationCmds ¶
func WaitingCmds ¶
Types ¶
type A ¶
type A struct {
Id string `log:"id"`
Addrs []string `log:"addr"`
Lines []string
States []string `log:"states"`
// machine ID
MachId string `log:"mach"`
// list of machine IDs
MachIds []string
// Mutation arguments passed from a Cobra cmd handler.
MutArgs [2][]string
// Arguments passed to the CLI from the shell
CliArgs []string
// RpcCh is a return channel for a list of [rpc.NetworkMachine]. It has to be
// buffered or the mutation will fail.
RpcCh chan<- []*rpc.Client
ListFilters *ListFilters
}
A is a struct for node arguments. It's a typesafe alternative to am.A.
type History ¶
type History struct {
// contains filtered or unexported fields
}
type ListFilters ¶
type ListFilters struct {
IdExact string
IdSubstr string
IdRegexp *regexp.Regexp
IdPrefix string
IdSuffix string
Parent string
MtimeMin uint64
MtimeMax uint64
MtimeStates S
StatesActive S
StatesInactive S
Limit int
StartIdx int
// Include never connected machines
NoSchema bool
// Exclude disconnected machines
SkipDisconn bool
}
TODO merge with pkg/pubsub and pkg/integrations TODO extract to pkg/helpers.Group
type Repl ¶
type Repl struct {
// TODO JSON output
*am.ExceptionHandler
Mach *am.Machine
// Addrs ending with /* are WebSockets
// TODO keep NAMED addresses eg CLI0, filename1, filename2, CLI1
// and manipulate when watching for changes, keeping the prev ones
Addrs []string
Cmd *cobra.Command
C *console.Console
// am-dbg address for new clients
DbgAddr string
// contains filtered or unexported fields
}
func (*Repl) AddrChangedState ¶ added in v0.12.0
TODO avoid a full restart
func (*Repl) CmdAddState ¶
func (*Repl) CmdGroupAddState ¶
func (*Repl) CmdGroupRemoveState ¶
func (*Repl) CmdRemoveState ¶
func (*Repl) ConnectedState ¶
func (*Repl) ConnectingState ¶
func (*Repl) DisconnectedState ¶
func (*Repl) DisconnectingState ¶
func (*Repl) ErrNetworkState ¶ added in v0.12.0
func (*Repl) ListMachines ¶
func (r *Repl) ListMachines(filters *ListFilters) ([]*arpc.Client, error)
func (*Repl) ListMachinesState ¶
func (*Repl) NetMach ¶ added in v0.17.1
func (r *Repl) NetMach(machId string) *arpc.NetworkMachine
NetMach returns an RPC worker with a given ID, or nil.
func (*Repl) NetMachArgs ¶ added in v0.17.1
NetMachArgs returns a list of registered typed args for a given machine.
func (*Repl) ReplModeState ¶
func (*Repl) RpcConnState ¶
func (*Repl) RpcDisconnState ¶
func (*Repl) StartState ¶
Click to show internal directories.
Click to hide internal directories.