Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Aug 17, 2023
1 parent 9f158f8 commit d09f162
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Polly.Core/Registry/ResiliencePipelineProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public abstract class ResiliencePipelineProvider<TKey>
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <returns>The resilience pipeline associated with the specified key.</returns>
/// <exception cref="KeyNotFoundException">Thrown when no resilience pipeline is found for the specified key.</exception>
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
public virtual ResiliencePipeline GetPipeline(TKey key)
{
if (TryGetPipeline(key, out var pipeline))
Expand All @@ -35,6 +36,7 @@ public virtual ResiliencePipeline GetPipeline(TKey key)
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <returns>The resilience pipeline associated with the specified key.</returns>
/// <exception cref="KeyNotFoundException">Thrown when no resilience pipeline is found for the specified key.</exception>
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
{
if (TryGetPipeline<TResult>(key, out var pipeline))
Expand All @@ -52,6 +54,7 @@ public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="pipeline">The output resilience pipeline if found, <see langword="null"/> otherwise.</param>
/// <returns><see langword="true"/> if the pipeline was found, <see langword="false"/> otherwise.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
public abstract bool TryGetPipeline(TKey key, [NotNullWhen(true)] out ResiliencePipeline? pipeline);

/// <summary>
Expand All @@ -61,5 +64,6 @@ public virtual ResiliencePipeline<TResult> GetPipeline<TResult>(TKey key)
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="pipeline">The output resilience pipeline if found, <see langword="null"/> otherwise.</param>
/// <returns><see langword="true"/> if the pipeline was found, <see langword="false"/> otherwise.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the provider is already disposed.</exception>
public abstract bool TryGetPipeline<TResult>(TKey key, [NotNullWhen(true)] out ResiliencePipeline<TResult>? pipeline);
}
23 changes: 21 additions & 2 deletions src/Polly.Core/Registry/ResiliencePipelineRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public override bool TryGetPipeline(TKey key, [NotNullWhen(true)] out Resilience
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="configure">The callback that configures the pipeline builder.</param>
/// <returns>An instance of pipeline.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBuilder> configure)
{
Guard.NotNull(configure);
Expand All @@ -110,6 +111,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBu
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="configure">The callback that configures the pipeline builder.</param>
/// <returns>An instance of pipeline.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBuilder, ConfigureBuilderContext<TKey>> configure)
{
Guard.NotNull(configure);
Expand Down Expand Up @@ -141,6 +143,7 @@ public ResiliencePipeline GetOrAddPipeline(TKey key, Action<ResiliencePipelineBu
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="configure">The callback that configures the pipeline builder.</param>
/// <returns>An instance of pipeline.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>> configure)
{
Guard.NotNull(configure);
Expand All @@ -157,6 +160,7 @@ public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<Re
/// <param name="key">The key used to identify the resilience pipeline.</param>
/// <param name="configure">The callback that configures the pipeline builder.</param>
/// <returns>An instance of pipeline.</returns>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>, ConfigureBuilderContext<TKey>> configure)
{
Guard.NotNull(configure);
Expand All @@ -176,6 +180,7 @@ public ResiliencePipeline<TResult> GetOrAddPipeline<TResult>(TKey key, Action<Re
/// Use this method when you want to create the pipeline on-demand when it's first accessed.
/// </remarks>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="configure"/> is <see langword="null"/>.</exception>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public bool TryAddBuilder(TKey key, Action<ResiliencePipelineBuilder, ConfigureBuilderContext<TKey>> configure)
{
Guard.NotNull(configure);
Expand All @@ -196,6 +201,7 @@ public bool TryAddBuilder(TKey key, Action<ResiliencePipelineBuilder, ConfigureB
/// Use this method when you want to create the pipeline on-demand when it's first accessed.
/// </remarks>
/// <exception cref="ArgumentNullException">Thrown when <paramref name="configure"/> is <see langword="null"/>.</exception>
/// <exception cref="ObjectDisposedException">Thrown when the registry is already disposed.</exception>
public bool TryAddBuilder<TResult>(TKey key, Action<ResiliencePipelineBuilder<TResult>, ConfigureBuilderContext<TKey>> configure)
{
Guard.NotNull(configure);
Expand All @@ -205,7 +211,13 @@ public bool TryAddBuilder<TResult>(TKey key, Action<ResiliencePipelineBuilder<TR
return GetGenericRegistry<TResult>().TryAddBuilder(key, configure);
}

/// <inheritdoc/>
/// <summary>
/// Disposes all resources that are held by the resilience pipelines created by this builder.
/// </summary>
/// <remarks>
/// After the disposal, all resilience pipelines still used outside of the builder are disposed
/// and cannot be used anymore.
/// </remarks>
public void Dispose()
{
_disposed = true;
Expand All @@ -225,7 +237,14 @@ public void Dispose()
_genericRegistry.Clear();
}

/// <inheritdoc/>
/// <summary>
/// Disposes all resources that are held by the resilience pipelines created by this builder.
/// </summary>
/// <returns>Returns a task that represents the asynchronous dispose operation.</returns>
/// <remarks>
/// After the disposal, all resilience pipelines still used outside of the builder are disposed
/// and cannot be used anymore.
/// </remarks>
public async ValueTask DisposeAsync()
{
_disposed = true;
Expand Down

0 comments on commit d09f162

Please sign in to comment.