scheduler.go ×3

Frontier kind: Code frontier

unlabeled · c_a76d251db7a4

145 tests · 5038 LOC · 168 files · introduces 0 tests · 51 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges51 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1136 ranges5038 lines · 168 files · Browse complete extent
All tests (intent)
145 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: 51 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/lib/scheduler/scheduler.go 38 introduced LOC · 3 ranges

Open complete file

121 input *schedulepb.Schedule,
122 patch *schedulepb.SchedulePatch,
123 > ) (*Scheduler, error) { scheduler.go
124 > var zero time.Time
125 >
126 > sched := &Scheduler{
127 > SchedulerState: &schedulerpb.SchedulerState{
128 > Schedule: input,
129 > Info: &schedulepb.ScheduleInfo{
130 > UpdateTime: timestamppb.New(zero),
131 > },
132 > Namespace: namespace,
133 > NamespaceId: namespaceID,
134 > ScheduleId: scheduleID,
135 > ConflictToken: scheduler.InitialConflictToken,
136 > },
137 > cacheConflictToken: scheduler.InitialConflictToken,
138 > Backfillers: make(chasm.Map[string, *Backfiller]),
139 > LastCompletionResult: chasm.NewDataField(ctx, &schedulerpb.LastCompletionResult{}),
140 > EventLog: chasm.NewComponentField(ctx, NewEventLog(ctx)),
141 > }
142 > sched.setNullableFields()
143 > sched.Info.CreateTime = timestamppb.New(ctx.Now(sched))
144 >
145 > invoker := NewInvoker(ctx)
146 > sched.Invoker = chasm.NewComponentField(ctx, invoker)
147 >
148 > generator := NewGenerator(ctx)
149 > sched.Generator = chasm.NewComponentField(ctx, generator)
150 >
151 > // Create backfillers to fulfill initialPatch.
152 > if err := sched.handlePatch(ctx, patch); err != nil {
153 return nil, err
154 }
155 > visibility := chasm.NewVisibility(ctx) scheduler.go
156 > sched.Visibility = chasm.NewComponentField(ctx, visibility)
157 >
158 > return sched, nil
159 }
160
216
217 // handlePatch creates backfillers to fulfill the given patch request.
218 > func (s *Scheduler) handlePatch(ctx chasm.MutableContext, patch *schedulepb.SchedulePatch) error { scheduler.go
219 > if patch == nil {
220 > return nil
221 > }
222
223 // Each TriggerImmediately and BackfillRequest creates exactly one backfiller.
go.temporal.io/server/chasm/lib/scheduler/generator.go 8 introduced LOC · 1 range

Open complete file

27 // NewGenerator returns an initialized Generator component, which should
28 // be parented under a Scheduler root node.
29 > func NewGenerator(ctx chasm.MutableContext) *Generator { generator.go
30 > generator := newGeneratorWithState(ctx, &schedulerpb.GeneratorState{
31 > LastProcessedTime: nil,
32 > })
33 > // Kick off initial generator run as an immediate task.
34 > generator.Generate(ctx)
35 > return generator
36 > }
37
38 func newGeneratorWithState(ctx chasm.MutableContext, state *schedulerpb.GeneratorState) *Generator {
go.temporal.io/server/chasm/lib/scheduler/invoker.go 5 introduced LOC · 1 range

Open complete file

33 // NewInvoker returns an initialized Invoker component, which should
34 // be parented under a Scheduler root component.
35 > func NewInvoker(ctx chasm.MutableContext) *Invoker { invoker.go
36 > return newInvokerWithState(ctx, &schedulerpb.InvokerState{
37 > BufferedStarts: []*schedulespb.BufferedStart{},
38 > })
39 > }
40
41 func newInvokerWithState(ctx chasm.MutableContext, state *schedulerpb.InvokerState) *Invoker {