makeStatusController makes the status controller via some config. this should better be in the `stream` package but it is impossible because of cyclic requirements.
(ctx context.Context, cfg *StreamConfig, g glue.Glue)
| 1037 | // makeStatusController makes the status controller via some config. |
| 1038 | // this should better be in the `stream` package but it is impossible because of cyclic requirements. |
| 1039 | func makeStatusController(ctx context.Context, cfg *StreamConfig, g glue.Glue) (*stream.StatusController, error) { |
| 1040 | console := glue.GetConsole(g) |
| 1041 | etcdCLI, err := dialEtcdWithCfg(ctx, cfg.Config) |
| 1042 | if err != nil { |
| 1043 | return nil, err |
| 1044 | } |
| 1045 | cli := streamhelper.NewMetaDataClient(etcdCLI) |
| 1046 | var printer stream.TaskPrinter |
| 1047 | if !cfg.JSONOutput { |
| 1048 | printer = stream.PrintTaskByTable(console) |
| 1049 | } else { |
| 1050 | printer = stream.PrintTaskWithJSON(console) |
| 1051 | } |
| 1052 | mgr, err := NewMgr(ctx, g, cfg.PD, cfg.TLS, GetKeepalive(&cfg.Config), |
| 1053 | cfg.CheckRequirements, false, conn.StreamVersionChecker) |
| 1054 | if err != nil { |
| 1055 | return nil, err |
| 1056 | } |
| 1057 | if cfg.DumpStatusTo != nil { |
| 1058 | printer = stream.TeeTaskPrinter(printer, cfg.DumpStatusTo) |
| 1059 | } |
| 1060 | ctl := stream.NewStatusController(cli, mgr, printer) |
| 1061 | return ctl, nil |
| 1062 | } |
| 1063 | |
| 1064 | // RunStreamStatus get status for a specific stream task |
| 1065 | func RunStreamStatus( |
no test coverage detected