history_store.go ×11

Frontier kind: Code frontier

unlabeled · c_175c386212e7

49 tests · 3634 LOC · 173 files · introduces 0 tests · 51 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
14 ranges51 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
627 ranges3634 lines · 173 files · Browse complete extent
All tests (intent)
49 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.

2 files ranked by introduced lines: 51 introduced LOC across 14 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/cassandra/history_store.go 46 introduced LOC · 11 ranges

Open complete file

142 ctx context.Context,
143 request *p.InternalReadHistoryBranchRequest,
144 > ) (*p.InternalReadHistoryBranchResponse, error) { history_store.go
145 > branch, err := h.ParseHistoryBranchInfo(request.BranchToken)
146 > if err != nil {
147 return nil, err
148 }
149
150 > treeID, err := primitives.ValidateUUID(branch.TreeId) history_store.go
151 > if err != nil {
152 return nil, serviceerror.NewInternalf("ReadHistoryBranch - Gocql TreeId UUID cast failed. Error: %v", err)
153 }
154
155 > branchID, err := primitives.ValidateUUID(request.BranchID) history_store.go
156 > if err != nil {
157 return nil, serviceerror.NewInternalf("ReadHistoryBranch - Gocql BranchId UUID cast failed. Error: %v", err)
158 }
159
160 > var queryString string history_store.go
161 > if request.MetadataOnly {
162 queryString = v2templateReadHistoryNodeMetadata
163 > } else if request.ReverseOrder { history_store.go
164 queryString = v2templateReadHistoryNodeReverse
165 > } else { history_store.go
166 > queryString = v2templateReadHistoryNode
167 > }
168
169 > query := h.Session.Query(queryString, treeID, branchID, request.MinNodeID, request.MaxNodeID).WithContext(ctx) history_store.go
170 >
171 > iter := query.PageSize(request.PageSize).PageState(request.NextPageToken).Iter()
172 > var pagingToken []byte
173 > if len(iter.PageState()) > 0 {
174 pagingToken = iter.PageState()
175 }
176
177 > nodes := make([]p.InternalHistoryNode, 0, request.PageSize) history_store.go
178 > message := make(map[string]any)
179 > for iter.MapScan(message) {
180 > nodes = append(nodes, convertHistoryNode(message))
181 > message = make(map[string]any)
182 > }
183
184 > if err := iter.Close(); err != nil { history_store.go
185 return nil, gocql.ConvertError("ReadHistoryBranch", err)
186 }
187
188 > return &p.InternalReadHistoryBranchResponse{ history_store.go
189 > Nodes: nodes,
190 > NextPageToken: pagingToken,
191 > }, nil
192 }
193
403 func convertHistoryNode(
404 message map[string]any,
405 > ) p.InternalHistoryNode { history_store.go
406 > nodeID := message["node_id"].(int64)
407 > prevTxnID := message["prev_txn_id"].(int64)
408 > txnID := message["txn_id"].(int64)
409 >
410 > var data []byte
411 > var dataEncoding string
412 > if _, ok := message["data"]; ok {
413 > data = message["data"].([]byte)
414 > dataEncoding = message["data_encoding"].(string)
415 > }
416 > return p.InternalHistoryNode{
417 > NodeID: nodeID,
418 > PrevTransactionID: prevTxnID,
419 > TransactionID: txnID,
420 > Events: p.NewDataBlob(data, dataEncoding),
421 > }
422 }
423
go.temporal.io/server/common/primitives/uuid.go 5 introduced LOC · 3 ranges

Open complete file

55 // - error if input is malformed
56 // - input if input can be parsed and is valid
57 > func ValidateUUID(s string) (string, error) { uuid.go
58 > if s == "" {
59 return "", nil
60 }
61 > _, err := guuid.Parse(s) uuid.go
62 > if err != nil {
63 return "", err
64 }
65
66 > return s, nil uuid.go
67 }
68