Table of Contents

Interface IVariableProvider

Namespace
Invex.Atom.Build.Variables
Assembly
Invex.Atom.Build.dll

Defines a provider for reading and writing workflow variables to a specific storage backend.

public interface IVariableProvider

Examples

public class CustomVariableProvider : IVariableProvider
{
    public async Task<bool> WriteVariable(string variableName, string variableValue, CancellationToken cancellationToken)
    {
        // Custom logic to write to an external system
        return await WriteToExternalSystemAsync(variableName, variableValue);
    }
    public async Task<string?> ReadVariable(string jobName, string variableName, CancellationToken cancellationToken) =>
        // Custom logic to read from an external system; null if this provider does not have it
        await ReadFromExternalSystemAsync(jobName, variableName);
}

Remarks

This interface is part of Atom's extensible variable management system. Multiple providers can be registered, and the IVariableService will delegate operations to them in a chain of responsibility.

WriteVariable(string, string, CancellationToken) returns true if the provider handled the write, or false to allow the next provider in the chain to attempt it. ReadVariable(string, string, CancellationToken) returns the variable's value, or null to allow the next provider to attempt it.

Methods

ReadVariable(string, string, CancellationToken)

Reads a variable from the provider's storage system for a specific job context.

Task<string?> ReadVariable(string jobName, string variableName, CancellationToken cancellationToken = default)

Parameters

jobName string

The name of the job context from which to read the variable.

variableName string

The name of the variable to read.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

A task that resolves to the variable's value, or null if this provider cannot supply it.

WriteVariable(string, string, CancellationToken)

Writes a variable to the provider's storage system.

Task<bool> WriteVariable(string variableName, string variableValue, CancellationToken cancellationToken = default)

Parameters

variableName string

The name of the variable to write.

variableValue string

The value to store for the variable.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<bool>

A task that resolves to true if the provider successfully handled the write operation; otherwise, false to delegate to the next provider.

See Also