Documentation
¶
Index ¶
- Constants
- func ActivityTaskQueueKey(scheduledEventID int64) string
- func ActivityTypeKey(scheduledEventID int64) string
- func ContextHasMetadata(ctx context.Context) bool
- func ContextMetadataGet(ctx context.Context, key string) (any, bool)
- func ContextMetadataGetActivityTypeAndTaskQueue(ctx context.Context) (activityType string, taskQueue string, ok bool)
- func ContextMetadataGetAll(ctx context.Context) map[string]any
- func ContextMetadataGetMarkedActivityIDs(ctx context.Context) []string
- func ContextMetadataMarkActivityID(ctx context.Context, activityID string) bool
- func ContextMetadataSet(ctx context.Context, key string, value any) bool
- func WithDeadlineBuffer(parent context.Context, timeout time.Duration, buffer time.Duration) (context.Context, context.CancelFunc)
- func WithMetadataContext(ctx context.Context) context.Context
Constants ¶
const ( // MetadataKeyWorkflowType is the context metadata key for workflow type. // These keys are serialized into a protobuf message (ContextMetadata) and sent // in the "contextmetadata-bin" gRPC trailer. The "-bin" suffix causes gRPC to // base64-encode the value on the wire, so metadata values may contain arbitrary // bytes including HTTP/2-unsafe control characters. MetadataKeyWorkflowType = "workflow-type" // MetadataKeyWorkflowTaskQueue is the context metadata key for workflow task queue MetadataKeyWorkflowTaskQueue = "workflow-task-queue" // MetadataKeyStandaloneActivityType is the context metadata key for standalone activity type. MetadataKeyStandaloneActivityType = "standalone-activity-type" // MetadataKeyStandaloneActivityTaskQueue is the context metadata key for standalone activity task queue. MetadataKeyStandaloneActivityTaskQueue = "standalone-activity-task-queue" )
Variables ¶
This section is empty.
Functions ¶
func ActivityTaskQueueKey ¶
ActivityTaskQueueKey returns the metadata key for an activity's task queue, keyed by scheduled event ID.
func ActivityTypeKey ¶
ActivityTypeKey returns the metadata key for an activity's type, keyed by scheduled event ID.
func ContextHasMetadata ¶ added in v1.31.0
ContextHasMetadata returns true if the context has metadata support. This can be used to debug whether a context has been properly initialized with metadata.
func ContextMetadataGet ¶ added in v1.31.0
ContextMetadataGet retrieves a metadata value from the context.
func ContextMetadataGetActivityTypeAndTaskQueue ¶
func ContextMetadataGetActivityTypeAndTaskQueue(ctx context.Context) (activityType string, taskQueue string, ok bool)
ContextMetadataGetActivityTypeAndTaskQueue scans the context metadata for a single activity's type and task queue. Returns false if no activity metadata is found or if multiple activities are present.
func ContextMetadataGetAll ¶ added in v1.31.0
ContextMetadataGetAll retrieves all metadata from the context as a map copy.
func ContextMetadataGetMarkedActivityIDs ¶
ContextMetadataGetMarkedActivityIDs returns the marked activity IDs from the context.
func ContextMetadataMarkActivityID ¶
ContextMetadataMarkActivityID marks an activity ID on the context for metadata resolution. The handler knows which activity (from the task token) but not its type or task queue. Mutable state knows the activity details but not which activity the request targets. This bridges the two: the handler marks the ID, and SetContextMetadata (during closeTransaction) resolves it to type and task queue from mutable state. Cannot be used for transactions that remove the activity from mutable state (e.g., activity completion), since it won't be available for resolution.
func ContextMetadataSet ¶ added in v1.31.0
ContextMetadataSet sets a metadata key-value pair in the context, overwriting any existing value.
func WithDeadlineBuffer ¶
func WithDeadlineBuffer( parent context.Context, timeout time.Duration, buffer time.Duration, ) (context.Context, context.CancelFunc)
WithDeadlineBuffer returns a child context with a deadline that ensures that at least buffer amount of time remains after the child deadline expires and before the parent deadline expires. The returned context timeout is therefore <= the requested timeout. If the parent deadline itself does not allow buffer amount of time, then the returned context deadline expires immediately. Use this method to create child context when the child cannot use all of parent's deadline but instead there is a need to leave some time for parent to do some post-work.
Types ¶
This section is empty.