Class: Temporalio::WorkerDeploymentVersion

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

Overview

Represents the version of a specific worker deployment.

WARNING: Experimental API.

Instance Attribute Summary collapse

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

Instance Attribute Details

#build_idObject (readonly)

Returns the value of attribute build_id

Returns:

  • (Object)

    the current value of build_id



6
7
8
# File 'lib/temporalio/worker_deployment_version.rb', line 6

def build_id
  @build_id
end

#deployment_nameObject (readonly)

Returns the value of attribute deployment_name

Returns:

  • (Object)

    the current value of deployment_name



6
7
8
# File 'lib/temporalio/worker_deployment_version.rb', line 6

def deployment_name
  @deployment_name
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