tree.go ×9

Frontier kind: Code frontier

unlabeled · c_e9dba7ccaf59

6 tests · 2665 LOC · 95 files · introduces 0 tests · 47 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges47 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
493 ranges2665 lines · 95 files · Browse complete extent
All tests (intent)
6 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: 47 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/tree.go 42 introduced LOC · 9 ranges

Open complete file

770 },
771 }
772 > case fieldTypePointer, fieldTypeDeferredPointer: tree.go
773 > // A deferred pointer will be resolved to a regular pointer before persistence.
774 > n.serializedNode = &persistencespb.ChasmNode{
775 > Metadata: &persistencespb.ChasmNodeMetadata{
776 > InitialVersionedTransition: &persistencespb.VersionedTransition{
777 > TransitionCount: n.backend.NextTransitionCount(),
778 > NamespaceFailoverVersion: n.backend.GetCurrentVersion(),
779 > },
780 > Attributes: &persistencespb.ChasmNodeMetadata_PointerAttributes{
781 > PointerAttributes: &persistencespb.ChasmPointerAttributes{},
782 > },
783 > },
784 > }
785 case fieldTypeUnspecified:
786 softassert.Fail(n.logger,
1183 return
1184 }
1185 > case fieldTypeDeferredPointer: tree.go
1186 > n.needsPointerResolution = true
1187 default:
1188 err = softassert.UnexpectedInternalErr(
1633 func (n *Node) componentNodePath(
1634 component Component,
1635 > ) ([]string, error) { tree.go
1636 > // It's unnecessary to deserialize entire tree as calling this method means
1637 > // caller already have the deserialized value.
1638 >
1639 > refNode, ok := n.valueToNode[component]
1640 > if !ok || !refNode.isComponent() {
1641 return nil, errComponentNotFound
1642 }
1704
1705 if n.needsPointerResolution {
1706 > if err := n.resolveDeferredPointers(); err != nil { tree.go
1707 return NodesMutation{}, err
1708 }
2381 // Returns error if any deferred pointer cannot be resolved, as deferred pointers
2382 // cannot be persisted after transaction close.
2383 > func (n *Node) resolveDeferredPointers() error { tree.go
2384 > for _, node := range n.andAllChildren() {
2385 > if node.value == nil || !node.isComponent() {
2386 continue
2387 }
2388
2389 > for field := range node.valueFields() { tree.go
2390 > if field.err != nil {
2391 return field.err
2392 }
2393
2394 > if field.kind != fieldKindSubField { tree.go
2395 > continue
2396 }
2397
2398 > internalV := field.val.FieldByName(internalFieldName) tree.go
2399 > internal, _ := internalV.Interface().(fieldInternal) //nolint:revive
2400 >
2401 > if internal.fieldType() == fieldTypeDeferredPointer && internal.value() != nil {
2402 > // Must resolve the deferred pointer or fail the transaction.
2403 > var resolvedPath []string
2404 > var err error
2405 >
2406 > switch value := internal.value().(type) {
2407 > case Component:
2408 > resolvedPath, err = n.componentNodePath(value)
2409 > if err == nil {
2410 targetNode := n.valueToNode[value]
2411 if !targetNode.isAncestorOf(node) {
2424 fmt.Errorf("%T", value))
2425 }
2426 > if err != nil { tree.go
2427 return softassert.UnexpectedInternalErr(
2428 n.logger,
go.temporal.io/server/chasm/field.go 5 introduced LOC · 1 range

Open complete file

59 ctx MutableContext,
60 c C,
61 > ) Field[C] { field.go
62 > return Field[C]{
63 > Internal: newFieldInternalWithValue(fieldTypeDeferredPointer, c),
64 > }
65 > }
66
67 // DataPointerTo returns a CHASM field populated with a pointer to the given