task_util.go ×4

Frontier kind: Code frontier

unlabeled · c_18e4690b21a9

167 tests · 3104 LOC · 156 files · introduces 0 tests · 34 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
7 ranges34 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
483 ranges3104 lines · 156 files · Browse complete extent
All tests (intent)
167 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: 34 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/sql/task_util.go 20 introduced LOC · 4 ranges

Open complete file

46 taskType enumspb.TaskQueueType,
47 subqueue int,
48 > ) ([]byte, uint32) { task_util.go
49 > id := taskQueueId(namespaceID, taskQueueName, taskType, subqueue)
50 > return id, farm.Fingerprint32(id)
51 > }
52
53 func taskQueueId(
56 taskType enumspb.TaskQueueType,
57 subqueue int,
58 > ) []byte { task_util.go
59 > idBytes := make([]byte, 0, 16+len(taskQueueName)+1+binary.MaxVarintLen16)
60 > idBytes = append(idBytes, namespaceID...)
61 > idBytes = append(idBytes, []byte(taskQueueName)...)
62 >
63 > // To ensure that different names+types+subqueue ids never collide, we mark types
64 > // containing subqueues with an extra high bit, and then append the subqueue id. There are
65 > // only a few task queue types (currently 3), so the high bits are free. (If we have more
66 > // fields to append, we can use the next lower bit to mark the presence of that one, etc..)
67 > const hasSubqueue = 0x80
68 >
69 > if subqueue > 0 {
70 idBytes = append(idBytes, uint8(taskType)|hasSubqueue)
71 idBytes = binary.AppendUvarint(idBytes, uint64(subqueue))
72 > } else { task_util.go
73 > idBytes = append(idBytes, uint8(taskType))
74 > }
75
76 > return idBytes task_util.go
77 }
go.temporal.io/server/common/persistence/sql/task_queues.go 14 introduced LOC · 3 ranges

Open complete file

23 ctx context.Context,
24 request *persistence.InternalCreateTaskQueueRequest,
25 > ) error { task_queues.go
26 > nidBytes, err := primitives.ParseUUID(request.NamespaceID)
27 > if err != nil {
28 return serviceerror.NewInternal(err.Error())
29 }
30 > tqId, tqHash := taskQueueIdAndHash(nidBytes, request.TaskQueue, request.TaskType, persistence.SubqueueZero) task_queues.go
31 >
32 > row := sqlplugin.TaskQueuesRow{
33 > RangeHash: tqHash,
34 > TaskQueueID: tqId,
35 > RangeID: request.RangeID,
36 > Data: request.TaskQueueInfo.Data,
37 > DataEncoding: request.TaskQueueInfo.EncodingType.String(),
38 > }
39 > if _, err := m.DB.InsertIntoTaskQueues(ctx, &row, m.version); err != nil {
40 if m.DB.IsDupEntryError(err) {
41 return &persistence.ConditionFailedError{Msg: err.Error()}