Class: Temporalio::Converters::StorageDriver

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

Overview

Note:

WARNING: This API is experimental and may change in the future.

Base class for storing and retrieving payloads in an external storage system.

Payloads at or over the configured size threshold are handed to a driver and replaced on the wire by a small reference, so the payload data itself never reaches the Temporal server.

Implementations are called concurrently and must be thread safe. Methods block, and may perform I/O directly. To work a batch concurrently, fan out with threads: threads overlap blocking I/O, since Ruby releases its global lock around it, and they work whether or not the worker is running under a fiber scheduler. Fiber.schedule must not be used, since it raises when the worker is configured with a payload codec thread pool instead of a fiber scheduler. Worker::ThreadPool can be used to bound that fan out.

Instance Method Summary collapse

Instance Method Details

#name ⇒ String

Name of this driver instance, unique among the drivers registered on one ExternalStorage. This is written into history alongside every payload the driver stores and is used to route retrieval back to the same driver. Renaming a deployed driver makes every payload stored under the old name unretrievable.

Returns:

  • (String) —

    Driver instance name.

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/temporalio/converters/storage_driver.rb', line 23

def name
  raise NotImplementedError
end

#retrieve(context, claims) ⇒ Array<Api::Common::V1::Payload>

Retrieve the payloads for the given claims.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/temporalio/converters/storage_driver.rb', line 50

def retrieve(context, claims)
  raise NotImplementedError
end

#store(context, payloads) ⇒ Array<StorageDriverClaim>

Store the given payloads.

Parameters:

Returns:

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/temporalio/converters/storage_driver.rb', line 41

def store(context, payloads)
  raise NotImplementedError
end

#type ⇒ String

Identifier for this driver implementation, for example aws.s3driver. Unlike #name, this is identical across every instance of the same implementation and across SDK languages. Reported in the worker heartbeat. Must be implemented.

Returns:

  • (String) —

    Driver implementation identifier.

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/temporalio/converters/storage_driver.rb', line 32

def type
  raise NotImplementedError, "#{self.class} must implement #type"
end