MCPcopy
hub / github.com/pingcap/tidb / makeStatusController

Function makeStatusController

br/pkg/task/stream.go:1039–1062  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1039func 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
1065func RunStreamStatus(

Callers 1

RunStreamStatusFunction · 0.85

Calls 9

GetConsoleFunction · 0.92
NewMetaDataClientFunction · 0.92
PrintTaskByTableFunction · 0.92
PrintTaskWithJSONFunction · 0.92
TeeTaskPrinterFunction · 0.92
NewStatusControllerFunction · 0.92
GetKeepaliveFunction · 0.85
dialEtcdWithCfgFunction · 0.70
NewMgrFunction · 0.70

Tested by

no test coverage detected