Documentation
¶
Index ¶
- Constants
- func ContextHasMetadata(ctx context.Context) bool
- func ContextMetadataGet(ctx context.Context, key string) (any, bool)
- func ContextMetadataGetAll(ctx context.Context) map[string]any
- 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 MetadataKeyWorkflowType = "workflow-type" // MetadataKeyWorkflowTaskQueue is the context metadata key for workflow task queue MetadataKeyWorkflowTaskQueue = "workflow-task-queue" )
Variables ¶
This section is empty.
Functions ¶
func ContextHasMetadata ¶
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 ¶
ContextMetadataGet retrieves a metadata value from the context.
func ContextMetadataGetAll ¶
ContextMetadataGetAll retrieves all metadata from the context as a map copy.
func ContextMetadataSet ¶
ContextMetadataSet sets a metadata key-value pair in the context.
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.