Table of Contents

Class ExecutorExtensions

Namespace
Executables
Assembly
executables.dll

Extension methods for composing and adapting executors.

public static class ExecutorExtensions
Inheritance
ExecutorExtensions
Inherited Members

Methods

Cache<T1, T2>(IExecutor<T1, T2>, ICacheStorage<T1, T2>)

Adds cache behavior to an executor.

[Pure]
public static IExecutor<T1, T2> Cache<T1, T2>(this IExecutor<T1, T2> executor, ICacheStorage<T1, T2> storage)

Parameters

executor IExecutor<T1, T2>

Source executor.

storage ICacheStorage<T1, T2>

Cache storage used to resolve and persist values.

Returns

IExecutor<T1, T2>

Executor with caching behavior.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

storage is null.

Execute(IExecutor<Unit, Unit>)

Executes a parameterless executor with no result.

public static void Execute(this IExecutor<Unit, Unit> executor)

Parameters

executor IExecutor<Unit, Unit>

Execute<T>(IExecutor<Unit, T>)

Executes a parameterless executor.

public static T Execute<T>(this IExecutor<Unit, T> executor)

Parameters

executor IExecutor<Unit, T>

Returns

T

Execution result.

Type Parameters

T

Execute<T1, T2, T3>(IExecutor<(T1, T2), T3>, T1)

Partially applies the first argument of a two-argument executor.

public static IExecutor<T2, T3> Execute<T1, T2, T3>(this IExecutor<(T1, T2), T3> executor, T1 t1)

Parameters

executor IExecutor<(T1, T2), T3>
t1 T1

Returns

IExecutor<T2, T3>

Executor waiting for the remaining argument.

Type Parameters

T1
T2
T3

Execute<T1, T2, T3>(IExecutor<(T1, T2), T3>, T1, T2)

Executes a two-argument executor.

public static T3 Execute<T1, T2, T3>(this IExecutor<(T1, T2), T3> executor, T1 t1, T2 t2)

Parameters

executor IExecutor<(T1, T2), T3>
t1 T1
t2 T2

Returns

T3

Execution result.

Type Parameters

T1
T2
T3

Execute<T1, T2, T3, T4>(IExecutor<(T1, T2, T3), T4>, T1)

Partially applies the first argument of a three-argument executor.

public static IExecutor<(T2, T3), T4> Execute<T1, T2, T3, T4>(this IExecutor<(T1, T2, T3), T4> executor, T1 t1)

Parameters

executor IExecutor<(T1, T2, T3), T4>
t1 T1

Returns

IExecutor<(T2, T3), T4>

Executor waiting for two remaining arguments.

Type Parameters

T1
T2
T3
T4

Execute<T1, T2, T3, T4>(IExecutor<(T1, T2, T3), T4>, T1, T2)

Partially applies the first two arguments of a three-argument executor.

public static IExecutor<T3, T4> Execute<T1, T2, T3, T4>(this IExecutor<(T1, T2, T3), T4> executor, T1 t1, T2 t2)

Parameters

executor IExecutor<(T1, T2, T3), T4>
t1 T1
t2 T2

Returns

IExecutor<T3, T4>

Executor waiting for the remaining argument.

Type Parameters

T1
T2
T3
T4

Execute<T1, T2, T3, T4>(IExecutor<(T1, T2, T3), T4>, T1, T2, T3)

Executes a three-argument executor.

public static T4 Execute<T1, T2, T3, T4>(this IExecutor<(T1, T2, T3), T4> executor, T1 t1, T2 t2, T3 t3)

Parameters

executor IExecutor<(T1, T2, T3), T4>
t1 T1
t2 T2
t3 T3

Returns

T4

Execution result.

Type Parameters

T1
T2
T3
T4

Execute<T1, T2, T3, T4, T5>(IExecutor<(T1, T2, T3, T4), T5>, T1)

Partially applies the first argument of a four-argument executor.

public static IExecutor<(T2, T3, T4), T5> Execute<T1, T2, T3, T4, T5>(this IExecutor<(T1, T2, T3, T4), T5> executor, T1 t1)

Parameters

executor IExecutor<(T1, T2, T3, T4), T5>
t1 T1

Returns

IExecutor<(T2, T3, T4), T5>

Executor waiting for three remaining arguments.

Type Parameters

T1
T2
T3
T4
T5

Execute<T1, T2, T3, T4, T5>(IExecutor<(T1, T2, T3, T4), T5>, T1, T2)

Partially applies the first two arguments of a four-argument executor.

public static IExecutor<(T3, T4), T5> Execute<T1, T2, T3, T4, T5>(this IExecutor<(T1, T2, T3, T4), T5> executor, T1 t1, T2 t2)

Parameters

executor IExecutor<(T1, T2, T3, T4), T5>
t1 T1
t2 T2

Returns

IExecutor<(T3, T4), T5>

Executor waiting for two remaining arguments.

Type Parameters

T1
T2
T3
T4
T5

Execute<T1, T2, T3, T4, T5>(IExecutor<(T1, T2, T3, T4), T5>, T1, T2, T3)

Partially applies the first three arguments of a four-argument executor.

public static IExecutor<T4, T5> Execute<T1, T2, T3, T4, T5>(this IExecutor<(T1, T2, T3, T4), T5> executor, T1 t1, T2 t2, T3 t3)

Parameters

executor IExecutor<(T1, T2, T3, T4), T5>
t1 T1
t2 T2
t3 T3

Returns

IExecutor<T4, T5>

Executor waiting for the remaining argument.

Type Parameters

T1
T2
T3
T4
T5

Execute<T1, T2, T3, T4, T5>(IExecutor<(T1, T2, T3, T4), T5>, T1, T2, T3, T4)

Executes a four-argument executor.

public static T5 Execute<T1, T2, T3, T4, T5>(this IExecutor<(T1, T2, T3, T4), T5> executor, T1 t1, T2 t2, T3 t3, T4 t4)

Parameters

executor IExecutor<(T1, T2, T3, T4), T5>
t1 T1
t2 T2
t3 T3
t4 T4

Returns

T5

Execution result.

Type Parameters

T1
T2
T3
T4
T5

MapException<T1, T2, TFrom>(IExecutor<T1, T2>, Func<TFrom, Exception>)

Maps exceptions of a specific type thrown by an executor.

[Pure]
public static IExecutor<T1, T2> MapException<T1, T2, TFrom>(this IExecutor<T1, T2> executor, Func<TFrom, Exception> map) where TFrom : Exception

Parameters

executor IExecutor<T1, T2>

Source executor.

map Func<TFrom, Exception>

Function that maps the caught exception to a new exception.

Returns

IExecutor<T1, T2>

Executor with exception mapping behavior.

Type Parameters

T1
T2
TFrom

Exceptions

ArgumentNullException

map is null.

Metrics<T1, T2>(IExecutor<T1, T2>, IMetrics<T1, T2>, string)

Adds metrics behavior to an executor.

[Pure]
public static IExecutor<T1, T2> Metrics<T1, T2>(this IExecutor<T1, T2> executor, IMetrics<T1, T2> metrics, string tag = null)

Parameters

executor IExecutor<T1, T2>

Source executor.

metrics IMetrics<T1, T2>

Metrics sink used to record execution information.

tag string

Optional tag passed to all metrics callbacks.

Returns

IExecutor<T1, T2>

Executor with metrics behavior.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

metrics is null.

OnThreadPool<T>(IExecutor<T, Unit>)

Schedules executor calls on the thread pool.

[Pure]
public static IExecutor<T, Unit> OnThreadPool<T>(this IExecutor<T, Unit> executor)

Parameters

executor IExecutor<T, Unit>

Source executor.

Returns

IExecutor<T, Unit>

Thread-pool scheduled executor.

Type Parameters

T

SuppressException<T1, T2>(IExecutor<T1, Optional<T2>>)

Starts configuration of exception suppression for executors returning Optional<T>.

[Pure]
public static SuppressExceptionFlattenExecutorProvider<T1, T2> SuppressException<T1, T2>(this IExecutor<T1, Optional<T2>> executor)

Parameters

executor IExecutor<T1, Optional<T2>>

Executor to configure.

Returns

SuppressExceptionFlattenExecutorProvider<T1, T2>

Provider for selecting exception types to suppress.

Type Parameters

T1
T2

SuppressException<T1, T2>(IExecutor<T1, T2>)

Starts configuration of exception suppression for executor results.

[Pure]
public static SuppressExceptionExecutorProvider<T1, T2> SuppressException<T1, T2>(this IExecutor<T1, T2> executor)

Parameters

executor IExecutor<T1, T2>

Executor to configure.

Returns

SuppressExceptionExecutorProvider<T1, T2>

Provider for selecting exception types to suppress.

Type Parameters

T1
T2

Tap<T1, T2>(IExecutor<T1, T2>, Action<T2>)

Runs a side effect on each execution result while returning the original result unchanged.

[Pure]
public static IExecutor<T1, T2> Tap<T1, T2>(this IExecutor<T1, T2> executor, Action<T2> action)

Parameters

executor IExecutor<T1, T2>

Executor producing the observed result.

action Action<T2>

Side-effect action invoked with the produced result.

Returns

IExecutor<T1, T2>

Executor that preserves the original result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

action is null.

Throttle<T>(IExecutor<T, Unit>, TimeSpan)

Throttles repeated executions within the specified interval.

[Pure]
public static IExecutor<T, Unit> Throttle<T>(this IExecutor<T, Unit> executor, TimeSpan interval)

Parameters

executor IExecutor<T, Unit>

Source executor.

interval TimeSpan

Minimum interval between forwarded executions.

Returns

IExecutor<T, Unit>

Executor with throttling behavior.

Type Parameters

T

Exceptions

ArgumentException

interval is less than or equal to zero.

WithContext<T1, T2>(IExecutor<T1, T2>, ContextInit)

Executes an executor within a newly initialized interaction context.

[Pure]
public static IExecutor<T1, T2> WithContext<T1, T2>(this IExecutor<T1, T2> executor, ContextInit init)

Parameters

executor IExecutor<T1, T2>

Executor to run inside the context.

init ContextInit

Context initialization logic.

Returns

IExecutor<T1, T2>

Executor wrapped with contextual execution.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

init is null.

WithPolicy<T1, T2>(IExecutor<T1, T2>, Action<PolicyBuilder<T1, T2>>)

Builds and applies a policy pipeline to an executor.

[Pure]
public static IExecutor<T1, T2> WithPolicy<T1, T2>(this IExecutor<T1, T2> executor, Action<PolicyBuilder<T1, T2>> building)

Parameters

executor IExecutor<T1, T2>

Executor to wrap with policies.

building Action<PolicyBuilder<T1, T2>>

Builder action that configures policies.

Returns

IExecutor<T1, T2>

Executor wrapped with configured policies.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

building is null.

WithResult<T1, T2>(IExecutor<T1, Result<T2>>)

Wraps an executor already returning Result<T> so that thrown exceptions are also converted to Result<T>.

[Pure]
public static IExecutor<T1, Result<T2>> WithResult<T1, T2>(this IExecutor<T1, Result<T2>> executor)

Parameters

executor IExecutor<T1, Result<T2>>

Executor returning Result<T>.

Returns

IExecutor<T1, Result<T2>>

Executor that preserves returned results and converts thrown exceptions to failure results.

Type Parameters

T1
T2

WithResult<T1, T2>(IExecutor<T1, T2>)

Wraps executor result into Result<T> capturing thrown exceptions.

[Pure]
public static IExecutor<T1, Result<T2>> WithResult<T1, T2>(this IExecutor<T1, T2> executor)

Parameters

executor IExecutor<T1, T2>

Executor to wrap.

Returns

IExecutor<T1, Result<T2>>

Executor returning success or failure result.

Type Parameters

T1
T2