Class: Temporalio::WorkerDeploymentVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/worker_deployment_version.rb

Overview

Represents the version of a specific worker deployment.

WARNING: Experimental API.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(deployment_name:, build_id:) ⇒ WorkerDeploymentVersion

Create WorkerDeploymentVersion.

Parameters:

  • deployment_name (String)

    The name of the deployment.

  • build_id (String)

    The build identifier specific to this worker build.



40
41
42
# File 'lib/temporalio/worker_deployment_version.rb', line 40

def initialize(deployment_name:, build_id:) # rubocop:disable Lint/UselessMethodDefinition
  super
end

Class Method Details

.from_canonical_string(canonical) ⇒ WorkerDeploymentVersion

Parse a version from a canonical string, which must be in the format ‘<deployment_name>.<build_id>`. Deployment name must not have a `.` in it.

Parameters:

  • canonical (String)

    The canonical string representation of the version.

Returns:



20
21
22
23
24
25
26
27
# File 'lib/temporalio/worker_deployment_version.rb', line 20

def self.from_canonical_string(canonical)
  parts = canonical.split('.', 2)
  if parts.length != 2
    raise ArgumentError,
          "Cannot parse version string: #{canonical}, must be in format <deployment_name>.<build_id>"
  end
  new(deployment_name: parts[0], build_id: parts[1])
end

Instance Method Details

#to_canonical_stringString

Returns the canonical string representation of the version.

Returns:

  • (String)


47
48
49
# File 'lib/temporalio/worker_deployment_version.rb', line 47

def to_canonical_string
  "#{deployment_name}.#{build_id}"
end