tree.go ×15

Frontier kind: Joint frontier

unlabeled · c_6afb8fa16fc9

1 test · 2924 LOC · 99 files · introduces 1 test · 49 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges49 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
611 ranges2924 lines · 99 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 49 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/chasm/tree.go 49 introduced LOC · 15 ranges

Open complete file

3150 referenceTime time.Time,
3151 task *persistencespb.ChasmComponentAttributes_Task,
3152 > ) bool { tree.go
3153 > if task.ScheduledTime == nil {
3154 return false
3155 }
3156
3157 > scheduledTime := task.ScheduledTime.AsTime().Truncate(common.ScheduledTaskMinPrecision) tree.go
3158 > referenceTime = referenceTime.Truncate(common.ScheduledTaskMinPrecision)
3159 >
3160 > return !scheduledTime.After(referenceTime)
3161 }
3162
3168 referenceTime time.Time,
3169 callback func(handler NodePureTask, taskAttributes TaskAttributes, taskInstance any) (bool, error),
3170 > ) error { tree.go
3171 > chasmContext := NewContext(context.Background(), n)
3172 >
3173 > // Because tree structure may change during the processing,
3174 > // we first gather all nodes that have pure tasks that are ready for execution.
3175 > var componentToProcess []any
3176 > for _, node := range n.andAllChildren() {
3177 > // Skip nodes that aren't serialized yet.
3178 > if node.serializedNode == nil || node.serializedNode.Metadata == nil {
3179 continue
3180 }
3181
3182 > componentAttr := node.serializedNode.Metadata.GetComponentAttributes() tree.go
3183 > // Skip nodes that aren't components.
3184 > if componentAttr == nil {
3185 continue
3186 }
3187
3188 > if len(componentAttr.PureTasks) == 0 { tree.go
3189 continue
3190 }
3191
3192 > if !isComponentTaskExpired(referenceTime, componentAttr.PureTasks[0]) { tree.go
3193 > continue
3194 }
3195
3196 // This component node as a pure task that's ready to execute
3197 > err := node.prepareComponentValue(chasmContext) tree.go
3198 > if err != nil {
3199 return err
3200 }
3201
3202 > componentToProcess = append(componentToProcess, node.value) tree.go
3203 }
3204
3205 > for _, component := range componentToProcess { tree.go
3206 >
3207 > // Node get deleted when previous pure tasks of other components are executed.
3208 > node, ok := n.valueToNode[component]
3209 > if !ok {
3210 > continue
3211 }
3212
3213 > componentAttr := node.serializedNode.Metadata.GetComponentAttributes() tree.go
3214 >
3215 > for _, task := range componentAttr.GetPureTasks() {
3216 > if !isComponentTaskExpired(referenceTime, task) {
3217 break
3218 }
3220 // Node get deleted when previous pure tasks of the same component are executed.
3221 // e.g. via a (parent) pointer.
3222 > _, ok := n.valueToNode[component] tree.go
3223 > if !ok {
3224 > break
3225 }
3226
3227 > taskInstance, err := node.deserializeComponentTask(task) tree.go
3228 > if err != nil {
3229 return err
3230 }
3231
3232 > taskAttributes := TaskAttributes{ tree.go
3233 > ScheduledTime: task.ScheduledTime.AsTime(),
3234 > Destination: task.Destination,
3235 > }
3236 >
3237 > executed, err := callback(node, taskAttributes, taskInstance)
3238 > if err != nil {
3239 return err
3240 }
3241
3242 > if executed { tree.go
3243 > if err := n.syncSubComponents(); err != nil {
3244 return err
3245 }
3254 }
3255
3256 > return nil tree.go
3257 }
3258