operation_statemachine.go ×3

Frontier kind: Code frontier

unlabeled · c_a0f267547208

22 tests · 2443 LOC · 126 files · introduces 0 tests · 23 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
3 ranges23 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
385 ranges2443 lines · 126 files · Browse complete extent
All tests (intent)
22 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: 23 introduced LOC across 3 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/lib/nexusoperation/operation_statemachine.go 23 introduced LOC · 3 ranges

Open complete file

118 },
119 nexusoperationpb.OPERATION_STATUS_STARTED,
120 > func(o *Operation, ctx chasm.MutableContext, event EventStarted) error { operation_statemachine.go
121 > startTime := ctx.Now(o)
122 > if event.StartTime != nil {
123 startTime = *event.StartTime
124 }
125
126 > o.StartedTime = timestamppb.New(startTime) operation_statemachine.go
127 > // Also consider this the completion of an attempt even if the task's saveResult call lost the race with
128 > // the async completion.
129 > o.LastAttemptCompleteTime = o.StartedTime
130 > o.LastAttemptFailure = nil
131 > // Clear the next attempt schedule time when leaving BACKING_OFF state.
132 > // This field is only valid in BACKING_OFF state.
133 > o.NextAttemptScheduleTime = nil
134 >
135 > // Store the operation token for async completion.
136 > o.OperationToken = event.OperationToken
137 >
138 > // Emit schedule-to-start latency
139 > metricsHandler := o.metricsHandler(ctx)
140 > NexusOperationScheduleToStartLatency.With(metricsHandler).Record(startTime.Sub(o.GetScheduledTime().AsTime()))
141 >
142 > // Emit a start-to-close timeout task if configured.
143 > if o.StartToCloseTimeout != nil && o.StartToCloseTimeout.AsDuration() != 0 {
144 deadline := startTime.Add(o.StartToCloseTimeout.AsDuration())
145 ctx.AddTask(o, chasm.TaskAttributes{
150 // If cancellation was already requested, schedule sending the cancellation request now that we have
151 // an operation token.
152 > cancellation, ok := o.Cancellation.TryGet(ctx) operation_statemachine.go
153 > if ok && cancellation.StateMachineState() == nexusoperationpb.CANCELLATION_STATUS_UNSPECIFIED {
154 return TransitionCancellationScheduled.Apply(cancellation, ctx, EventCancellationScheduled{
155 Destination: o.GetEndpoint(),