scheduler.go ×9

Frontier kind: Code frontier

unlabeled · c_7e99a1d88009

2 tests · 5206 LOC · 169 files · introduces 0 tests · 54 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges54 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1174 ranges5206 lines · 169 files · Browse complete extent
All tests (intent)
2 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.

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

go.temporal.io/server/chasm/lib/scheduler/scheduler.go 46 introduced LOC · 9 ranges

Open complete file

675 return nil, ErrSentinel
676 }
677 > if s.Closed { scheduler.go
678 return nil, ErrClosed
679 }
680
681 > visibility := s.Visibility.Get(ctx) scheduler.go
682 > // CustomMemo returns a shallow copy, so deleting a key here is safe.
683 > memo := visibility.CustomMemo(ctx)
684 > delete(memo, visibilityMemoFieldInfo) // ScheduleInfo is returned separately via Info below.
685 >
686 > // Describe must not mutate the cached component: default on a clone, not s.Schedule.
687 > schedule := common.CloneProto(s.Schedule)
688 > if schedule.GetPolicies().GetOverlapPolicy() == enumspb.SCHEDULE_OVERLAP_POLICY_UNSPECIFIED {
689 > schedule.Policies.OverlapPolicy = s.overlapPolicy()
690 > }
691 > if !schedule.GetPolicies().GetCatchupWindow().IsValid() {
692 // TODO - this should be set from Tweakables.DefaultCatchupWindow.
693 schedule.Policies.CatchupWindow = durationpb.New(365 * 24 * time.Hour)
694 }
695 > cleanSpec(schedule.Spec) scheduler.go
696 >
697 > generator := s.Generator.Get(ctx)
698 > futureActionTimes := generator.GetFutureActionTimes()
699 > if futureActionTimes == nil {
700 // Populated asynchronously by the GeneratorTask; may be nil before it first runs.
701 // Compute here without storing back, since Describe must stay read-only.
707
708 // Populate computed views from Invoker's BufferedStarts.
709 > invoker := s.Invoker.Get(ctx) scheduler.go
710 > info := common.CloneProto(s.Info)
711 > info.RunningWorkflows = invoker.runningWorkflowExecutions()
712 > info.RecentActions = invoker.recentActions()
713 > info.FutureActionTimes = futureActionTimes
714 > // BufferedStarts holds waiting, running, and recently-completed entries; only the
715 > // waiting portion (those not yet surfaced via RecentActions) counts as buffered.
716 > info.BufferSize = int64(len(invoker.GetBufferedStarts()) - len(info.RecentActions))
717 >
718 > executionInfo := ctx.ExecutionInfo()
719 > info.StateSizeBytes = int64(executionInfo.ApproximateStateSize)
720 >
721 > return &schedulerpb.DescribeScheduleResponse{
722 > FrontendResponse: &workflowservice.DescribeScheduleResponse{
723 > Schedule: schedule,
724 > Info: info,
725 > ConflictToken: s.generateConflictToken(),
726 > Memo: &commonpb.Memo{Fields: memo},
727 > SearchAttributes: &commonpb.SearchAttributes{IndexedFields: visibility.CustomSearchAttributes(ctx)},
728 > },
729 > }, nil
730 }
731
732 // cleanSpec sets default values in ranges for the DescribeSchedule response.
733 > func cleanSpec(spec *schedulepb.ScheduleSpec) { scheduler.go
734 > cleanRanges := func(ranges []*schedulepb.Range) {
735 for _, r := range ranges {
736 if r.End < r.Start {
742 }
743 }
744 > cleanCal := func(structured *schedulepb.StructuredCalendarSpec) { scheduler.go
745 cleanRanges(structured.Second)
746 cleanRanges(structured.Minute)
751 cleanRanges(structured.DayOfWeek)
752 }
753 > for _, structured := range spec.StructuredCalendar { scheduler.go
754 cleanCal(structured)
755 }
756 > for _, structured := range spec.ExcludeStructuredCalendar { scheduler.go
757 cleanCal(structured)
758 }
960 }
961
962 > func (s *Scheduler) generateConflictToken() []byte { scheduler.go
963 > return serializeConflictToken(s.ConflictToken)
964 > }
965
966 func (s *Scheduler) validateConflictToken(token []byte) bool {
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/message.pb.go 4 introduced LOC · 1 range

Open complete file

263 }
264
265 > func (x *GeneratorState) GetFutureActionTimes() []*timestamppb.Timestamp { message.pb.go
266 > if x != nil {
267 > return x.FutureActionTimes
268 > }
269 return nil
270 }
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/request_response.pb.go 4 introduced LOC · 1 range

Open complete file

502 }
503
504 > func (x *DescribeScheduleResponse) GetFrontendResponse() *v1.DescribeScheduleResponse { request_response.pb.go
505 > if x != nil {
506 > return x.FrontendResponse
507 > }
508 return nil
509 }