history_store.go ×11

Frontier kind: Code frontier

unlabeled · c_5a69bf445d2e

30 tests · 3634 LOC · 162 files · introduces 0 tests · 41 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges41 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
613 ranges3634 lines · 162 files · Browse complete extent
All tests (intent)
30 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: 41 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 41 introduced LOC · 11 ranges

Open complete file

335 ctx context.Context,
336 request *p.InternalDeleteHistoryBranchRequest,
337 > ) error { history_store.go
338 > branchIDBytes, err := primitives.ParseUUID(request.BranchInfo.BranchId)
339 > if err != nil {
340 return err
341 }
342 > treeIDBytes, err := primitives.ParseUUID(request.BranchInfo.TreeId) history_store.go
343 > if err != nil {
344 return err
345 }
346
347 > return m.txExecute(ctx, "DeleteHistoryBranch", func(tx sqlplugin.Tx) error { history_store.go
348 > _, err = tx.DeleteFromHistoryTree(ctx, sqlplugin.HistoryTreeDeleteFilter{
349 > TreeID: treeIDBytes,
350 > BranchID: branchIDBytes,
351 > ShardID: request.ShardID,
352 > })
353 > if err != nil {
354 return err
355 }
356
357 // delete each branch range
358 > for _, br := range request.BranchRanges { history_store.go
359 > branchIDBytes, err := primitives.ParseUUID(br.BranchId)
360 > if err != nil {
361 return err
362 }
363
364 > deleteFilter := sqlplugin.HistoryNodeDeleteFilter{ history_store.go
365 > ShardID: request.ShardID,
366 > TreeID: treeIDBytes,
367 > BranchID: branchIDBytes,
368 > MinNodeID: br.BeginNodeId,
369 > }
370 > _, err = tx.RangeDeleteFromHistoryNode(ctx, deleteFilter)
371 > if err != nil {
372 return err
373 }
374 }
375 > return nil history_store.go
376 })
377 }
449 ctx context.Context,
450 request *p.InternalGetHistoryTreeContainingBranchRequest,
451 > ) (*p.InternalGetHistoryTreeContainingBranchResponse, error) { history_store.go
452 > branch, err := m.ParseHistoryBranchInfo(request.BranchToken)
453 > if err != nil {
454 return nil, err
455 }
456
457 > treeID, err := primitives.ParseUUID(branch.TreeId) history_store.go
458 > if err != nil {
459 return nil, err
460 }
461
462 > rows, err := m.DB.SelectFromHistoryTree(ctx, sqlplugin.HistoryTreeSelectFilter{ history_store.go
463 > TreeID: treeID,
464 > ShardID: request.ShardID,
465 > })
466 > if err == sql.ErrNoRows || (err == nil && len(rows) == 0) {
467 return &p.InternalGetHistoryTreeContainingBranchResponse{}, nil
468 }
469 > treeInfos := make([]*commonpb.DataBlob, 0, len(rows)) history_store.go
470 > for _, row := range rows {
471 > treeInfos = append(treeInfos, p.NewDataBlob(row.Data, row.DataEncoding))
472 > }
473
474 > return &p.InternalGetHistoryTreeContainingBranchResponse{ history_store.go
475 > TreeInfos: treeInfos,
476 > }, nil
477 }