context.go ×9

Frontier kind: Code frontier

unlabeled · c_619647a1e085

12 tests · 4046 LOC · 185 files · introduces 0 tests · 32 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges32 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
595 ranges4046 lines · 185 files · Browse complete extent
All tests (intent)
12 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: 32 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/context.go 32 introduced LOC · 9 ranges

Open complete file

157 // task. When none is started it returns the zero-value identity, which can never equal a
158 // real buffer identity
159 > func (c *ContextImpl) startedWorkflowTaskIdentity() workflowTaskIdentity { context.go
160 > if c.MutableState == nil {
161 return workflowTaskIdentity{}
162 }
163 > startedTask := c.MutableState.GetStartedWorkflowTask() context.go
164 > if startedTask == nil {
165 return workflowTaskIdentity{}
166 }
167 > return workflowTaskIdentity{ context.go
168 > schedID: startedTask.ScheduledEventID,
169 > attempt: startedTask.Attempt,
170 > version: startedTask.Version,
171 > }
172 }
173
202 // The request's token supplies schedID/attempt; the version comes from the started
203 // workflow task
204 > identity := workflowTaskIdentity{schedID: schedID, attempt: attempt, version: c.startedWorkflowTaskIdentity().version} context.go
205 > // a buffer for a different workflow task is stale, clear it
206 > if c.taskCompletionBuffer != nil && c.taskCompletionBuffer.identity != identity {
207 c.clearTaskCompletionBuffer()
208 }
209 > if c.taskCompletionBuffer == nil { context.go
210 > c.taskCompletionBuffer = &TaskCompletionBuffer{
211 > pages: make(map[int32][]*commandpb.Command),
212 > identity: identity,
213 > }
214 > }
215 // Keep existing page if it is already buffered
216 > if _, ok := c.taskCompletionBuffer.pages[request.GetPageNumber()]; ok { context.go
217 return nil
218 }
219
220 > pageBytes := taskCompletionPageBytes(request.Commands) context.go
221 >
222 > // Apply per-workflow task limit
223 > nsName := c.MutableState.GetNamespaceEntry().Name().String()
224 > perWorkflowLimitBytes := int64(c.config.WorkflowTaskCompletionBufferSizeLimit(nsName))
225 > if perWorkflowLimitBytes > 0 && c.taskCompletionBuffer.totalSize+pageBytes > perWorkflowLimitBytes {
226 c.clearTaskCompletionBuffer()
227 return ErrTaskCompletionBufferSizeExceeded
234
235 // taskCompletionPageBytes is the wire size of a page's commands.
236 > func taskCompletionPageBytes(cmds []*commandpb.Command) int64 { context.go
237 > var total int64
238 > for _, cmd := range cmds {
239 > total += int64(proto.Size(cmd))
240 > }
241 > return total
242 }
243
262 "intermediate workflow task page must carry at least one command")
263 }
264 > return nil context.go
265 }
266