Documentation ¶
Overview ¶
Package actions provides Actions implementations and runner.
Index ¶
- type Action
- func NewMySQLExplainAction(id string, params *agentpb.StartActionRequest_MySQLExplainParams) Action
- func NewMySQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_MySQLShowCreateTableParams) Action
- func NewMySQLShowIndexAction(id string, params *agentpb.StartActionRequest_MySQLShowIndexParams) Action
- func NewMySQLShowTableStatusAction(id string, params *agentpb.StartActionRequest_MySQLShowTableStatusParams) Action
- func NewProcessAction(id string, cmd string, arg []string) Action
- type ActionResult
- type ConcurrentRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // ID returns an Action ID. ID() string // Type returns an Action type. Type() string // Run runs an Action and returns output and error. Run(ctx context.Context) ([]byte, error) // contains filtered or unexported methods }
Action describes an abstract thing that can be run by a client and return some output.
func NewMySQLExplainAction ¶
func NewMySQLExplainAction(id string, params *agentpb.StartActionRequest_MySQLExplainParams) Action
NewMySQLExplainAction creates MySQL Explain Action. This is an Action that can run `EXPLAIN` command on MySQL service with given DSN.
func NewMySQLShowCreateTableAction ¶
func NewMySQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_MySQLShowCreateTableParams) Action
NewMySQLShowCreateTableAction creates MySQL SHOW CREATE TABLE Action. This is an Action that can run `SHOW CREATE TABLE` command on MySQL service with given DSN.
func NewMySQLShowIndexAction ¶
func NewMySQLShowIndexAction(id string, params *agentpb.StartActionRequest_MySQLShowIndexParams) Action
NewMySQLShowIndexAction creates MySQL SHOW INDEX Action. This is an Action that can run `SHOW INDEX` command on MySQL service with given DSN.
func NewMySQLShowTableStatusAction ¶
func NewMySQLShowTableStatusAction(id string, params *agentpb.StartActionRequest_MySQLShowTableStatusParams) Action
NewMySQLShowTableStatusAction creates MySQL SHOW TABLE STATUS Action. This is an Action that can run `SHOW TABLE STATUS` command on MySQL service with given DSN.
func NewProcessAction ¶
NewProcessAction creates a new process Action.
Process Action, it's an abstract Action that can run an external commands. This commands can be a shell script, script written on interpreted language, or binary file.
type ActionResult ¶
ActionResult represents an Action result.
type ConcurrentRunner ¶
type ConcurrentRunner struct {
// contains filtered or unexported fields
}
ConcurrentRunner represents concurrent Action runner. Action runner is component that can run an Actions.
func NewConcurrentRunner ¶
func NewConcurrentRunner(ctx context.Context, timeout time.Duration) *ConcurrentRunner
NewConcurrentRunner returns new runner. With this component you can run actions concurrently and read action results when they will be finished. If timeout is 0 it sets to default = 10 seconds.
ConcurrentRunner is stopped when context passed to NewConcurrentRunner is canceled. Results are reported via Results() channel which must be read until it is closed.
func (*ConcurrentRunner) Results ¶
func (r *ConcurrentRunner) Results() <-chan ActionResult
Results returns channel with Actions results.
func (*ConcurrentRunner) Start ¶
func (r *ConcurrentRunner) Start(a Action)
Start starts an Action in a separate goroutine.
func (*ConcurrentRunner) Stop ¶
func (r *ConcurrentRunner) Stop(id string)
Stop stops running Action.