Skip to content

Commit 46dc47f

Browse files
authored
Drop unused ResiliencePipelineREgistri APIs (#1495)
1 parent 57c540d commit 46dc47f

File tree

7 files changed

+48
-249
lines changed

7 files changed

+48
-249
lines changed

src/Polly.Core/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,14 @@ Polly.Registry.ConfigureBuilderContext<TKey>.PipelineKey.get -> TKey
167167
Polly.Registry.ResiliencePipelineProvider<TKey>
168168
Polly.Registry.ResiliencePipelineProvider<TKey>.ResiliencePipelineProvider() -> void
169169
Polly.Registry.ResiliencePipelineRegistry<TKey>
170-
Polly.Registry.ResiliencePipelineRegistry<TKey>.ClearPipelines() -> void
171-
Polly.Registry.ResiliencePipelineRegistry<TKey>.ClearPipelines<TResult>() -> void
172170
Polly.Registry.ResiliencePipelineRegistry<TKey>.GetOrAddPipeline(TKey key, System.Action<Polly.ResiliencePipelineBuilder!, Polly.Registry.ConfigureBuilderContext<TKey>!>! configure) -> Polly.ResiliencePipeline!
173171
Polly.Registry.ResiliencePipelineRegistry<TKey>.GetOrAddPipeline(TKey key, System.Action<Polly.ResiliencePipelineBuilder!>! configure) -> Polly.ResiliencePipeline!
174172
Polly.Registry.ResiliencePipelineRegistry<TKey>.GetOrAddPipeline<TResult>(TKey key, System.Action<Polly.ResiliencePipelineBuilder<TResult>!, Polly.Registry.ConfigureBuilderContext<TKey>!>! configure) -> Polly.ResiliencePipeline<TResult>!
175173
Polly.Registry.ResiliencePipelineRegistry<TKey>.GetOrAddPipeline<TResult>(TKey key, System.Action<Polly.ResiliencePipelineBuilder<TResult>!>! configure) -> Polly.ResiliencePipeline<TResult>!
176-
Polly.Registry.ResiliencePipelineRegistry<TKey>.RemoveBuilder(TKey key) -> bool
177-
Polly.Registry.ResiliencePipelineRegistry<TKey>.RemoveBuilder<TResult>(TKey key) -> bool
178-
Polly.Registry.ResiliencePipelineRegistry<TKey>.RemovePipeline(TKey key) -> bool
179-
Polly.Registry.ResiliencePipelineRegistry<TKey>.RemovePipeline<TResult>(TKey key) -> bool
180174
Polly.Registry.ResiliencePipelineRegistry<TKey>.ResiliencePipelineRegistry() -> void
181175
Polly.Registry.ResiliencePipelineRegistry<TKey>.ResiliencePipelineRegistry(Polly.Registry.ResiliencePipelineRegistryOptions<TKey>! options) -> void
182176
Polly.Registry.ResiliencePipelineRegistry<TKey>.TryAddBuilder(TKey key, System.Action<Polly.ResiliencePipelineBuilder!, Polly.Registry.ConfigureBuilderContext<TKey>!>! configure) -> bool
183177
Polly.Registry.ResiliencePipelineRegistry<TKey>.TryAddBuilder<TResult>(TKey key, System.Action<Polly.ResiliencePipelineBuilder<TResult>!, Polly.Registry.ConfigureBuilderContext<TKey>!>! configure) -> bool
184-
Polly.Registry.ResiliencePipelineRegistry<TKey>.TryAddPipeline(TKey key, Polly.ResiliencePipeline! pipeline) -> bool
185-
Polly.Registry.ResiliencePipelineRegistry<TKey>.TryAddPipeline<TResult>(TKey key, Polly.ResiliencePipeline<TResult>! pipeline) -> bool
186178
Polly.Registry.ResiliencePipelineRegistryOptions<TKey>
187179
Polly.Registry.ResiliencePipelineRegistryOptions<TKey>.BuilderComparer.get -> System.Collections.Generic.IEqualityComparer<TKey>!
188180
Polly.Registry.ResiliencePipelineRegistryOptions<TKey>.BuilderComparer.set -> void

src/Polly.Core/Registry/ResiliencePipelineRegistry.TResult.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ public GenericRegistry(
2828
_instanceNameFormatter = instanceNameFormatter;
2929
}
3030

31-
public bool TryAdd(TKey key, ResiliencePipeline<TResult> strategy) => _strategies.TryAdd(key, strategy);
32-
33-
public bool Remove(TKey key) => _strategies.TryRemove(key, out _);
34-
3531
public bool TryGet(TKey key, [NotNullWhen(true)] out ResiliencePipeline<TResult>? strategy)
3632
{
3733
if (_strategies.TryGetValue(key, out strategy))
@@ -65,9 +61,5 @@ public ResiliencePipeline<TResult> GetOrAdd(TKey key, Action<ResiliencePipelineB
6561
}
6662

6763
public bool TryAddBuilder(TKey key, Action<ResiliencePipelineBuilder<TResult>, ConfigureBuilderContext<TKey>> configure) => _builders.TryAdd(key, configure);
68-
69-
public bool RemoveBuilder(TKey key) => _builders.TryRemove(key, out _);
70-
71-
public void Clear() => _strategies.Clear();
7264
}
7365
}

src/Polly.Core/Registry/ResiliencePipelineRegistry.cs

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -60,50 +60,6 @@ public ResiliencePipelineRegistry(ResiliencePipelineRegistryOptions<TKey> option
6060
_pipelineComparer = options.PipelineComparer;
6161
}
6262

63-
/// <summary>
64-
/// Tries to add an existing resilience pipeline to the registry.
65-
/// </summary>
66-
/// <param name="key">The key used to identify the resilience pipeline.</param>
67-
/// <param name="pipeline">The resilience pipeline instance.</param>
68-
/// <returns><see langword="true"/> if the pipeline was added successfully, <see langword="false"/> otherwise.</returns>
69-
/// <exception cref="ArgumentNullException">Thrown when <paramref name="pipeline"/> is <see langword="null"/>.</exception>
70-
public bool TryAddPipeline(TKey key, ResiliencePipeline pipeline)
71-
{
72-
Guard.NotNull(pipeline);
73-
74-
return _pipelines.TryAdd(key, pipeline);
75-
}
76-
77-
/// <summary>
78-
/// Tries to add an existing generic resilience pipeline to the registry.
79-
/// </summary>
80-
/// <typeparam name="TResult">The type of result that the resilience pipeline handles.</typeparam>
81-
/// <param name="key">The key used to identify the resilience pipeline.</param>
82-
/// <param name="pipeline">The resilience pipeline instance.</param>
83-
/// <returns><see langword="true"/> if the pipeline was added successfully, <see langword="false"/> otherwise.</returns>
84-
/// <exception cref="ArgumentNullException">Thrown when <paramref name="pipeline"/> is <see langword="null"/>.</exception>
85-
public bool TryAddPipeline<TResult>(TKey key, ResiliencePipeline<TResult> pipeline)
86-
{
87-
Guard.NotNull(pipeline);
88-
89-
return GetGenericRegistry<TResult>().TryAdd(key, pipeline);
90-
}
91-
92-
/// <summary>
93-
/// Removes a resilience pipeline from the registry.
94-
/// </summary>
95-
/// <param name="key">The key used to identify the resilience pipeline.</param>
96-
/// <returns><see langword="true"/> if the pipeline was removed successfully, <see langword="false"/> otherwise.</returns>
97-
public bool RemovePipeline(TKey key) => _pipelines.TryRemove(key, out _);
98-
99-
/// <summary>
100-
/// Removes a generic resilience pipeline from the registry.
101-
/// </summary>
102-
/// <typeparam name="TResult">The type of result that the resilience pipeline handles.</typeparam>
103-
/// <param name="key">The key used to identify the resilience pipeline.</param>
104-
/// <returns><see langword="true"/> if the pipeline was removed successfully, <see langword="false"/> otherwise.</returns>
105-
public bool RemovePipeline<TResult>(TKey key) => GetGenericRegistry<TResult>().Remove(key);
106-
10763
/// <inheritdoc/>
10864
public override bool TryGetPipeline<TResult>(TKey key, [NotNullWhen(true)] out ResiliencePipeline<TResult>? pipeline)
10965
{
@@ -232,38 +188,6 @@ public bool TryAddBuilder<TResult>(TKey key, Action<ResiliencePipelineBuilder<TR
232188
return GetGenericRegistry<TResult>().TryAddBuilder(key, configure);
233189
}
234190

235-
/// <summary>
236-
/// Removes a resilience pipeline builder from the registry.
237-
/// </summary>
238-
/// <param name="key">The key used to identify the resilience pipeline builder.</param>
239-
/// <returns><see langword="true"/> if the builder was removed successfully, <see langword="false"/> otherwise.</returns>
240-
public bool RemoveBuilder(TKey key) => _builders.TryRemove(key, out _);
241-
242-
/// <summary>
243-
/// Removes a generic resilience pipeline builder from the registry.
244-
/// </summary>
245-
/// <typeparam name="TResult">The type of result that the resilience pipeline handles.</typeparam>
246-
/// <param name="key">The key used to identify the resilience pipeline builder.</param>
247-
/// <returns><see langword="true"/> if the builder was removed successfully, <see langword="false"/> otherwise.</returns>
248-
public bool RemoveBuilder<TResult>(TKey key) => GetGenericRegistry<TResult>().RemoveBuilder(key);
249-
250-
/// <summary>
251-
/// Clears all cached pipelines.
252-
/// </summary>
253-
/// <remarks>
254-
/// This method only clears the cached pipelines, the registered builders are kept unchanged.
255-
/// </remarks>
256-
public void ClearPipelines() => _pipelines.Clear();
257-
258-
/// <summary>
259-
/// Clears all cached generic pipelines.
260-
/// </summary>
261-
/// <typeparam name="TResult">The type of result that the resilience pipeline handles.</typeparam>
262-
/// <remarks>
263-
/// This method only clears the cached pipelines, the registered builders are kept unchanged.
264-
/// </remarks>
265-
public void ClearPipelines<TResult>() => GetGenericRegistry<TResult>().Clear();
266-
267191
private static PipelineComponent CreatePipelineComponent<TBuilder>(
268192
Func<TBuilder> activator,
269193
ConfigureBuilderContext<TKey> context,

src/Polly.Extensions/DependencyInjection/PollyServiceCollectionExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public static IServiceCollection AddResiliencePipeline<TKey, TResult>(
7676
{
7777
options.Actions.Add((registry) =>
7878
{
79-
// the last added builder with the same key wins, this allows overriding the builders
80-
registry.RemoveBuilder<TResult>(key);
8179
registry.TryAddBuilder<TResult>(key, (builder, context) =>
8280
{
8381
configure(builder, new AddResiliencePipelineContext<TKey>(context, serviceProvider));
@@ -148,7 +146,6 @@ public static IServiceCollection AddResiliencePipeline<TKey>(
148146
options.Actions.Add((registry) =>
149147
{
150148
// the last added builder with the same key wins, this allows overriding the builders
151-
registry.RemoveBuilder(key);
152149
registry.TryAddBuilder(key, (builder, context) =>
153150
{
154151
configure(builder, new AddResiliencePipelineContext<TKey>(context, serviceProvider));

0 commit comments

Comments
 (0)