go.temporal.io/server/chasm/ms_pointer.go
63 LOC · 17 covered · 46 uncovered · 5 ranges · 275 concepts · 4 introducers · 153 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
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 related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
package chasm
import (
"time"
enumspb "go.temporal.io/api/enums/v1"
historypb "go.temporal.io/api/history/v1"
"go.temporal.io/server/common/nexus/nexusrpc"
)
// MSPointer is a special CHASM type which components can use to access their Node's underlying backend (i.e. mutable
// state). It is used to expose methods needed from the mutable state without polluting the chasm.Context interface.
// When deserializing components with fields of this type, the CHASM engine will set the value to its NodeBackend.
// This should only be used by the Workflow component.
type MSPointer struct {
backend NodeBackend
}
// NewMSPointer creates a new MSPointer instance.
return MSPointer{
backend: backend,
}
}
// WorkflowRunTimeout returns the workflow run timeout duration. Returns 0 if no timeout is set.
return m.backend.GetExecutionInfo().GetWorkflowRunTimeout().AsDuration()
}
// AddHistoryEvent adds a history event via the underlying mutable state.
func (m MSPointer) AddHistoryEvent(t enumspb.EventType, setAttributes func(*historypb.HistoryEvent)) *historypb.HistoryEvent {
nexus_commands.go ×5
return m.backend.AddHistoryEvent(t, setAttributes)
}
// HasAnyBufferedEvent returns true if there is at least one buffered event that matches the provided filter.
func (m MSPointer) HasAnyBufferedEvent(filter func(*historypb.HistoryEvent) bool) bool {
nexus_commands.go ×2
return m.backend.HasAnyBufferedEvent(filter)
}
func (m MSPointer) GenerateEventLoadToken(event *historypb.HistoryEvent) ([]byte, error) {
nexus_events.go ×4
return m.backend.GenerateEventLoadToken(event)
}
// LoadHistoryEvent loads a history event from the underlying mutable state using the given token.
func (m MSPointer) LoadHistoryEvent(ctx Context, token []byte) (*historypb.HistoryEvent, error) {
return m.backend.LoadHistoryEvent(ctx.goContext(), token)
}
// GetNexusCompletion retrieves the Nexus operation completion data for the given request ID from the underlying mutable state.
func (m MSPointer) GetNexusCompletion(ctx Context, requestID string) (nexusrpc.CompleteOperationOptions, error) {
return m.backend.GetNexusCompletion(ctx.goContext(), requestID)
}
// GetWorkflowTypeName retrieves the workflow type name from the underlying mutable state.
func (m MSPointer) GetWorkflowTypeName() string {
return m.backend.GetExecutionInfo().GetWorkflowTypeName()
}
// GetNexusUpdateCompletion retrieves the Nexus operation completion data for the given update ID and request ID from the underlying mutable state.
func (m MSPointer) GetNexusUpdateCompletion(ctx Context, updateID string, requestID string) (nexusrpc.CompleteOperationOptions, error) {
return m.backend.GetNexusUpdateCompletion(ctx.goContext(), updateID, requestID)
}