commands.go ×11

Frontier kind: Code frontier

unlabeled · c_9437db5072d5

4 tests · 3262 LOC · 142 files · introduces 0 tests · 44 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges44 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
416 ranges3262 lines · 142 files · Browse complete extent
All tests (intent)
4 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 44 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/tools/tdbg/commands.go 44 introduced LOC · 11 ranges

Open complete file

915 case scheduleID != "":
916 return migrateSingleSchedule(c, clientFactory, target, targetStr, scheduleID)
917 > case isStdinPiped(): commands.go
918 > return migrateSchedulesFromStdin(c, clientFactory, target, targetStr)
919 default:
920 return fmt.Errorf("specify one of: --%s, --%s, or pipe JSON lines on stdin", FlagScheduleID, FlagFromVisibility)
1131 target adminservice.MigrateScheduleRequest_SchedulerTarget,
1132 targetStr string,
1133 > ) error { commands.go
1134 > execute := c.Bool(FlagExecute)
1135 > workers := max(c.Int(FlagWorkers), 1)
1136 > adminClient := clientFactory.AdminClient(c)
1137 >
1138 > var summary migrateSummary
1139 > closeLog, err := openMigrateLog(c, &summary)
1140 > if err != nil {
1141 return err
1142 }
1143 > defer closeLog() commands.go
1144 >
1145 > jobs := make(chan migrateJob)
1146 > var wg sync.WaitGroup
1147 > for range workers {
1148 > wg.Go(func() {
1149 > for job := range jobs {
1150 > migrateOne(c, adminClient, job.namespace, job.scheduleID, target, targetStr, execute, &summary)
1151 > }
1152 })
1153 }
1154
1155 > var readErr error commands.go
1156 > scanner := bufio.NewScanner(os.Stdin)
1157 > for scanner.Scan() {
1158 > line := strings.TrimSpace(scanner.Text())
1159 > if line == "" {
1160 continue
1161 }
1162 > var record struct { commands.go
1163 > Namespace string `json:"namespace"`
1164 > ScheduleID string `json:"schedule_id"`
1165 > }
1166 > if err := json.Unmarshal([]byte(line), &record); err != nil {
1167 readErr = fmt.Errorf("invalid JSON line %q: %w", line, err)
1168 break
1169 }
1170 > if record.Namespace == "" || record.ScheduleID == "" { commands.go
1171 readErr = fmt.Errorf("each line must include non-empty \"namespace\" and \"schedule_id\": %q", line)
1172 break
1173 }
1174 > jobs <- migrateJob{namespace: record.Namespace, scheduleID: record.ScheduleID} commands.go
1175 }
1176 > if readErr == nil { commands.go
1177 > if err := scanner.Err(); err != nil {
1178 readErr = fmt.Errorf("error reading stdin: %w", err)
1179 }
1180 }
1181 > close(jobs) commands.go
1182 > wg.Wait()
1183 >
1184 > // Always report what was migrated before surfacing a read error: workers may have already
1185 > // migrated the lines read so far, and the user needs to see that partial progress.
1186 > summary.print(c, execute)
1187 > return readErr
1188 }
1189
1299
1300 // isStdinPiped reports whether stdin is connected to a pipe or file rather than a terminal.
1301 > func isStdinPiped() bool { commands.go
1302 > fi, err := os.Stdin.Stat()
1303 > if err != nil {
1304 return false
1305 }
1306 > return (fi.Mode() & os.ModeCharDevice) == 0 commands.go
1307 }