Skip to content

Commit

Permalink
Initial API Review (1) (#1185)
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk authored May 15, 2023
1 parent 3ff908a commit e6b3e00
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ public abstract class BaseCircuitBreakerStrategyOptions<TResult> : ResilienceStr
/// Gets or sets the manual control for the circuit breaker.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>.
/// Defaults to <see langword="null"/>.
/// </remarks>
public CircuitBreakerManualControl? ManualControl { get; set; }

/// <summary>
/// Gets or sets the state provider for the circuit breaker.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>.
/// Defaults to <see langword="null"/>.
/// </remarks>
public CircuitBreakerStateProvider? StateProvider { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ public abstract class BaseCircuitBreakerStrategyOptions : ResilienceStrategyOpti
/// Gets or sets the manual control for the circuit breaker.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>.
/// Defaults to <see langword="null"/>.
/// </remarks>
public CircuitBreakerManualControl? ManualControl { get; set; }

/// <summary>
/// Gets or sets the state provider for the circuit breaker.
/// </summary>
/// <remarks>
/// Defaults to <c>null</c>.
/// Defaults to <see langword="null"/>.
/// </remarks>
public CircuitBreakerStateProvider? StateProvider { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Core/CircuitBreaker/CircuitBreakerManualControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Task IsolateAsync(ResilienceContext context)
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The instance of <see cref="Task"/> that represents the asynchronous execution.</returns>
/// <exception cref="InvalidOperationException">Thrown if manual control is not initialized.</exception>
public async Task IsolateAsync(CancellationToken cancellationToken)
public async Task IsolateAsync(CancellationToken cancellationToken = default)
{
var context = ResilienceContext.Get();
context.CancellationToken = cancellationToken;
Expand Down Expand Up @@ -97,7 +97,7 @@ public Task CloseAsync(ResilienceContext context)
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The instance of <see cref="Task"/> that represents the asynchronous execution.</returns>
/// <exception cref="InvalidOperationException">Thrown if manual control is not initialized.</exception>
public async Task CloseAsync(CancellationToken cancellationToken)
public async Task CloseAsync(CancellationToken cancellationToken = default)
{
var context = ResilienceContext.Get();
context.CancellationToken = cancellationToken;
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Fallback/FallbackHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed partial class FallbackHandler
/// <summary>
/// Gets a value indicating whether the fallback handler is empty.
/// </summary>
public bool IsEmpty => _predicates.IsEmpty;
internal bool IsEmpty => _predicates.IsEmpty;

/// <summary>
/// Configures a fallback handler for a specific result type.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Fallback/FallbackStrategyOptions.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FallbackStrategyOptions<TResult> : ResilienceStrategyOptions
/// Gets or sets the fallback action to be executed if the <see cref="ShouldHandle"/> predicate evaluates as true.
/// </summary>
/// <remarks>
/// This property is required. Defaults to <c>null</c>.
/// This property is required. Defaults to <see langword="null"/>.
/// </remarks>
[Required]
public FallbackAction<TResult>? FallbackAction { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Hedging/HedgingActionGenerator.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Polly.Hedging;
/// <param name="arguments">The arguments passed to the generator.</param>
/// <returns>A <see cref="Task{TResult}"/> that represents an asynchronous operation.</returns>
/// <remarks>
/// The generator can return a <c>null</c> function. In that case the hedging is not executed for that attempt.
/// The generator can return a <see langword="null"/> function. In that case the hedging is not executed for that attempt.
/// Make sure that the returned action represents a real asynchronous work when invoked.
/// </remarks>
public delegate Func<Task<TResult>>? HedgingActionGenerator<TResult>(HedgingActionGeneratorArguments<TResult> arguments);
2 changes: 1 addition & 1 deletion src/Polly.Core/Hedging/HedgingActionGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Polly.Hedging;
/// <param name="arguments">The arguments passed to the generator.</param>
/// <returns>A <see cref="Task"/> that represents an asynchronous operation.</returns>
/// <remarks>
/// The generator can return a <c>null</c> function. In that case the hedging is not executed for that attempt.
/// The generator can return a <see langword="null"/> function. In that case the hedging is not executed for that attempt.
/// Make sure that the returned action represents a real asynchronous work when invoked.
/// </remarks>
public delegate Func<Task>? HedgingActionGenerator(HedgingActionGeneratorArguments arguments);
2 changes: 1 addition & 1 deletion src/Polly.Core/Hedging/HedgingHandler.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public sealed class HedgingHandler<TResult>
/// Gets or sets the hedging action generator that creates hedged actions.
/// </summary>
/// <remarks>
/// This property is required. Defaults to <c>null</c>.
/// This property is required. Defaults to <see langword="null"/>.
/// </remarks>
[Required]
public HedgingActionGenerator<TResult>? HedgingActionGenerator { get; set; } = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Hedging/HedgingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed partial class HedgingHandler
/// <summary>
/// Gets a value indicating whether the hedging handler is empty.
/// </summary>
public bool IsEmpty => _actions.Count == 0;
internal bool IsEmpty => _actions.Count == 0;

/// <summary>
/// Configures a hedging handler for a specific result type.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Hedging/VoidHedgingHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class VoidHedgingHandler
/// Gets or sets the hedging action generator that creates hedged actions.
/// </summary>
/// <remarks>
/// This property is required. Defaults to <c>null</c>.
/// This property is required. Defaults to <see langword="null"/>.
/// </remarks>
[Required]
public HedgingActionGenerator? HedgingActionGenerator { get; set; } = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/ResilienceStrategy.Async.Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static async (context, state) =>
public async Task ExecuteAsync<TState>(
Func<TState, CancellationToken, Task> callback,
TState state,
CancellationToken cancellationToken)
CancellationToken cancellationToken = default)
{
Guard.NotNull(callback);

Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/ResilienceStrategy.Async.TaskT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static async (context, state) =>
public async Task<TResult> ExecuteAsync<TResult, TState>(
Func<TState, CancellationToken, Task<TResult>> callback,
TState state,
CancellationToken cancellationToken)
CancellationToken cancellationToken = default)
{
Guard.NotNull(callback);

Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/ResilienceStrategy.SyncT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public TResult Execute<TResult, TState>(Func<TState, TResult> callback, TState s
public TResult Execute<TResult, TState>(
Func<TState, CancellationToken, TResult> callback,
TState state,
CancellationToken cancellationToken)
CancellationToken cancellationToken = default)
{
Guard.NotNull(callback);

Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/NoOutcomeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class NoOutcomeEvent<TArgs>
/// <summary>
/// Gets a value indicating whether the event is empty.
/// </summary>
public bool IsEmpty => _callbacks.Count == 0;
internal bool IsEmpty => _callbacks.Count == 0;

/// <summary>
/// Adds an asynchronous event callback.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/NoOutcomeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed class NoOutcomeGenerator<TArgs, TValue>
/// <summary>
/// Gets a value indicating whether the generator is empty.
/// </summary>
public bool IsEmpty => _generator is null;
internal bool IsEmpty => _generator is null;

/// <summary>
/// Adds a result generator.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/Outcome.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Outcome(TResult result)
/// Gets a value indicating whether the operation produced a result.
/// </summary>
/// <remarks>
/// If the operation returned a void result the value will be <c>true</c>.
/// If the operation returned a void result the value will be <see langword="true"/>.
/// You can use <see cref="IsVoidResult"/> to determine if the result is a void result.
/// </remarks>
public bool HasResult => Exception == null;
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/Outcome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public Outcome(Type resultType, object? result)
/// Gets a value indicating whether the operation produced a result.
/// </summary>
/// <remarks>
/// If the operation returned a void result the value will be <c>true</c>.
/// If the operation returned a void result the value will be <see langword="true"/>.
/// You can use <see cref="IsVoidResult"/> to determine if the result is a void result.
/// </remarks>
public bool HasResult => Exception == null;
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Core/Strategy/OutcomeEvent.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class OutcomeEvent<TArgs, TResult>
/// <summary>
/// Gets a value indicating whether the event is empty.
/// </summary>
public bool IsEmpty => _callbacks.Count == 0;
internal bool IsEmpty => _callbacks.Count == 0;

/// <summary>
/// Registers a callback for the specified result type.
Expand Down Expand Up @@ -83,7 +83,7 @@ public OutcomeEvent<TArgs, TResult> Register(Func<Outcome<TResult>, TArgs, Value
/// <summary>
/// Creates a handler that invokes the registered event callbacks.
/// </summary>
/// <returns>Handler instance or <c>null</c> if no callbacks are registered.</returns>
/// <returns>Handler instance or <see langword="null"/> if no callbacks are registered.</returns>
public Func<Outcome<TResult>, TArgs, ValueTask>? CreateHandler()
{
return _callbacks.Count switch
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Core/Strategy/OutcomeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed partial class OutcomeEvent<TArgs>
/// <summary>
/// Gets a value indicating whether the event is empty.
/// </summary>
public bool IsEmpty => _callbacks.Count == 0;
internal bool IsEmpty => _callbacks.Count == 0;

/// <summary>
/// Registers a callback for the specified result type.
Expand Down Expand Up @@ -157,7 +157,7 @@ public OutcomeEvent<TArgs> SetCallbacks<TResult>(OutcomeEvent<TArgs, TResult> ca
/// <summary>
/// Creates an event handler.
/// </summary>
/// <returns>Handler instance or <c>null</c> if no callbacks are registered.</returns>
/// <returns>Handler instance or <see langword="null"/> if no callbacks are registered.</returns>
public Handler? CreateHandler()
{
var pairs = _callbacks
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/OutcomeGenerator.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public sealed class OutcomeGenerator<TArgs, TValue, TResult>
/// <summary>
/// Gets a value indicating whether the generator is empty.
/// </summary>
public bool IsEmpty => _generator is null;
internal bool IsEmpty => _generator is null;

/// <summary>
/// Sets a result generator for a specific result type.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/OutcomeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class OutcomeGenerator<TArgs, TValue>
/// <summary>
/// Gets a value indicating whether the generator is empty.
/// </summary>
public bool IsEmpty => _generators.Count == 0;
internal bool IsEmpty => _generators.Count == 0;

/// <summary>
/// Sets a result generator for a specific result type.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/OutcomePredicate.TResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public sealed class OutcomePredicate<TArgs, TResult>
/// <summary>
/// Gets a value indicating whether the predicate is empty.
/// </summary>
public bool IsEmpty => _predicates.Count == 0;
internal bool IsEmpty => _predicates.Count == 0;

/// <summary>
/// Adds an exception predicate for the specified exception type.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/OutcomePredicate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class OutcomePredicate<TArgs>
/// <summary>
/// Gets a value indicating whether the predicate is empty.
/// </summary>
public bool IsEmpty => _predicates.Count == 0;
internal bool IsEmpty => _predicates.Count == 0;

/// <summary>
/// Adds an exception predicate for the specified exception type.
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Core/Strategy/VoidOutcomeEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class VoidOutcomeEvent<TArgs>
/// <summary>
/// Gets a value indicating whether the event is empty.
/// </summary>
public bool IsEmpty => _callbacks.Count == 0;
internal bool IsEmpty => _callbacks.Count == 0;

/// <summary>
/// Registers a callback for void-based results.
Expand Down Expand Up @@ -82,7 +82,7 @@ public VoidOutcomeEvent<TArgs> Register(Func<Outcome, TArgs, ValueTask> callback
/// <summary>
/// Creates a handler that invokes the registered event callbacks.
/// </summary>
/// <returns>Handler instance or <c>null</c> if no callbacks are registered.</returns>
/// <returns>Handler instance or <see langword="null"/> if no callbacks are registered.</returns>
public Func<Outcome, TArgs, ValueTask>? CreateHandler()
{
return _callbacks.Count switch
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/VoidOutcomeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed class VoidOutcomeGenerator<TArgs, TValue>
/// <summary>
/// Gets a value indicating whether the generator is empty.
/// </summary>
public bool IsEmpty => _generator is null;
internal bool IsEmpty => _generator is null;

/// <summary>
/// Sets a result generator.
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Core/Strategy/VoidOutcomePredicate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed class VoidOutcomePredicate<TArgs>
/// <summary>
/// Gets a value indicating whether the predicate is empty.
/// </summary>
public bool IsEmpty => _predicates.Count == 0;
internal bool IsEmpty => _predicates.Count == 0;

/// <summary>
/// Adds an exception predicate for void-based results.
Expand Down

0 comments on commit e6b3e00

Please sign in to comment.