Class ExternalStorage
- Namespace
- Temporalio.Converters
- Assembly
- Temporalio.dll
Configuration for offloading large payloads to an external storage system.
public sealed class ExternalStorage
- Inheritance
-
ExternalStorage
- Inherited Members
Remarks
This is validated when constructed rather than when used, so a misconfiguration surfaces at startup instead of on the first payload large enough to offload.
Constructors
ExternalStorage(IReadOnlyCollection<IStorageDriver>, StorageDriverSelector)
Initializes a new instance of the ExternalStorage class with a selector choosing among several drivers.
public ExternalStorage(IReadOnlyCollection<IStorageDriver> drivers, StorageDriverSelector driverSelector)
Parameters
driversIReadOnlyCollection<IStorageDriver>Drivers available for storing and retrieving payloads. At least one is required, and every driver must have a unique, non-empty Name.
driverSelectorStorageDriverSelectorSelector choosing which driver stores each payload.
Remarks
A selector is required here rather than optional, so that registering several drivers with no way to route between them cannot be expressed at all. Use ExternalStorage(IStorageDriver) for the single-driver case.
Exceptions
- ArgumentException
If no drivers are given, or if a driver name is empty or duplicated.
ExternalStorage(IStorageDriver)
Initializes a new instance of the ExternalStorage class with a single driver that stores every eligible payload.
public ExternalStorage(IStorageDriver driver)
Parameters
driverIStorageDriverDriver used for storing and retrieving payloads. Must have a non-empty Name.
Remarks
Retrieval routes by the name recorded in history, so a driver must remain configured for as long as any payload it stored can still be read.
Exceptions
- ArgumentException
If the driver name is empty.
Properties
DriverSelector
Gets the selector choosing which driver stores each payload.
public StorageDriverSelector DriverSelector { get; }
Property Value
Remarks
Only called for payloads that meet PayloadSizeThreshold, and must return one of Drivers or null.
Drivers
Gets the drivers available for storing and retrieving payloads.
public IReadOnlyCollection<IStorageDriver> Drivers { get; }
Property Value
PayloadSizeThreshold
Gets the minimum encoded payload size, in bytes, that is offloaded to external storage.
Payloads at or above this size are offloaded; smaller ones are left inline. Defaults to
256KiB; set to 0 to offload every payload.
public int PayloadSizeThreshold { get; init; }
Property Value
Remarks
This is measured against the entire encoded payload, including metadata, and after any IPayloadCodec has run.
Exceptions
- ArgumentOutOfRangeException
If set to a negative value.