api.go ×8

Frontier kind: Code frontier

unlabeled · c_68dd90e0cf72

2 tests · 6155 LOC · 232 files · introduces 0 tests · 100 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges100 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1110 ranges6155 lines · 232 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: 100 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/getworkflowexecutionrawhistory/api.go 68 introduced LOC · 8 ranges

Open complete file

39 }
40
41 > req := request.Request api.go
42 > execution := req.Execution
43 > var pageToken *tokenspb.RawHistoryContinuation
44 > var targetVersionHistory *historyspb.VersionHistory
45 > if req.NextPageToken == nil {
46 > response, err := api.GetOrPollWorkflowMutableState(
47 > ctx,
48 > shardContext,
49 > &historyservice.GetMutableStateRequest{
50 > NamespaceId: ns.ID().String(),
51 > Execution: execution,
52 > },
53 > workflowConsistencyChecker,
54 > eventNotifier,
55 > )
56 > if err != nil {
57 return nil, err
58 }
59
60 > targetVersionHistory, err = setRequestDefaultValueAndGetTargetVersionHistory( api.go
61 > request,
62 > response.GetVersionHistories(),
63 > )
64 > if err != nil {
65 return nil, err
66 }
67
68 > pageToken = api.GeneratePaginationToken(request, response.GetVersionHistories()) api.go
69 } else {
70 pageToken, err = api.DeserializeRawHistoryToken(req.NextPageToken)
85 }
86
87 > if err := api.ValidatePaginationToken( api.go
88 > request,
89 > pageToken,
90 > ); err != nil {
91 return nil, err
92 }
93
94 > pageSize := int(req.GetMaximumPageSize()) api.go
95 > shardID := common.WorkflowIDToHistoryShard(
96 > ns.ID().String(),
97 > execution.GetWorkflowId(),
98 > shardContext.GetConfig().NumberOfShards,
99 > )
100 > rawHistoryResponse, err := shardContext.GetExecutionManager().ReadRawHistoryBranch(ctx, &persistence.ReadHistoryBranchRequest{
101 > BranchToken: targetVersionHistory.GetBranchToken(),
102 > // GetWorkflowExecutionRawHistory is inclusive/inclusive.
103 > // ReadRawHistoryBranch is inclusive/exclusive.
104 > MinEventID: pageToken.GetStartEventId(),
105 > MaxEventID: pageToken.GetEndEventId() + 1,
106 > PageSize: pageSize,
107 > NextPageToken: pageToken.PersistenceToken,
108 > ShardID: shardID,
109 > })
110 > if err != nil {
111 if common.IsNotFoundError(err) {
112 // when no events can be returned from DB, DB layer will return
123 }
124
125 > pageToken.PersistenceToken = rawHistoryResponse.NextPageToken api.go
126 > size := rawHistoryResponse.Size
127 > metricsHandler := interceptor.GetMetricsHandlerFromContext(ctx, shardContext.GetLogger()).WithTags(metrics.OperationTag(metrics.HistoryGetWorkflowExecutionRawHistoryScope))
128 > metrics.HistorySize.With(metricsHandler).Record(
129 > int64(size),
130 > metrics.NamespaceTag(ns.Name().String()),
131 > metrics.OperationTag(metrics.AdminGetWorkflowExecutionRawHistoryScope),
132 > )
133 >
134 > // Ensure all raw history is proto3 encoded since data may be stored in other formats during testing.
135 > // In production (proto3 encoding), this returns the input unchanged.
136 > historyBlobs, err := serialization.ReencodeEventBlobsAsProto3(shardContext.GetPayloadSerializer(), rawHistoryResponse.HistoryEventBlobs)
137 > if err != nil {
138 return nil, err
139 }
140
141 > result := api.go
142 > &adminservice.GetWorkflowExecutionRawHistoryResponse{
143 > HistoryBatches: historyBlobs,
144 > VersionHistory: targetVersionHistory,
145 > HistoryNodeIds: rawHistoryResponse.NodeIDs,
146 > }
147 > if len(pageToken.PersistenceToken) == 0 {
148 > result.NextPageToken = nil
149 > } else {
150 result.NextPageToken, err = api.SerializeRawHistoryToken(pageToken)
151 if err != nil {
154 }
155
156 > return &historyservice.GetWorkflowExecutionRawHistoryResponse{ api.go
157 > Response: result,
158 > }, nil
159 }
160
go.temporal.io/server/service/history/api/token.go 28 introduced LOC · 3 ranges

Open complete file

82 request *historyservice.GetWorkflowExecutionRawHistoryRequest,
83 versionHistories *historyspb.VersionHistories,
84 > ) *tokenspb.RawHistoryContinuation { token.go
85 >
86 > req := request.Request
87 > execution := req.Execution
88 > return &tokenspb.RawHistoryContinuation{
89 > NamespaceId: req.GetNamespaceId(),
90 > WorkflowId: execution.GetWorkflowId(),
91 > RunId: execution.GetRunId(),
92 > StartEventId: req.GetStartEventId(),
93 > StartEventVersion: req.GetStartEventVersion(),
94 > EndEventId: req.GetEndEventId(),
95 > EndEventVersion: req.GetEndEventVersion(),
96 > VersionHistories: versionHistories,
97 > PersistenceToken: nil, // this is the initialized value
98 > }
99 > }
100
101 func ValidatePaginationToken(
102 request *historyservice.GetWorkflowExecutionRawHistoryRequest,
103 token *tokenspb.RawHistoryContinuation,
104 > ) error { token.go
105 >
106 > req := request.Request
107 > execution := req.Execution
108 > if req.GetNamespaceId() != token.GetNamespaceId() ||
109 > execution.GetWorkflowId() != token.GetWorkflowId() ||
110 > execution.GetRunId() != token.GetRunId() ||
111 > req.GetStartEventId() != token.GetStartEventId() ||
112 > req.GetStartEventVersion() != token.GetStartEventVersion() ||
113 > req.GetEndEventId() != token.GetEndEventId() ||
114 > req.GetEndEventVersion() != token.GetEndEventVersion() {
115 return consts.ErrInvalidPaginationToken
116 }
117 > return nil token.go
118 }
go.temporal.io/server/api/adminservice/v1/request_response.pb.go 4 introduced LOC · 1 range

Open complete file

1307 }
1308
1309 > func (x *GetWorkflowExecutionRawHistoryRequest) GetNamespaceId() string { request_response.pb.go
1310 > if x != nil {
1311 > return x.NamespaceId
1312 > }
1313 return ""
1314 }