util.go ×17

Frontier kind: Code frontier

unlabeled · c_55516f77c128

309 tests · 3624 LOC · 160 files · introduces 0 tests · 170 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
34 ranges170 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
638 ranges3624 lines · 160 files · Browse complete extent
All tests (intent)
309 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.

3 files ranked by introduced lines: 170 introduced LOC across 34 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/tests/util.go 136 introduced LOC · 17 ranges

Open complete file

46 dbRecordVersion int64,
47 branchToken []byte,
48 > ) (*p.WorkflowSnapshot, []*p.WorkflowEvents) { util.go
49 > snapshot := &p.WorkflowSnapshot{
50 > ExecutionInfo: RandomExecutionInfo(namespaceID, workflowID, eventID, lastWriteVersion, branchToken),
51 > ExecutionState: RandomExecutionState(runID, state, status, lastWriteVersion),
52 >
53 > NextEventID: eventID + 1, // NOTE: RandomSnapshot generates a single history event, hence NextEventID is plus 1
54 >
55 > ActivityInfos: RandomInt64ActivityInfoMap(),
56 > TimerInfos: RandomStringTimerInfoMap(),
57 > ChildExecutionInfos: RandomInt64ChildExecutionInfoMap(),
58 > RequestCancelInfos: RandomInt64RequestCancelInfoMap(),
59 > SignalInfos: RandomInt64SignalInfoMap(),
60 > SignalRequestedIDs: map[string]struct{}{uuid.New().String(): {}},
61 > ChasmNodes: RandomChasmNodeMap(),
62 >
63 > Tasks: map[tasks.Category][]tasks.Task{
64 > tasks.CategoryTransfer: {},
65 > tasks.CategoryTimer: {},
66 > tasks.CategoryReplication: {},
67 > tasks.CategoryVisibility: {},
68 > },
69 >
70 > Condition: rand.Int63(),
71 > DBRecordVersion: dbRecordVersion,
72 > }
73 >
74 > if branchToken == nil {
75 return snapshot, nil
76 }
158 }
159
160 > func RandomChasmNodeMap() map[string]*persistencespb.ChasmNode { util.go
161 > return map[string]*persistencespb.ChasmNode{
162 > uuid.New().String(): RandomChasmNode(),
163 > }
164 > }
165
166 > func RandomChasmNode() *persistencespb.ChasmNode { util.go
167 > // Some arbitrary random data to ensure the chasm node's attributes are preserved.
168 > var blobInfo persistencespb.WorkflowExecutionInfo
169 > _ = fakedata.FakeStruct(&blobInfo)
170 > blob, _ := serialization.Encode(&blobInfo)
171 >
172 > var versionedTransition persistencespb.VersionedTransition
173 > _ = fakedata.FakeStruct(&versionedTransition)
174 >
175 > return &persistencespb.ChasmNode{
176 > Metadata: &persistencespb.ChasmNodeMetadata{
177 > InitialVersionedTransition: &versionedTransition,
178 > LastUpdateVersionedTransition: &versionedTransition,
179 > Attributes: &persistencespb.ChasmNodeMetadata_DataAttributes{},
180 > },
181 > Data: blob,
182 > }
183 > }
184
185 func RandomExecutionInfo(
189 lastWriteVersion int64,
190 branchToken []byte,
191 > ) *persistencespb.WorkflowExecutionInfo { util.go
192 > var executionInfo persistencespb.WorkflowExecutionInfo
193 > _ = fakedata.FakeStruct(&executionInfo)
194 > executionInfo.NamespaceId = namespaceID
195 > executionInfo.WorkflowId = workflowID
196 >
197 > if branchToken != nil {
198 executionInfo.VersionHistories = RandomVersionHistory(eventID, lastWriteVersion, branchToken)
199 > } else { util.go
200 executionInfo.VersionHistories = versionhistory.NewVersionHistories(&historyspb.VersionHistory{})
201 }
202 > executionInfo.TransitionHistory = []*persistencespb.VersionedTransition{{ util.go
203 > NamespaceFailoverVersion: lastWriteVersion,
204 > TransitionCount: rand.Int63(),
205 > }}
206 > return &executionInfo
207 }
208
212 status enumspb.WorkflowExecutionStatus,
213 lastWriteVersion int64,
214 > ) *persistencespb.WorkflowExecutionState { util.go
215 > createRequestID := uuid.NewString()
216 > return &persistencespb.WorkflowExecutionState{
217 > CreateRequestId: createRequestID,
218 > RunId: runID,
219 > State: state,
220 > Status: status,
221 > LastUpdateVersionedTransition: &persistencespb.VersionedTransition{
222 > NamespaceFailoverVersion: lastWriteVersion,
223 > TransitionCount: rand.Int63(),
224 > },
225 > RequestIds: map[string]*persistencespb.RequestIDInfo{
226 > createRequestID: {
227 > EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED,
228 > EventId: common.FirstEventID,
229 > },
230 > uuid.NewString(): {
231 > EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_OPTIONS_UPDATED,
232 > EventId: common.BufferedEventID,
233 > },
234 > },
235 > }
236 > }
237
238 > func RandomInt64ActivityInfoMap() map[int64]*persistencespb.ActivityInfo { util.go
239 > return map[int64]*persistencespb.ActivityInfo{
240 > rand.Int63(): RandomActivityInfo(),
241 > }
242 > }
243
244 > func RandomStringTimerInfoMap() map[string]*persistencespb.TimerInfo { util.go
245 > return map[string]*persistencespb.TimerInfo{
246 > uuid.New().String(): RandomTimerInfo(),
247 > }
248 > }
249
250 > func RandomInt64ChildExecutionInfoMap() map[int64]*persistencespb.ChildExecutionInfo { util.go
251 > return map[int64]*persistencespb.ChildExecutionInfo{
252 > rand.Int63(): RandomChildExecutionInfo(),
253 > }
254 > }
255
256 > func RandomInt64RequestCancelInfoMap() map[int64]*persistencespb.RequestCancelInfo { util.go
257 > return map[int64]*persistencespb.RequestCancelInfo{
258 > rand.Int63(): RandomRequestCancelInfo(),
259 > }
260 > }
261
262 > func RandomInt64SignalInfoMap() map[int64]*persistencespb.SignalInfo { util.go
263 > return map[int64]*persistencespb.SignalInfo{
264 > rand.Int63(): RandomSignalInfo(),
265 > }
266 > }
267
268 > func RandomActivityInfo() *persistencespb.ActivityInfo { util.go
269 > var activityInfo persistencespb.ActivityInfo
270 > _ = fakedata.FakeStruct(&activityInfo)
271 > return &activityInfo
272 > }
273
274 > func RandomTimerInfo() *persistencespb.TimerInfo { util.go
275 > var timerInfo persistencespb.TimerInfo
276 > _ = fakedata.FakeStruct(&timerInfo)
277 > return &timerInfo
278 > }
279
280 > func RandomChildExecutionInfo() *persistencespb.ChildExecutionInfo { util.go
281 > var childExecutionInfo persistencespb.ChildExecutionInfo
282 > _ = fakedata.FakeStruct(&childExecutionInfo)
283 > return &childExecutionInfo
284 > }
285
286 > func RandomRequestCancelInfo() *persistencespb.RequestCancelInfo { util.go
287 > var requestCancelInfo persistencespb.RequestCancelInfo
288 > _ = fakedata.FakeStruct(&requestCancelInfo)
289 > return &requestCancelInfo
290 > }
291
292 > func RandomSignalInfo() *persistencespb.SignalInfo { util.go
293 > var signalInfo persistencespb.SignalInfo
294 > _ = fakedata.FakeStruct(&signalInfo)
295 > return &signalInfo
296 > }
297
298 func RandomHistoryEvent(eventID int64, version int64) *historypb.HistoryEvent {
go.temporal.io/server/common/persistence/execution_manager.go 22 introduced LOC · 13 ranges

Open complete file

795
796 for key, info := range input.ActivityInfos {
797 > blob, err := m.serializer.ActivityInfoToBlob(info) execution_manager.go
798 > if err != nil {
799 return nil, err
800 }
801 > result.ActivityInfos[key] = blob execution_manager.go
802 }
803 for key, info := range input.TimerInfos {
804 > blob, err := m.serializer.TimerInfoToBlob(info) execution_manager.go
805 > if err != nil {
806 return nil, err
807 }
808 > result.TimerInfos[key] = blob execution_manager.go
809 }
810 for key, info := range input.ChildExecutionInfos {
811 > blob, err := m.serializer.ChildExecutionInfoToBlob(info) execution_manager.go
812 > if err != nil {
813 return nil, err
814 }
815 > result.ChildExecutionInfos[key] = blob execution_manager.go
816 }
817 for key, info := range input.RequestCancelInfos {
818 > blob, err := m.serializer.RequestCancelInfoToBlob(info) execution_manager.go
819 > if err != nil {
820 return nil, err
821 }
822 > result.RequestCancelInfos[key] = blob execution_manager.go
823 }
824 for key, info := range input.SignalInfos {
825 > blob, err := m.serializer.SignalInfoToBlob(info) execution_manager.go
826 > if err != nil {
827 return nil, err
828 }
829 > result.SignalInfos[key] = blob execution_manager.go
830 }
831 for key := range input.SignalRequestedIDs {
832 > result.SignalRequestedIDs[key] = struct{}{} execution_manager.go
833 > }
834 nodeMap, err := m.makeInternalChasmNodeMap(input.ChasmNodes)
835 if err != nil {
1363
1364 for path, node := range nodes {
1365 > var internal InternalChasmNode execution_manager.go
1366 >
1367 > // If we're running on Cassandra, set a single blob since that's how we store it.
1368 > if isCassandra {
1369 blob, err := m.serializer.ChasmNodeToBlob(node)
1370 if err != nil {
go.temporal.io/server/common/persistence/serialization/serializer.go 12 introduced LOC · 4 ranges

Open complete file

481 }
482
483 > func (t *serializerImpl) ChildExecutionInfoToBlob(info *persistencespb.ChildExecutionInfo) (*commonpb.DataBlob, error) { serializer.go
484 > return encodeBlob(info, t.encodingType)
485 > }
486
487 func (t *serializerImpl) ChildExecutionInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ChildExecutionInfo, error) {
490 }
491
492 > func (t *serializerImpl) SignalInfoToBlob(info *persistencespb.SignalInfo) (*commonpb.DataBlob, error) { serializer.go
493 > return encodeBlob(info, t.encodingType)
494 > }
495
496 func (t *serializerImpl) SignalInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.SignalInfo, error) {
499 }
500
501 > func (t *serializerImpl) RequestCancelInfoToBlob(info *persistencespb.RequestCancelInfo) (*commonpb.DataBlob, error) { serializer.go
502 > return encodeBlob(info, t.encodingType)
503 > }
504
505 func (t *serializerImpl) RequestCancelInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.RequestCancelInfo, error) {
508 }
509
510 > func (t *serializerImpl) TimerInfoToBlob(info *persistencespb.TimerInfo) (*commonpb.DataBlob, error) { serializer.go
511 > return encodeBlob(info, t.encodingType)
512 > }
513
514 func (t *serializerImpl) TimerInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TimerInfo, error) {