worker_versioning

package
v1.27.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildIdSearchAttributePrefixPinned = "pinned"

	BuildIdSearchAttributeDelimiter = ":"
	BuildIdSearchAttributeEscape    = "|"
	// UnversionedSearchAttribute is the sentinel value used to mark all unversioned workflows
	UnversionedSearchAttribute = buildIdSearchAttributePrefixUnversioned
	UnversionedVersionId       = "__unversioned__"

	// Prefixes, Delimeters and Keys
	WorkerDeploymentVersionIdDelimiter         = "."
	WorkerDeploymentVersionWorkflowIDPrefix    = "temporal-sys-worker-deployment-version"
	WorkerDeploymentWorkflowIDPrefix           = "temporal-sys-worker-deployment"
	WorkerDeploymentVersionWorkflowIDDelimeter = ":"
	WorkerDeploymentVersionWorkflowIDEscape    = "|"
)

Variables

This section is empty.

Functions

func AssignedBuildIdSearchAttribute added in v1.24.0

func AssignedBuildIdSearchAttribute(buildId string) string

AssignedBuildIdSearchAttribute returns the search attribute value for the currently assigned build ID

func BuildIdIfUsingVersioning added in v1.24.0

func BuildIdIfUsingVersioning(stamp *commonpb.WorkerVersionStamp) string

BuildIdIfUsingVersioning returns the given WorkerVersionStamp if it is using versioning, otherwise returns nil.

func CalculateTaskQueueVersioningInfo added in v1.27.0

func CalculateTaskQueueVersioningInfo(deployments *persistencespb.DeploymentData) (*deploymentspb.DeploymentVersionData, *deploymentspb.DeploymentVersionData)

func DeploymentFromCapabilities added in v1.26.2

func DeploymentFromCapabilities(capabilities *commonpb.WorkerVersionCapabilities, options *deploymentpb.WorkerDeploymentOptions) *deploymentpb.Deployment

DeploymentFromCapabilities returns the deployment if it is using versioning V3, otherwise nil. It returns the deployment from the `options` if present, otherwise, from `capabilities`,

func DeploymentFromDeploymentVersion added in v1.27.0

func DeploymentFromDeploymentVersion(dv *deploymentspb.WorkerDeploymentVersion) *deploymentpb.Deployment

DeploymentFromDeploymentVersion Temporary helper function to convert WorkerDeploymentVersion to Deployment proto until we update code to use the new proto in all places.

func DeploymentIfValid added in v1.27.0

func DeploymentIfValid(d *deploymentpb.Deployment) *deploymentpb.Deployment

DeploymentIfValid returns the deployment back if is both of its fields have value.

func DeploymentOrVersion added in v1.27.0

DeploymentOrVersion Temporary helper function to return a Deployment based on passed Deployment or WorkerDeploymentVersion objects, if `v` is not nil, it'll take precedence.

func DeploymentToString added in v1.26.2

func DeploymentToString(deployment *deploymentpb.Deployment) string

DeploymentToString is intended to be used for logs and metrics only. Theoretically, it can map different deployments to the string. DO NOT USE IN SERVER LOGIC.

func DeploymentVersionFromDeployment added in v1.27.0

func DeploymentVersionFromDeployment(deployment *deploymentpb.Deployment) *deploymentspb.WorkerDeploymentVersion

DeploymentVersionFromDeployment Temporary helper function to convert Deployment to WorkerDeploymentVersion proto until we update code to use the new proto in all places.

func DeploymentVersionFromOptions added in v1.27.0

func DeploymentVersionFromOptions(options *deploymentpb.WorkerDeploymentOptions) *deploymentspb.WorkerDeploymentVersion

func DirectiveDeployment added in v1.27.0

func DirectiveDeployment(directive *taskqueuespb.TaskVersionDirective) *deploymentpb.Deployment

DirectiveDeployment Temporary function until Directive proto is removed.

func FindBuildId

func FindBuildId(versioningData *persistencespb.VersioningData, buildId string) (setIndex, indexInSet int)

FindBuildId finds a build ID in the version data's sets, returning (set index, index within that set). Returns -1, -1 if not found.

func FindDeploymentVersionForWorkflowID added in v1.27.0

func FindDeploymentVersionForWorkflowID(
	current *deploymentspb.DeploymentVersionData,
	ramping *deploymentspb.DeploymentVersionData,
	workflowId string,
) *deploymentspb.WorkerDeploymentVersion

FindDeploymentVersionForWorkflowID returns the deployment version that should be used for a particular workflow ID based on the versioning info of the task queue. Nil means unversioned.

func GenerateDeploymentWorkflowID added in v1.27.0

func GenerateDeploymentWorkflowID(deploymentName string) string

GenerateDeploymentWorkflowID is a helper that generates a system accepted workflowID which are used in our Worker Deployment workflows

func GenerateVersionWorkflowID added in v1.27.0

func GenerateVersionWorkflowID(deploymentName string, buildID string) string

GenerateVersionWorkflowID is a helper that generates a system accepted workflowID which are used in our Worker Deployment Version workflows

func IsUnversionedOrAssignedBuildIdSearchAttribute added in v1.24.0

func IsUnversionedOrAssignedBuildIdSearchAttribute(buildId string) bool

IsUnversionedOrAssignedBuildIdSearchAttribute returns the value is "unversioned" or "assigned:<bld>"

func MakeBuildIdDirective added in v1.24.0

func MakeBuildIdDirective(buildId string) *taskqueuespb.TaskVersionDirective

func MakeDirectiveForWorkflowTask added in v1.22.0

func MakeDirectiveForWorkflowTask(
	inheritedBuildId string,
	assignedBuildId string,
	stamp *commonpb.WorkerVersionStamp,
	hasCompletedWorkflowTask bool,
	behavior enumspb.VersioningBehavior,
	deployment *deploymentpb.Deployment,
) *taskqueuespb.TaskVersionDirective

MakeDirectiveForWorkflowTask returns a versioning directive based on the following parameters: - inheritedBuildId: build ID inherited from a past/previous wf execution (for Child WF or CaN) - assignedBuildId: the build ID to which the WF is currently assigned (i.e. mutable state's AssginedBuildId) - stamp: the latest versioning stamp of the execution (only needed for old versioning) - hasCompletedWorkflowTask: if the wf has completed any WFT - behavior: workflow's effective behavior - deployment: workflow's effective deployment

func MakeUseAssignmentRulesDirective added in v1.24.0

func MakeUseAssignmentRulesDirective() *taskqueuespb.TaskVersionDirective

func PinnedBuildIdSearchAttribute added in v1.26.2

func PinnedBuildIdSearchAttribute(version string) string

PinnedBuildIdSearchAttribute creates the pinned search attribute for the BuildIds list, used as a visibility optimization. For pinned workflows using WorkerDeployment APIs (ms.GetEffectiveVersioningBehavior() == PINNED && ms.executionInfo.VersioningInfo.Version != ""), this will be `pinned:<version>`. The version used will be the override version if set, or the versioningInfo.Version.

If deprecated Deployment-based APIs are in use and the workflow is pinned, `pinned:<deployment_series_name>:<deployment_build_id>` will. The values used will be the override deployment_series and build_id if set, or versioningInfo.Deployment.

If the workflow becomes unpinned or unversioned, this entry will be removed from that list.

func StampFromBuildId added in v1.26.2

func StampFromBuildId(buildId string) *commonpb.WorkerVersionStamp

func StampFromCapabilities added in v1.24.0

func StampIfUsingVersioning added in v1.22.0

func StampIfUsingVersioning(stamp *commonpb.WorkerVersionStamp) *commonpb.WorkerVersionStamp

StampIfUsingVersioning returns the given WorkerVersionStamp if it is using versioning, otherwise returns nil.

func UnversionedBuildIdSearchAttribute

func UnversionedBuildIdSearchAttribute(buildId string) string

UnversionedBuildIdSearchAttribute returns the search attribute value for an unversioned build ID

func ValidateDeployment added in v1.26.2

func ValidateDeployment(deployment *deploymentpb.Deployment) error

ValidateDeployment returns error if the deployment is nil or it has empty build ID or deployment name.

func ValidateDeploymentVersion added in v1.27.0

func ValidateDeploymentVersion(version *deploymentspb.WorkerDeploymentVersion) error

ValidateDeploymentVersion returns error if the deployment version is nil or it has empty version or deployment name.

func ValidateDeploymentVersionString added in v1.27.0

func ValidateDeploymentVersionString(version string) (*deploymentspb.WorkerDeploymentVersion, error)

ValidateDeploymentVersionString returns error if the deployment version is nil or it has empty version or deployment name.

func ValidateTaskVersionDirective added in v1.27.0

func ValidateTaskVersionDirective(
	directive *taskqueuespb.TaskVersionDirective,
	wfBehavior enumspb.VersioningBehavior,
	wfDeployment *deploymentpb.Deployment,
	scheduledDeployment *deploymentpb.Deployment,
) error

func ValidateVersioningOverride added in v1.26.2

func ValidateVersioningOverride(override *workflowpb.VersioningOverride) error

func VersionStampToBuildIdSearchAttribute

func VersionStampToBuildIdSearchAttribute(stamp *commonpb.WorkerVersionStamp) string

VersionStampToBuildIdSearchAttribute returns the search attribute value for a version stamp

func VersionedBuildIdSearchAttribute

func VersionedBuildIdSearchAttribute(buildId string) string

VersionedBuildIdSearchAttribute returns the search attribute value for a versioned build ID

func WorkerDeploymentVersionFromString added in v1.27.0

func WorkerDeploymentVersionFromString(s string) (*deploymentspb.WorkerDeploymentVersion, error)

func WorkerDeploymentVersionToString added in v1.27.0

func WorkerDeploymentVersionToString(v *deploymentspb.WorkerDeploymentVersion) string

func WorkflowsExistForBuildId

func WorkflowsExistForBuildId(ctx context.Context, visibilityManager manager.VisibilityManager, ns *namespace.Namespace, taskQueue, buildId string) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL