Skip to content

Commit 7b18976

Browse files
authored
Merge pull request #20 from selfmadecode/feature/code-clean-up
update core services
2 parents 3d39af3 + 11210c2 commit 7b18976

File tree

8 files changed

+5
-32
lines changed

8 files changed

+5
-32
lines changed

src/Throttlr.Api.RateLimit/Abstractions/ISystemClock.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace RateLimit.Throttlr.Abstractions
64
{
75
/// <summary>
86
/// Provides an abstraction for accessing the current UTC system clock.
9-
/// Useful for unit testing and time-based rate limiting algorithms.
107
/// </summary>
118
public interface ISystemClock
129
{

src/Throttlr.Api.RateLimit/Core/Counter/SlidingWindowCounter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42

53
namespace RateLimit.Throttlr.Core.Counter
64
{

src/Throttlr.Api.RateLimit/Core/FixedWindowRateLimiter.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ internal class FixedWindowRateLimiter : IRateLimiter
1818
private readonly ISystemClock _clock;
1919
private readonly RateLimitPolicy _policy;
2020

21-
/// <summary>
22-
/// Initializes a new instance of the <see cref="FixedWindowRateLimiter"/> class.
23-
/// </summary>
24-
/// <param name="store">Backing store for counters.</param>
25-
/// <param name="clock">Clock abstraction for testability.</param>
26-
/// <param name="policy">Rate limit policy definition.</param>
2721
public FixedWindowRateLimiter(
2822
IRateLimitStore store,
2923
ISystemClock clock,

src/Throttlr.Api.RateLimit/Core/RateLimitResult.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace RateLimit.Throttlr.Core
44
{
5+
/// <summary>
6+
/// Represents the result of a rate limit check.
7+
/// </summary>
58
public sealed class RateLimitResult
6-
{
7-
/// <summary>
8-
/// Represents the result of a rate limit check.
9-
/// </summary>
9+
{
1010
private RateLimitResult(bool isAllowed, int? retryAfterSeconds = null)
1111
{
1212
IsAllowed = isAllowed;

src/Throttlr.Api.RateLimit/Core/SlidingWindowRateLimiter.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ internal class SlidingWindowRateLimiter : IRateLimiter
1818
private readonly ISystemClock _clock;
1919
private readonly RateLimitPolicy _policy;
2020

21-
/// <summary>
22-
/// Initializes a new instance of the <see cref="SlidingWindowRateLimiter"/> class.
23-
/// </summary>
2421
public SlidingWindowRateLimiter(
2522
IRateLimitStore store,
2623
ISystemClock clock,
@@ -31,7 +28,6 @@ public SlidingWindowRateLimiter(
3128
_policy = policy ?? throw new ArgumentNullException(nameof(policy));
3229
}
3330

34-
/// <inheritdoc />
3531
/// <inheritdoc />
3632
public async Task<RateLimitResult> ShouldLimitAsync(
3733
string key,

src/Throttlr.Api.RateLimit/Core/Store/InMemoryRateLimitStore.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ namespace RateLimit.Throttlr.Core.Store
1313
internal class InMemoryRateLimitStore : IRateLimitStore
1414
{
1515
private readonly ConcurrentDictionary<string, RateLimitCounter> _counters;
16-
17-
/// <summary>
18-
/// Initializes a new instance of the <see cref="InMemoryRateLimitStore"/> class.
19-
/// </summary>
16+
2017
public InMemoryRateLimitStore()
2118
{
2219
_counters = new ConcurrentDictionary<string, RateLimitCounter>(

src/Throttlr.Api.RateLimit/Core/SystemClock.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55

66
namespace RateLimit.Throttlr.Core
77
{
8-
/// <summary>
9-
/// Default implementation of <see cref="ISystemClock"/> that uses <see cref="DateTimeOffset.UtcNow"/>.
10-
/// </summary>
118
public sealed class SystemClock : ISystemClock
129
{
1310
/// <inheritdoc />

src/Throttlr.Api.RateLimit/Core/TokenBucketRateLimiter.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ public sealed class TokenBucketRateLimiter : IRateLimiter
2020
private readonly int _capacity;
2121
private readonly double _tokensPerSecond;
2222

23-
/// <summary>
24-
/// Initializes a new instance of the <see cref="TokenBucketRateLimiter"/> class.
25-
/// </summary>
26-
/// <param name="store">The rate limit store.</param>
27-
/// <param name="policy">The rate limit policy.</param>
28-
/// <param name="clock">The system clock.</param>
2923
public TokenBucketRateLimiter(
3024
IRateLimitStore store,
3125
ISystemClock clock,

0 commit comments

Comments
 (0)