calendar.go ×8

Frontier kind: Code frontier

unlabeled · c_d80f2cb76273

4 tests · 2367 LOC · 113 files · introduces 0 tests · 35 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges35 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
358 ranges2367 lines · 113 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: 35 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/scheduler/calendar.go 35 introduced LOC · 8 ranges

Open complete file

239 }
240
241 > func parseCronString(c string) (*schedulepb.StructuredCalendarSpec, *schedulepb.IntervalSpec, string, error) { calendar.go
242 > var tzName string
243 > var comment string
244 >
245 > c = strings.TrimSpace(c)
246 >
247 > // split out timezone
248 > if strings.HasPrefix(c, "TZ=") || strings.HasPrefix(c, "CRON_TZ=") {
249 tz, rest, found := strings.Cut(c, " ")
250 if !found {
256
257 // split out comment
258 > c, comment, _ = strings.Cut(c, "#") calendar.go
259 > c = strings.TrimSpace(c)
260 > comment = strings.TrimSpace(comment)
261 >
262 > // handle @every intervals
263 > if strings.HasPrefix(c, "@every") {
264 iv, err := parseCronStringInterval(c)
265 return nil, iv, "", err
267
268 // handle @hourly, etc.
269 > c = handlePredefinedCronStrings(c) calendar.go
270 >
271 > // split fields
272 > cal := schedulepb.CalendarSpec{Comment: comment}
273 > // Use FieldsSeq to avoid building an unbounded slice; we only accept 5–7 fields.
274 > const maxCronFields = 7
275 > var toks [maxCronFields]string
276 > n := 0
277 > for tok := range strings.FieldsSeq(c) {
278 > if n < maxCronFields {
279 > toks[n] = tok
280 > n++
281 > continue
282 }
283 // More than 7 fields → invalid.
284 return nil, nil, "", errors.New("CronString does not have 5-7 fields")
285 }
286 > switch n { calendar.go
287 case 5:
288 cal.Minute, cal.Hour, cal.DayOfMonth, cal.Month, cal.DayOfWeek = toks[0], toks[1], toks[2], toks[3], toks[4]
295 }
296
297 > structured, err := parseCalendarToStructured(&cal) calendar.go
298 > if err != nil {
299 return nil, nil, "", err
300 }
301
302 > return structured, nil, tzName, nil calendar.go
303 }
304
325 }
326
327 > func handlePredefinedCronStrings(c string) string { calendar.go
328 > switch c {
329 case "@yearly", "@annually":
330 return "0 0 1 1 *"
337 case "@hourly":
338 return "0 * * * *"
339 > default: calendar.go
340 > return c
341 }
342 }