completion.go ×15

Frontier kind: Code frontier

unlabeled · c_a7057b4e3607

13 tests · 33 LOC · 2 files · introduces 0 tests · 30 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges30 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
17 ranges33 lines · 2 files · Browse complete extent
All tests (intent)
13 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.

Introduced files, introduced tests, and structurally relevant concept specializationretryable-http-error · 0 introduced LOCretryable-http-errorinvocable_outbound.go ×1 · 1 introduced LOCinvocable_outbound.go ×1invocable_outbound.go ×2 · 4 introduced LOCinvocable_outbound.go ×2invocable_outbound.go ×2 · 2 introduced LOCinvocable_outbound.go ×2invocable_outbound.go ×2 · 4 introduced LOCinvocable_outbound.go ×2invocable_outbound.go ×4 · 9 introduced LOCinvocable_outbound.go ×4invocable_outbound.go ×2 · 2 introduced LOCinvocable_outbound.go ×2invocable_outbound.go ×1 · 1 introduced LOCinvocable_outbound.go ×1test_engine.go ×4 · 38 introduced LOCtest_engine.go ×4retryable-error · 0 introduced LOCretryable-errornexus_invocation.go ×1 · 1 introduced LOCnexus_invocation.go ×1nexus_invocation.go ×2 · 4 introduced LOCnexus_invocation.go ×2nexus_invocation.go ×2 · 2 introduced LOCnexus_invocation.go ×2nexus_invocation.go ×2 · 7 introduced LOCnexus_invocation.go ×2nexus_invocation.go ×2 · 2 introduced LOCnexus_invocation.go ×2nexus_invocation.go ×4 · 9 introduced LOCnexus_invocation.go ×4nexus_invocation.go ×1 · 1 introduced LOCnexus_invocation.go ×1nexus_invocation.go ×4 · 37 introduced LOCnexus_invocation.go ×4client.go ×4 · 14 introduced LOCclient.go ×4completion.go ×1 · 2 introduced LOCcompletion.go ×1payload_serializer.go ×1 · 3 introduced LOCpayload_serializer.go ×1completion.go ×1 · 3 introduced LOCcompletion.go ×1completion.go ×1 · 7 introduced LOCcompletion.go ×1TestSuccessfulCompletion · 0 introduced LOCTestSuccessfulCompletioncompletion.go ×9 · 19 introduced LOCcompletion.go ×9completion.go ×1 · 2 introduced LOCcompletion.go ×1TestSuccessfulCompletion_CustomSerializer · 0 introduced LOCTestSuccessfulCompletion…completion.go ×5 · 10 introduced LOCcompletion.go ×5completion.go ×1 · 2 introduced LOCcompletion.go ×1completion.go ×1 · 8 introduced LOCcompletion.go ×1completion.go ×2 · 3 introduced LOCcompletion.go ×2completion.go ×2 · 4 introduced LOCcompletion.go ×2completion.go ×7 · 17 introduced LOCcompletion.go ×7completion.go ×3 · 18 introduced LOCcompletion.go ×3completion.go ×2 · 6 introduced LOCcompletion.go ×2completion.go ×1 · 2 introduced LOCcompletion.go ×1completion.go ×1 · 1 introduced LOCcompletion.go ×1api.go ×1 · 1 introduced LOCapi.go ×1api.go ×1 · 2 introduced LOCapi.go ×1TestOperatorServiceMetadata, TestWorkflowServiceMetadata · 0 introduced LOCTestOperatorServiceMetad…go.temporal.io/server/chasm/chasmtest/test_engine.go · 717 LOCchasmtest/test_engine.gogo.temporal.io/server/chasm/lib/callback/component.go · 183 LOCcallback/component.gogo.temporal.io/server/chasm/lib/callback/invocable_outbound.go · 110 LOCcallback/invocable_outbo…go.temporal.io/server/common/nexus/nexusrpc/api.go · 295 LOCnexusrpc/api.gogo.temporal.io/server/common/nexus/nexusrpc/client.go · 502 LOCnexusrpc/client.gogo.temporal.io/server/common/nexus/nexusrpc/completion.go · 327 LOCnexusrpc/completion.gogo.temporal.io/server/common/nexus/payload_serializer.go · 174 LOCnexus/payload_serializer…go.temporal.io/server/components/callbacks/executors.go · 221 LOCcallbacks/executors.gogo.temporal.io/server/components/callbacks/nexus_invocation.go · 111 LOCcallbacks/nexus_invocati…go.temporal.io/server/components/callbacks/tasks.go · 94 LOCcallbacks/tasks.gogo.temporal.io/server/service/history/queues/errors/errors.go · 47 LOCerrors/errors.gonetwork-error-retry · introduced test · go.temporal.io/server/chasm/lib/callback/TestExecuteInvocationTaskNexus_Outcomes/network-error-retrynetwork-error-retrynon-retryable-http-error · introduced test · go.temporal.io/server/chasm/lib/callback/TestExecuteInvocationTaskNexus_Outcomes/non-retryable-http-errornon-retryable-http-errorretryable-http-error · introduced test · go.temporal.io/server/chasm/lib/callback/TestExecuteInvocationTaskNexus_Outcomes/retryable-http-errorretryable-http-errorsuccess · introduced test · go.temporal.io/server/chasm/lib/callback/TestExecuteInvocationTaskNexus_Outcomes/successsuccessTestOperatorServiceMetadata · introduced test · go.temporal.io/server/common/api/TestOperatorServiceMetadataTestOperatorServiceMetad…TestWorkflowServiceMetadata · introduced test · go.temporal.io/server/common/api/TestWorkflowServiceMetadataTestWorkflowServiceMetad…TestBadRequestCompletion · introduced test · go.temporal.io/server/common/nexus/nexusrpc/TestBadRequestCompletionTestBadRequestCompletionTestFailureCompletion · introduced test · go.temporal.io/server/common/nexus/nexusrpc/TestFailureCompletionTestFailureCompletionTestFailureCompletion_CustomFailureConverter · introduced test · go.temporal.io/server/common/nexus/nexusrpc/TestFailureCompletion_CustomFailureConverterTestFailureCompletion_Cu…TestSuccessfulCompletion · introduced test · go.temporal.io/server/common/nexus/nexusrpc/TestSuccessfulCompletionTestSuccessfulCompletionTestSuccessfulCompletion_CustomSerializer · introduced test · go.temporal.io/server/common/nexus/nexusrpc/TestSuccessfulCompletion_CustomSerializerTestSuccessfulCompletion…failed · introduced test · go.temporal.io/server/components/callbacks/TestProcessInvocationTaskNexus_Outcomes/failedfailednon-retryable-error · introduced test · go.temporal.io/server/components/callbacks/TestProcessInvocationTaskNexus_Outcomes/non-retryable-errornon-retryable-errorretryable-error · introduced test · go.temporal.io/server/components/callbacks/TestProcessInvocationTaskNexus_Outcomes/retryable-errorretryable-errorsuccess · introduced test · go.temporal.io/server/components/callbacks/TestProcessInvocationTaskNexus_Outcomes/successsuccessFocused concept · completion.go ×15 · 30 introduced LOCcompletion.go ×15

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: 30 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/nexus/nexusrpc/completion.go 30 introduced LOC · 15 ranges

Open complete file

33 // NewCompletionHTTPClient constructs a [CompletionHTTPClient] from given options for sending Nexus operation completion
34 // callbacks via HTTP.
35 > func NewCompletionHTTPClient(options CompletionHTTPClientOptions) *CompletionHTTPClient { completion.go
36 > if options.HTTPCaller == nil {
37 options.HTTPCaller = http.DefaultClient.Do
38 }
39 > if options.Serializer == nil { completion.go
40 options.Serializer = nexus.DefaultSerializer()
41 }
42 > if options.FailureConverter == nil { completion.go
43 options.FailureConverter = DefaultFailureConverter()
44 }
45 > return &CompletionHTTPClient{ completion.go
46 > baseHTTPClient: baseHTTPClient{
47 > httpCaller: options.HTTPCaller,
48 > serializer: options.Serializer,
49 > failureConverter: options.FailureConverter,
50 > },
51 > }
52 }
53
54 // CompleteOperation sends a completion callback for a Nexus operation to the given URL with the given completion details.
55 > func (c *CompletionHTTPClient) CompleteOperation(ctx context.Context, url string, completion CompleteOperationOptions) error { completion.go
56 > httpReq, err := http.NewRequestWithContext(ctx, "POST", url, nil)
57 > if err != nil {
58 return err
59 }
60 > if err := completion.applyToHTTPRequest(c, httpReq); err != nil { completion.go
61 return err
62 }
63
64 > response, err := c.httpCaller(httpReq) completion.go
65 > if err != nil {
66 return err
67 }
111 // nolint:revive // This method is long but it's more readable to keep the logic in one place since it's all related to
112 // constructing the completion request.
113 > func (c CompleteOperationOptions) applyToHTTPRequest(cc *CompletionHTTPClient, request *http.Request) error { completion.go
114 > if request.Header == nil {
115 request.Header = make(http.Header)
116 }
117
118 // Set the body and operation state based on whether the completion is successful or not.
119 > if c.Error != nil { completion.go
120 failure, err := cc.failureConverter.ErrorToFailure(c.Error)
121 if err != nil {
158 }
159
160 > if c.Header != nil { completion.go
161 addNexusHeaderToHTTPHeader(c.Header, request.Header)
162 }
163 > if c.Header.Get(headerUserAgent) == "" { completion.go
164 > request.Header.Set(headerUserAgent, userAgent)
165 > }
166 > if c.Header.Get(nexus.HeaderOperationToken) == "" && c.OperationToken != "" {
167 request.Header.Set(nexus.HeaderOperationToken, c.OperationToken)
168 }
169 > if c.Header.Get(headerOperationStartTime) == "" && !c.StartTime.IsZero() { completion.go
170 request.Header.Set(headerOperationStartTime, c.StartTime.Format(http.TimeFormat))
171 }
172 > if c.Header.Get(headerOperationCloseTime) == "" && !c.CloseTime.IsZero() { completion.go
173 request.Header.Set(headerOperationCloseTime, marshalTimestamp(c.CloseTime))
174 }
175 > if c.Header.Get(headerLink) == "" { completion.go
176 > if err := addLinksToHTTPHeader(c.Links, request.Header); err != nil {
177 return err
178 }
179 }
180 > return nil completion.go
181 }
182