diff --git a/src/Polly.Core/PublicAPI.Unshipped.txt b/src/Polly.Core/PublicAPI.Unshipped.txt index 301559bd107..89510909755 100644 --- a/src/Polly.Core/PublicAPI.Unshipped.txt +++ b/src/Polly.Core/PublicAPI.Unshipped.txt @@ -1,4 +1,5 @@ -abstract Polly.Registry.ResilienceStrategyProvider.TryGetStrategy(TKey key, out Polly.ResilienceStrategy? strategy) -> bool +abstract Polly.ReactiveResilienceStrategy.ExecuteCore(System.Func>>! callback, Polly.ResilienceContext! context, TState state) -> System.Threading.Tasks.ValueTask> +abstract Polly.Registry.ResilienceStrategyProvider.TryGetStrategy(TKey key, out Polly.ResilienceStrategy? strategy) -> bool abstract Polly.Registry.ResilienceStrategyProvider.TryGetStrategy(TKey key, out Polly.ResilienceStrategy? strategy) -> bool abstract Polly.ResilienceContextPool.Get(string? operationKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Polly.ResilienceContext! abstract Polly.ResilienceContextPool.Return(Polly.ResilienceContext! context) -> void @@ -10,6 +11,7 @@ override Polly.ResiliencePropertyKey.Equals(object? obj) -> bool override Polly.ResiliencePropertyKey.GetHashCode() -> int override Polly.ResiliencePropertyKey.ToString() -> string! override Polly.Telemetry.ResilienceEvent.ToString() -> string! +override sealed Polly.ReactiveResilienceStrategy.ExecuteCore(System.Func>>! callback, Polly.ResilienceContext! context, TState state) -> System.Threading.Tasks.ValueTask> Polly.CircuitBreaker.BrokenCircuitException Polly.CircuitBreaker.BrokenCircuitException.BrokenCircuitException() -> void Polly.CircuitBreaker.BrokenCircuitException.BrokenCircuitException(string! message) -> void @@ -177,6 +179,8 @@ Polly.PredicateBuilder.HandleResult(System.Func! predica Polly.PredicateBuilder.HandleResult(TResult result, System.Collections.Generic.IEqualityComparer? comparer = null) -> Polly.PredicateBuilder! Polly.PredicateBuilder.PredicateBuilder() -> void Polly.PredicateResult +Polly.ReactiveResilienceStrategy +Polly.ReactiveResilienceStrategy.ReactiveResilienceStrategy() -> void Polly.Registry.ConfigureBuilderContext Polly.Registry.ConfigureBuilderContext.BuilderInstanceName.get -> string? Polly.Registry.ConfigureBuilderContext.BuilderName.get -> string! diff --git a/src/Polly.Core/ReactiveResilienceStrategy.cs b/src/Polly.Core/ReactiveResilienceStrategy.cs index 9bbc728e7f7..c8d8c51a3e9 100644 --- a/src/Polly.Core/ReactiveResilienceStrategy.cs +++ b/src/Polly.Core/ReactiveResilienceStrategy.cs @@ -2,14 +2,43 @@ /// /// This base strategy class is used to simplify the implementation of generic (reactive) -/// strategies by limiting the number of generic types this strategy receives. +/// strategies by limiting the number of generic types the execute method receives. /// /// The type of result this strategy handles. /// /// For strategies that handle all result types the generic parameter must be of type . /// -internal abstract class ReactiveResilienceStrategy : ResilienceStrategy +public abstract class ReactiveResilienceStrategy : ResilienceStrategy { + /// + /// An implementation of resilience strategy that executes the specified . + /// + /// The type of state associated with the callback. + /// The user-provided callback. + /// The context associated with the callback. + /// The state associated with the callback. + /// + /// An instance of a pending for asynchronous executions or a completed task for synchronous executions. + /// + /// + /// This method is called for both synchronous and asynchronous execution flows. + /// + /// You can use to determine whether is synchronous or asynchronous. + /// This is useful when the custom strategy behaves differently in each execution flow. In general, for most strategies, the implementation + /// is the same for both execution flows. + /// See for more details. + /// + /// + /// The provided callback never throws an exception. Instead, the exception is captured and converted to an . + /// Similarly, do not throw exceptions from your strategy implementation. Instead, return an exception instance as . + /// + /// + protected abstract ValueTask> ExecuteCore( + Func>> callback, + ResilienceContext context, + TState state); + + /// protected internal sealed override ValueTask> ExecuteCore( Func>> callback, ResilienceContext context, @@ -36,9 +65,4 @@ static async (context, state) => return TaskHelper.ConvertValueTask(valueTask, context); } } - - protected abstract ValueTask> ExecuteCore( - Func>> callback, - ResilienceContext context, - TState state); } diff --git a/src/Polly.Core/ResilienceStrategy.cs b/src/Polly.Core/ResilienceStrategy.cs index 7aa1635271d..6556c3efd30 100644 --- a/src/Polly.Core/ResilienceStrategy.cs +++ b/src/Polly.Core/ResilienceStrategy.cs @@ -24,12 +24,12 @@ public abstract partial class ResilienceStrategy /// The context associated with the callback. /// The state associated with the callback. /// - /// An instance of pending for asynchronous executions or completed task for synchronous executions. + /// An instance of a pending for asynchronous executions or a completed task for synchronous executions. /// /// /// This method is called for both synchronous and asynchronous execution flows. /// - /// You can use to determine whether the is synchronous or asynchronous one. + /// You can use to determine whether is synchronous or asynchronous. /// This is useful when the custom strategy behaves differently in each execution flow. In general, for most strategies, the implementation /// is the same for both execution flows. /// See for more details. diff --git a/src/Polly.Core/Utils/ResilienceStrategyPipeline.DebuggerProxy.cs b/src/Polly.Core/Utils/CompositeResilienceStrategy.DebuggerProxy.cs similarity index 100% rename from src/Polly.Core/Utils/ResilienceStrategyPipeline.DebuggerProxy.cs rename to src/Polly.Core/Utils/CompositeResilienceStrategy.DebuggerProxy.cs