mutable_state_impl.go ×8

Frontier kind: Joint frontier

unlabeled · c_83233782a161

1 test · 4923 LOC · 197 files · introduces 1 test · 31 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges31 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
837 ranges4923 lines · 197 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.

2 files ranked by introduced lines: 31 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/mutable_state_impl.go 27 introduced LOC · 8 ranges

Open complete file

1382 // GenerateEventLoadToken generates a token for loading a history event at a later time. The token encodes the event ID
1383 // and the batch ID (if applicable) which can be used to load the event from the events cache.
1384 > func (ms *MutableStateImpl) GenerateEventLoadToken(event *historypb.HistoryEvent) ([]byte, error) { mutable_state_impl.go
1385 > if event.EventId == common.BufferedEventID {
1386 return nil, serviceerror.NewInternalf("cannot reference buffered event: %v", event.EventType)
1387 }
1388 > batchID := ms.hBuilder.LatestEventBatchID() mutable_state_impl.go
1389 > if batchID == common.EmptyEventID {
1390 batchID = ms.replayEventBatchID
1391 }
1392 > if batchID == common.EmptyEventID { mutable_state_impl.go
1393 return nil, serviceerror.NewInternalf("cannot reference event: %v", event.EventType)
1394 }
1395 > if batchID > event.EventId { mutable_state_impl.go
1396 // The batch ID is the first event ID of the event's own batch, so it can never exceed the
1397 // event's ID.
1400 batchID, event.EventId)
1401 }
1402 > ref := &tokenspb.HistoryEventRef{ mutable_state_impl.go
1403 > EventId: event.EventId,
1404 > EventBatchId: batchID,
1405 > }
1406 > return proto.Marshal(ref)
1407 }
1408
1409 > func (ms *MutableStateImpl) LoadHistoryEvent(ctx context.Context, token []byte) (*historypb.HistoryEvent, error) { mutable_state_impl.go
1410 > ref := &tokenspb.HistoryEventRef{}
1411 > err := proto.Unmarshal(token, ref)
1412 > if err != nil {
1413 return nil, err
1414 }
1415 > branchToken, version, err := ms.getCurrentBranchTokenAndEventVersion(ref.EventId) mutable_state_impl.go
1416 > if err != nil {
1417 return nil, err
1418 }
1419 > wfKey := ms.GetWorkflowKey() mutable_state_impl.go
1420 > eventKey := events.EventKey{
1421 > NamespaceID: namespace.ID(wfKey.NamespaceID),
1422 > WorkflowID: wfKey.WorkflowID,
1423 > RunID: wfKey.RunID,
1424 > EventID: ref.EventId,
1425 > Version: version,
1426 > }
1427 >
1428 > return ms.eventsCache.GetEvent(ctx, ms.shard.GetShardID(), eventKey, ref.EventBatchId, branchToken)
1429 }
1430
go.temporal.io/server/service/history/historybuilder/event_store.go 4 introduced LOC · 1 range

Open complete file

108 // LatestEventBatchID returns the first event ID of the batch currently being built, or
109 // common.EmptyEventID if the current batch is empty, e.g. after a Flush.
110 > func (b *EventStore) LatestEventBatchID() int64 { event_store.go
111 > if len(b.memLatestBatch) > 0 {
112 > return b.memLatestBatch[0].EventId
113 > }
114 return common.EmptyEventID
115 }