tree.go ×9
Frontier kind: Code frontier
unlabeled · c_dce4203102e6
15 tests · 2357 LOC · 86 files · introduces 0 tests · 43 LOC · 1 file
Introduces — evidence that enters the hierarchy at this concept
Code
9 ranges 43 lines · 1 files
Tests
0 tests
Contains — complete concept membership
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.
Focus concept
Ancestors (broader)
Descendants (narrower)
Introduced files
Introduced tests
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.
JavaScript is disabled; use the native relationship evidence on this page to explore the same evidence.
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: 43 introduced LOC across 9 ranges.
Expand a file to inspect source; the > gutter marks introduced lines.
go.temporal.io/server/chasm/tree.go 43 introduced LOC · 9 ranges
Open complete file
789
}
790
791
>
func ( n * Node ) initSerializedCollectionNode () {
tree.go
792
>
n . serializedNode = & persistencespb . ChasmNode {
793
>
Metadata : & persistencespb . ChasmNodeMetadata {
794
>
InitialVersionedTransition : & persistencespb . VersionedTransition {
795
>
TransitionCount : n . backend . NextTransitionCount (),
796
>
NamespaceFailoverVersion : n . backend . GetCurrentVersion (),
797
>
},
798
>
Attributes : & persistencespb . ChasmNodeMetadata_CollectionAttributes {
799
>
CollectionAttributes : & persistencespb . ChasmCollectionAttributes {},
800
>
},
801
>
},
802
>
}
803
>
}
804
805
func ( n * Node ) setSerializedNode (
977
}
978
979
>
collectionNode := n . children [ field . name ]
tree.go
980
>
if collectionNode == nil {
981
>
collectionNode = newNode ( n . nodeBase , n , field . name )
982
>
collectionNode . initSerializedCollectionNode ()
983
>
collectionNode . setValueState ( valueStateNeedSyncStructure )
984
>
n . children [ field . name ] = collectionNode
985
>
}
986
987
>
mapValT := field . typ . Elem ()
tree.go
988
>
if mapValT . Kind () != reflect . Struct || genericTypePrefix ( mapValT ) != chasmFieldTypePrefix {
989
return softassert . UnexpectedInternalErr (
990
n . logger ,
993
}
994
995
>
collectionItemsToKeep := make ( map [ string ] struct {})
tree.go
996
>
for _ , mapKeyV := range field . val . MapKeys () {
997
>
mapItemV := field . val . MapIndex ( mapKeyV )
998
>
collectionKey , err := n . mapKeyToString ( mapKeyV )
999
>
if err != nil {
1000
return err
1001
}
1002
>
keepItem , updatedMapItemV , err := collectionNode . syncSubField ( mapItemV , collectionKey )
tree.go
1003
>
if err != nil {
1004
return err
1005
}
1006
>
if updatedMapItemV . IsValid () {
tree.go
1007
>
// The only way to update item in the map is to set it back.
1008
>
field . val . SetMapIndex ( mapKeyV , updatedMapItemV )
1009
>
}
1010
>
if keepItem {
1011
>
collectionItemsToKeep [ collectionKey ] = struct {}{}
1012
>
}
1013
}
1014
>
if err := collectionNode . deleteChildren ( collectionItemsToKeep ); err != nil {
tree.go
1015
return err
1016
}
1017
>
collectionNode . setValueState ( min ( valueStateNeedSerialize , collectionNode . valueState ))
tree.go
1018
>
childrenToKeep [ field . name ] = struct {}{}
1019
}
1020
}
1026
}
1027
1028
>
func ( n * Node ) mapKeyToString ( keyV reflect . Value ) ( string , error ) {
tree.go
1029
>
switch keyV . Kind () {
1030
>
case reflect . String :
1031
>
return keyV . String (), nil
1032
case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 :
1033
return strconv . FormatInt ( keyV . Int (), 10 ), nil