context_impl.go ×7

Frontier kind: Code frontier

unlabeled · c_1a5b3640576d

57 tests · 5427 LOC · 193 files · introduces 0 tests · 63 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges63 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1010 ranges5427 lines · 193 files · Browse complete extent
All tests (intent)
57 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: 63 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/shard/context_impl.go 32 introduced LOC · 7 ranges

Open complete file

537 ctx context.Context,
538 request *persistence.CreateWorkflowExecutionRequest,
539 > ) (*persistence.CreateWorkflowExecutionResponse, error) { context_impl.go
540 >
541 > // do not try to get namespace cache within shard lock
542 > namespaceID := namespace.ID(request.NewWorkflowSnapshot.ExecutionInfo.NamespaceId)
543 > namespaceEntry, err := s.GetNamespaceRegistry().GetNamespaceByID(namespaceID)
544 > if err != nil {
545 return nil, err
546 }
547
548 > if err := s.ioSemaphoreAcquire(ctx); err != nil { context_impl.go
549 return nil, err
550 }
551 > defer s.ioSemaphoreRelease() context_impl.go
552 >
553 > s.wLock()
554 >
555 > // timeout check should be done within the shard lock, in case of shard lock contention
556 > ctx, cancel, err := s.newDetachedContext(ctx)
557 > if err != nil {
558 s.wUnlock()
559 return nil, err
560 }
561 > defer cancel() context_impl.go
562 >
563 > if err := s.errorByState(); err != nil {
564 s.wUnlock()
565 return nil, err
566 }
567
568 > if err := s.errorByNamespaceStateLocked(namespaceEntry.Name(), request.NewWorkflowSnapshot.ExecutionInfo.WorkflowId); err != nil { context_impl.go
569 s.wUnlock()
570 return nil, err
571 }
572
573 > requestCompletionFn, err := s.taskKeyManager.setAndTrackTaskKeys( context_impl.go
574 > request.NewWorkflowSnapshot.Tasks,
575 > )
576 > if err != nil {
577 s.wUnlock()
578 return nil, err
579 }
580 > s.updateCloseTaskIDs(request.NewWorkflowSnapshot.ExecutionInfo, request.NewWorkflowSnapshot.Tasks) context_impl.go
581 >
582 > currentRangeID := s.getRangeIDLocked()
583 > request.RangeID = currentRangeID
584 >
585 > s.wUnlock()
586 > resp, err := s.executionManager.CreateWorkflowExecution(ctx, request)
587 > requestCompletionFn(err)
588 >
589 > if err = s.handleWriteError(request.RangeID, err); err != nil {
590 return nil, err
591 }
go.temporal.io/server/service/history/workflow/context.go 31 introduced LOC · 3 ranges

Open complete file

451 newWorkflowEvents []*persistence.WorkflowEvents,
452 transactionPolicy historyi.TransactionPolicy,
453 > ) (retError error) { context.go
454 >
455 > if transactionPolicy == historyi.TransactionPolicyActive {
456 > if rl := shardContext.BusinessIDReuseRateLimiter(
457 > namespace.ID(c.workflowKey.NamespaceID),
458 > c.workflowKey.WorkflowID,
459 > c.archetypeID,
460 > ); rl != nil && !rl.Allow() {
461 archetypeName, _ := shardContext.ChasmRegistry().ArchetypeDisplayName(c.archetypeID)
462 metrics.BusinessIDReuseRateLimited.With(shardContext.GetMetricsHandler()).Record(
470 }
471
472 > defer func() { context.go
473 > if retError != nil {
474 c.Clear()
475 }
476 }()
477
478 > createRequest := &persistence.CreateWorkflowExecutionRequest{ context.go
479 > ShardID: shardContext.GetShardID(),
480 > // workflow create mode & prev run ID & version
481 > Mode: createMode,
482 > PreviousRunID: prevRunID,
483 > PreviousLastWriteVersion: prevLastWriteVersion,
484 >
485 > ArchetypeID: c.archetypeID,
486 >
487 > NewWorkflowSnapshot: *newWorkflow,
488 > NewWorkflowEvents: newWorkflowEvents,
489 > }
490 >
491 > _, err := createWorkflowExecution(
492 > ctx,
493 > shardContext,
494 > newMutableState.GetCurrentVersion(),
495 > createRequest,
496 > newMutableState.IsWorkflow(),
497 > )
498 > if err != nil {
499 return err
500 }