go.temporal.io/server/chasm/field_internal.go

56 LOC · 34 covered · 22 uncovered · 9 ranges · 994 concepts · 9 introducers · 478 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 package chasm
2
3 type fieldInternal struct {
4 // These 2 fields are used when node is not set yet (i.e., node==nil).
5 // Don't access them directly outside of this file. Use corresponding getters instead.
6 ft fieldType
7 v any // Component | Data | Pointer
8
9 // Pointer to the corresponding tree node. Can be nil for the just created fields.
10 node *Node
11
12 // Detached field option. When true, the node created from this field
13 // will be detached regardless of the component type's registration.
14 detached bool
15 }
16
17 > func newFieldInternalWithValue(ft fieldType, v any) fieldInternal { field_internal.go ×1
18 > return fieldInternal{
19 > ft: ft,
20 > v: v,
21 > }
22 > }
23
24 > func newFieldInternalWithNode(node *Node) fieldInternal { field_internal.go ×1
25 > return fieldInternal{
26 > node: node,
27 > }
28 > }
29
30 > func (fi fieldInternal) isEmpty() bool { field_internal.go ×1
31 > return fi.v == nil && fi.node == nil
32 > }
33
34 > func (fi fieldInternal) value() any { field_internal.go ×1
35 > // Deferred pointers are special-cased, since their serialized nodes are
36 > // initialized as regular persistable pointers.
37 > //
38 > // Deferred pointers may have a non-nil node after syncSubComponents, but before
39 > // resolution.
40 > if fi.node == nil || fi.ft == fieldTypeDeferredPointer {
41 > return fi.v field_internal.go ×1
42 > }
43 > return fi.node.value field_internal.go ×1
44 }
45
46 > func (fi fieldInternal) fieldType() fieldType { field_internal.go ×1
47 > // Deferred pointers are special-cased, since their serialized nodes are
48 > // initialized as regular persistable pointers.
49 > //
50 > // Deferred pointers may have a non-nil node after syncSubComponents, but before
51 > // resolution.
52 > if fi.node == nil || fi.ft == fieldTypeDeferredPointer {
53 > return fi.ft tree.go ×2
54 > }
55 > return fi.node.fieldType() field_internal.go ×1
56 }