Documentation ¶
Overview ¶
Package actions provides Actions implementations and runner.
Index ¶
- type Action
- func NewMongoDBExplainAction(id string, params *agentpb.StartActionRequest_MongoDBExplainParams) Action
- func NewMongoDBQueryAdmincommandAction(id string, dsn, command string, arg interface{}) Action
- func NewMySQLExplainAction(id string, params *agentpb.StartActionRequest_MySQLExplainParams) Action
- func NewMySQLQuerySelectAction(id string, params *agentpb.StartActionRequest_MySQLQuerySelectParams) Action
- func NewMySQLQueryShowAction(id string, params *agentpb.StartActionRequest_MySQLQueryShowParams) 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 NewPostgreSQLQuerySelectAction(id string, params *agentpb.StartActionRequest_PostgreSQLQuerySelectParams) Action
- func NewPostgreSQLQueryShowAction(id string, params *agentpb.StartActionRequest_PostgreSQLQueryShowParams) Action
- func NewPostgreSQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowCreateTableParams) Action
- func NewPostgreSQLShowIndexAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowIndexParams) 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 NewMongoDBExplainAction ¶
func NewMongoDBExplainAction(id string, params *agentpb.StartActionRequest_MongoDBExplainParams) Action
NewMongoDBExplainAction creates a MongoDB EXPLAIN query Action.
func NewMongoDBQueryAdmincommandAction ¶
NewMongoDBQueryAdmincommandAction creates a MongoDB adminCommand query Action.
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 NewMySQLQuerySelectAction ¶
func NewMySQLQuerySelectAction(id string, params *agentpb.StartActionRequest_MySQLQuerySelectParams) Action
NewMySQLQuerySelectAction creates MySQL SELECT query Action.
func NewMySQLQueryShowAction ¶
func NewMySQLQueryShowAction(id string, params *agentpb.StartActionRequest_MySQLQueryShowParams) Action
NewMySQLQueryShowAction creates MySQL SHOW query Action.
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 NewPostgreSQLQuerySelectAction ¶
func NewPostgreSQLQuerySelectAction(id string, params *agentpb.StartActionRequest_PostgreSQLQuerySelectParams) Action
NewPostgreSQLQuerySelectAction creates PostgreSQL SELECT query Action.
func NewPostgreSQLQueryShowAction ¶
func NewPostgreSQLQueryShowAction(id string, params *agentpb.StartActionRequest_PostgreSQLQueryShowParams) Action
NewPostgreSQLQueryShowAction creates PostgreSQL SHOW query Action.
func NewPostgreSQLShowCreateTableAction ¶
func NewPostgreSQLShowCreateTableAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowCreateTableParams) Action
NewPostgreSQLShowCreateTableAction creates PostgreSQL SHOW CREATE TABLE Action. This is an Action that can run `\d+ table` command analog on PostgreSQL service with given DSN.
func NewPostgreSQLShowIndexAction ¶
func NewPostgreSQLShowIndexAction(id string, params *agentpb.StartActionRequest_PostgreSQLShowIndexParams) Action
NewPostgreSQLShowIndexAction creates PostgreSQL SHOW INDEX Action. This is an Action that can run `SHOW INDEX` command on PostgreSQL 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.
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.
Source Files ¶
- actions.go
- concurrent_runner.go
- mongodb_explain_action.go
- mongodb_query_admincommand_action.go
- mysql_explain_action.go
- mysql_query_select_action.go
- mysql_query_show_action.go
- mysql_show_create_table_action.go
- mysql_show_index_action.go
- mysql_show_table_status_action.go
- postgresql_query_select_action.go
- postgresql_query_show_action.go
- postgresql_show_create_table_action.go
- postgresql_show_index_action.go
- process_action.go