history_store.go ×11

Frontier kind: Code frontier

unlabeled · c_23de74900dac

304 tests · 3407 LOC · 160 files · introduces 0 tests · 51 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges51 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
554 ranges3407 lines · 160 files · Browse complete extent
All tests (intent)
304 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: 51 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/history_store.go 51 introduced LOC · 11 ranges

Open complete file

157 ctx context.Context,
158 request *p.InternalReadHistoryBranchRequest,
159 > ) (*p.InternalReadHistoryBranchResponse, error) { history_store.go
160 > branch, err := m.ParseHistoryBranchInfo(request.BranchToken)
161 > if err != nil {
162 return nil, err
163 }
164 > branchIDBytes, err := primitives.ParseUUID(request.BranchID) history_store.go
165 > if err != nil {
166 return nil, err
167 }
168 > treeIDBytes, err := primitives.ParseUUID(branch.TreeId) history_store.go
169 > if err != nil {
170 return nil, err
171 }
172
173 > var token *historyNodePaginationToken history_store.go
174 > if len(request.NextPageToken) == 0 {
175 > if request.ReverseOrder {
176 token = &historyNodePaginationToken{LastNodeID: request.MaxNodeID, LastTxnID: MaxTxnID}
177 > } else { history_store.go
178 > token = &historyNodePaginationToken{LastNodeID: request.MinNodeID, LastTxnID: MinTxnID}
179 > }
180 } else {
181 token, err = deserializePageTokenJson[historyNodePaginationToken](request.NextPageToken)
185 }
186
187 > minNodeId, maxNodeId := request.MinNodeID, request.MaxNodeID history_store.go
188 > minTxnId, maxTxnId := MinTxnID, MaxTxnID
189 > if request.ReverseOrder {
190 maxNodeId = token.LastNodeID
191 maxTxnId = token.LastTxnID
192 > } else { history_store.go
193 > minNodeId = token.LastNodeID
194 > minTxnId = token.LastTxnID
195 > }
196
197 > rows, err := m.DB.RangeSelectFromHistoryNode(ctx, sqlplugin.HistoryNodeSelectFilter{ history_store.go
198 > ShardID: request.ShardID,
199 > TreeID: treeIDBytes,
200 > BranchID: branchIDBytes,
201 > MinNodeID: minNodeId,
202 > MinTxnID: minTxnId,
203 > MaxNodeID: maxNodeId,
204 > MaxTxnID: maxTxnId,
205 > PageSize: request.PageSize,
206 > MetadataOnly: request.MetadataOnly,
207 > ReverseOrder: request.ReverseOrder,
208 > })
209 > switch err {
210 > case nil:
211 // noop
212 case sql.ErrNoRows:
216 }
217
218 > nodes := make([]p.InternalHistoryNode, 0, len(rows)) history_store.go
219 > for _, row := range rows {
220 > nodes = append(nodes, p.InternalHistoryNode{
221 > NodeID: row.NodeID,
222 > PrevTransactionID: row.PrevTxnID,
223 > TransactionID: row.TxnID,
224 > Events: p.NewDataBlob(row.Data, row.DataEncoding),
225 > })
226 > }
227
228 > var pagingToken []byte history_store.go
229 > if len(rows) < request.PageSize {
230 > pagingToken = nil
231 > } else {
232 lastRow := rows[len(rows)-1]
233 pagingToken, err = serializePageTokenJson(&historyNodePaginationToken{
240 }
241
242 > return &p.InternalReadHistoryBranchResponse{ history_store.go
243 > Nodes: nodes,
244 > NextPageToken: pagingToken,
245 > }, nil
246 }
247