Documentation ¶
Index ¶
- Constants
- func GetPidUser(pid string) (string, error)
- func GetPidsByProcessCmdName(processName string, ctx context.Context) ([]string, error)
- func GetPidsByProcessName(processName string, ctx context.Context) ([]string, error)
- func GetPsArgs() string
- func IsCommandAvailable(commandName string) bool
- func IsDestroy(ctx context.Context) (string, bool)
- func MarshalModelSpec(models *Models, writer io.Writer)
- func ProcessExists(pid string) (bool, error)
- func SetDestroyFlag(ctx context.Context, suid string) context.Context
- type ActionModel
- func (am *ActionModel) Aliases() []string
- func (am *ActionModel) Executor(Channel) Executor
- func (am *ActionModel) Flags() []ExpFlagSpec
- func (am *ActionModel) LongDesc() string
- func (am *ActionModel) Matchers() []ExpFlagSpec
- func (am *ActionModel) Name() string
- func (am *ActionModel) ShortDesc() string
- type Channel
- type Executor
- type ExpActionCommandSpec
- type ExpCommandModel
- func (ecm *ExpCommandModel) Actions() []ExpActionCommandSpec
- func (ecm *ExpCommandModel) Example() string
- func (ecm *ExpCommandModel) Flags() []ExpFlagSpec
- func (ecm *ExpCommandModel) LongDesc() string
- func (ecm *ExpCommandModel) Name() string
- func (ecm *ExpCommandModel) PreExecutor() PreExecutor
- func (ecm *ExpCommandModel) ShortDesc() string
- type ExpFlag
- type ExpFlagSpec
- type ExpModel
- type ExpModelCommandSpec
- type ExpPrepareModel
- type LocalChannel
- type MockLocalChannel
- type Models
- type PreExecutor
Constants ¶
View Source
const (
DestroyKey = "suid"
)
View Source
const ProcessKey = "process"
grep ${key}
Variables ¶
This section is empty.
Functions ¶
func GetPidsByProcessCmdName ¶
GetPidsByProcessCmdName returns the matched process other than the current process
func GetPidsByProcessName ¶
GetPidsByProcessName returns the matched process other than the current process
func IsCommandAvailable ¶ added in v0.0.3
IsCommandAvailable return true if the command exists
func MarshalModelSpec ¶
func ProcessExists ¶ added in v0.3.0
ProcessExists returns true if the pid exists, otherwise return false.
Types ¶
type ActionModel ¶
type ActionModel struct { ActionName string `yaml:"action"` ActionAliases []string `yaml:"aliases,flow,omitempty"` ActionShortDesc string `yaml:"shortDesc"` ActionLongDesc string `yaml:"longDesc"` ActionMatchers []ExpFlag `yaml:"matchers,omitempty"` ActionFlags []ExpFlag `yaml:"flags,omitempty"` // contains filtered or unexported fields }
func (*ActionModel) Aliases ¶
func (am *ActionModel) Aliases() []string
func (*ActionModel) Executor ¶
func (am *ActionModel) Executor(Channel) Executor
func (*ActionModel) Flags ¶
func (am *ActionModel) Flags() []ExpFlagSpec
func (*ActionModel) LongDesc ¶
func (am *ActionModel) LongDesc() string
func (*ActionModel) Matchers ¶
func (am *ActionModel) Matchers() []ExpFlagSpec
func (*ActionModel) Name ¶
func (am *ActionModel) Name() string
func (*ActionModel) ShortDesc ¶
func (am *ActionModel) ShortDesc() string
type Channel ¶
type Channel interface { // Run command Run(ctx context.Context, script, args string) *transport.Response // GetScriptPath GetScriptPath() string }
func NewLocalChannel ¶
func NewLocalChannel() Channel
type Executor ¶
type Executor interface { // FlagName is used to identify the executor Name() string // Exec is used to execute the experiment Exec(uid string, ctx context.Context, model *ExpModel) *transport.Response SetChannel(channel Channel) }
Executor defines the executor interface
type ExpActionCommandSpec ¶
type ExpActionCommandSpec interface { // FlagName returns the action FlagName Name() string // Aliases returns command alias names Aliases() []string // ShortDesc returns short description for the action ShortDesc() string // LongDesc returns full description for the action LongDesc() string // Matchers returns the list of matchers supported by the action Matchers() []ExpFlagSpec // Flags returns the list of flags supported by the action Flags() []ExpFlagSpec // Executor returns the action command executor Executor(channel Channel) Executor }
ExpActionCommandSpec defines the action command interface for the experimental plugin
type ExpCommandModel ¶
type ExpCommandModel struct { ExpName string `yaml:"target"` ExpShortDesc string `yaml:"shortDesc"` ExpLongDesc string `yaml:"longDesc"` ExpExample string `yaml:"example"` ExpActions []ActionModel `yaml:"actions"` ExpScope string `yaml:"scope"` ExpPrepareModel ExpPrepareModel `yaml:"prepare,omitempty"` ExpSubTargets []string `yaml:"subTargets,flow,omitempty"` // contains filtered or unexported fields }
func (*ExpCommandModel) Actions ¶
func (ecm *ExpCommandModel) Actions() []ExpActionCommandSpec
func (*ExpCommandModel) Example ¶
func (ecm *ExpCommandModel) Example() string
func (*ExpCommandModel) Flags ¶
func (ecm *ExpCommandModel) Flags() []ExpFlagSpec
func (*ExpCommandModel) LongDesc ¶
func (ecm *ExpCommandModel) LongDesc() string
func (*ExpCommandModel) Name ¶
func (ecm *ExpCommandModel) Name() string
func (*ExpCommandModel) PreExecutor ¶
func (ecm *ExpCommandModel) PreExecutor() PreExecutor
func (*ExpCommandModel) ShortDesc ¶
func (ecm *ExpCommandModel) ShortDesc() string
type ExpFlag ¶
type ExpFlag struct { // Name returns the flag FlagName Name string `yaml:"name"` // Desc returns the flag description Desc string `yaml:"desc"` // NoArgs means no arguments NoArgs bool `yaml:"noArgs"` // Required means necessary or not Required bool `yaml:"required"` }
ExpFlag defines the action flag
func (*ExpFlag) FlagNoArgs ¶
func (*ExpFlag) FlagRequired ¶
type ExpFlagSpec ¶
type ExpModel ¶
type ExpModel struct { // Target is experiment target Target string // ActionName is the experiment action FlagName, for example delay ActionName string // ActionFlags is the experiment action flags, for example time and offset ActionFlags map[string]string }
ExpModel is the experiment data object
type ExpModelCommandSpec ¶
type ExpModelCommandSpec interface { // FlagName returns the command FlagName Name() string // ShortDesc returns short description for the command ShortDesc() string // LongDesc returns full description for the command LongDesc() string // Example returns use case for the command Example() string // Actions returns the list of actions supported by the command Actions() []ExpActionCommandSpec // Flags returns the command flags Flags() []ExpFlagSpec PreExecutor() PreExecutor }
ExpModelCommandSpec defines the command interface for the experimental plugin
type ExpPrepareModel ¶
type LocalChannel ¶
type LocalChannel struct { }
func (*LocalChannel) GetScriptPath ¶
func (client *LocalChannel) GetScriptPath() string
type MockLocalChannel ¶ added in v0.2.0
type MockLocalChannel struct { Response *transport.Response ScriptPath string ExpectedCommands []string InvokeTime int NoCheck bool T *testing.T }
func (*MockLocalChannel) GetScriptPath ¶ added in v0.2.0
func (mlc *MockLocalChannel) GetScriptPath() string
type Models ¶
type Models struct { Version string `yaml:"version"` Kind string `yaml:"kind"` Models []ExpCommandModel `yaml:"items"` }
Click to show internal directories.
Click to hide internal directories.