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
executorIExecutor<T1, T2>Source executor.
storageICacheStorage<T1, T2>Cache storage used to resolve and persist values.
Returns
- IExecutor<T1, T2>
Executor with caching behavior.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
storageis null.
Execute(IExecutor<Unit, Unit>)
Executes a parameterless executor with no result.
public static void Execute(this IExecutor<Unit, Unit> executor)
Parameters
Execute<T>(IExecutor<Unit, T>)
Executes a parameterless executor.
public static T Execute<T>(this IExecutor<Unit, T> executor)
Parameters
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
executorIExecutor<(T1, T2), T3>t1T1
Returns
- IExecutor<T2, T3>
Executor waiting for the remaining argument.
Type Parameters
T1T2T3
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
executorIExecutor<(T1, T2), T3>t1T1t2T2
Returns
- T3
Execution result.
Type Parameters
T1T2T3
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
executorIExecutor<(T1, T2, T3), T4>t1T1
Returns
- IExecutor<(T2, T3), T4>
Executor waiting for two remaining arguments.
Type Parameters
T1T2T3T4
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
executorIExecutor<(T1, T2, T3), T4>t1T1t2T2
Returns
- IExecutor<T3, T4>
Executor waiting for the remaining argument.
Type Parameters
T1T2T3T4
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
executorIExecutor<(T1, T2, T3), T4>t1T1t2T2t3T3
Returns
- T4
Execution result.
Type Parameters
T1T2T3T4
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
executorIExecutor<(T1, T2, T3, T4), T5>t1T1
Returns
- IExecutor<(T2, T3, T4), T5>
Executor waiting for three remaining arguments.
Type Parameters
T1T2T3T4T5
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
executorIExecutor<(T1, T2, T3, T4), T5>t1T1t2T2
Returns
- IExecutor<(T3, T4), T5>
Executor waiting for two remaining arguments.
Type Parameters
T1T2T3T4T5
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
executorIExecutor<(T1, T2, T3, T4), T5>t1T1t2T2t3T3
Returns
- IExecutor<T4, T5>
Executor waiting for the remaining argument.
Type Parameters
T1T2T3T4T5
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
executorIExecutor<(T1, T2, T3, T4), T5>t1T1t2T2t3T3t4T4
Returns
- T5
Execution result.
Type Parameters
T1T2T3T4T5
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
executorIExecutor<T1, T2>Source executor.
mapFunc<TFrom, Exception>Function that maps the caught exception to a new exception.
Returns
- IExecutor<T1, T2>
Executor with exception mapping behavior.
Type Parameters
T1T2TFrom
Exceptions
- ArgumentNullException
mapis 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
executorIExecutor<T1, T2>Source executor.
metricsIMetrics<T1, T2>Metrics sink used to record execution information.
tagstringOptional tag passed to all metrics callbacks.
Returns
- IExecutor<T1, T2>
Executor with metrics behavior.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
metricsis 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
Returns
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
Returns
- SuppressExceptionFlattenExecutorProvider<T1, T2>
Provider for selecting exception types to suppress.
Type Parameters
T1T2
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
executorIExecutor<T1, T2>Executor to configure.
Returns
- SuppressExceptionExecutorProvider<T1, T2>
Provider for selecting exception types to suppress.
Type Parameters
T1T2
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
executorIExecutor<T1, T2>Executor producing the observed result.
actionAction<T2>Side-effect action invoked with the produced result.
Returns
- IExecutor<T1, T2>
Executor that preserves the original result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
actionis 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
executorIExecutor<T, Unit>Source executor.
intervalTimeSpanMinimum interval between forwarded executions.
Returns
Type Parameters
T
Exceptions
- ArgumentException
intervalis 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
executorIExecutor<T1, T2>Executor to run inside the context.
initContextInitContext initialization logic.
Returns
- IExecutor<T1, T2>
Executor wrapped with contextual execution.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
initis 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
executorIExecutor<T1, T2>Executor to wrap with policies.
buildingAction<PolicyBuilder<T1, T2>>Builder action that configures policies.
Returns
- IExecutor<T1, T2>
Executor wrapped with configured policies.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
buildingis 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
Returns
- IExecutor<T1, Result<T2>>
Executor that preserves returned results and converts thrown exceptions to failure results.
Type Parameters
T1T2
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
executorIExecutor<T1, T2>Executor to wrap.
Returns
Type Parameters
T1T2