Skip to content

Commit c57606c

Browse files
committed
cleanup, CI, [SER008]
1 parent 31360d3 commit c57606c

10 files changed

Lines changed: 81 additions & 47 deletions

File tree

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1111
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)Shared.ruleset</CodeAnalysisRuleset>
1212
<MSBuildWarningsAsMessages>NETSDK1069</MSBuildWarningsAsMessages>
13-
<NoWarn>$(NoWarn);NU5105;NU1507;SER001;SER002;SER003;SER004;SER005</NoWarn>
13+
<NoWarn>$(NoWarn);NU5105;NU1507;SER001;SER002;SER003;SER004;SER005;SER008</NoWarn>
1414
<PackageReleaseNotes>https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes</PackageReleaseNotes>
1515
<PackageProjectUrl>https://stackexchange.github.io/StackExchange.Redis/</PackageProjectUrl>
1616
<PackageLicenseExpression>MIT</PackageLicenseExpression>

docs/exp/SER008.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Redis 8.8 is currently in preview and may be subject to change.
2+
3+
New features in Redis 8.8 include:
4+
5+
- `GCRA` for implementing rate limiting
6+
7+
The corresponding library feature must also be considered subject to change:
8+
9+
1. Existing bindings may cease working correctly if the underlying server API changes.
10+
2. Changes to the server API may require changes to the library API, manifesting in either/both of build-time
11+
or run-time breaks.
12+
13+
While this seems *unlikely*, it must be considered a possibility. If you acknowledge this, you can suppress
14+
this warning by adding the following to your `csproj` file:
15+
16+
```xml
17+
<NoWarn>$(NoWarn);SER008</NoWarn>
18+
```
19+
20+
or more granularly / locally in C#:
21+
22+
``` c#
23+
#pragma warning disable SER008
24+
```

src/RESPite/Shared/Experiments.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ internal static class Experiments
1111
public const string VectorSets = "SER001";
1212
public const string Server_8_4 = "SER002";
1313
public const string Server_8_6 = "SER003";
14+
1415
public const string Respite = "SER004";
1516
public const string UnitTesting = "SER005";
17+
18+
public const string Server_8_8 = "SER008";
1619
// ReSharper restore InconsistentNaming
1720
}
1821
}

src/StackExchange.Redis/ExtensionMethods.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Text;
1010
using System.Threading;
1111
using System.Threading.Tasks;
12+
using RESPite;
1213

1314
namespace StackExchange.Redis
1415
{
@@ -343,6 +344,7 @@ internal static int VectorSafeIndexOfCRLF(this ReadOnlySpan<byte> span)
343344
/// <param name="flags">The command flags to use.</param>
344345
/// <param name="cancellationToken">The cancellation token.</param>
345346
/// <returns>True if the token was acquired within the allowed time; false otherwise.</returns>
347+
[Experimental(Experiments.Server_8_8, UrlFormat = Experiments.UrlFormat)]
346348
public static async ValueTask<bool> TryAcquireGcraAsync(
347349
this IDatabaseAsync database,
348350
RedisKey key,

src/StackExchange.Redis/Gcra.ResultProcessor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
using RESPite;
13
using RESPite.Messages;
24

35
namespace StackExchange.Redis;
46

7+
[Experimental(Experiments.Server_8_8, UrlFormat = Experiments.UrlFormat)]
58
public readonly partial struct GcraRateLimitResult
69
{
710
internal static readonly ResultProcessor<GcraRateLimitResult> Processor = new GcraRateLimitResultProcessor();

src/StackExchange.Redis/Interfaces/IDatabase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,6 +3265,7 @@ IEnumerable<SortedSetEntry> SortedSetScan(
32653265
/// <param name="flags">The flags to use for this operation.</param>
32663266
/// <returns>A <see cref="GcraRateLimitResult"/> containing the rate limit decision and metadata.</returns>
32673267
/// <remarks><seealso href="https://redis.io/commands/gcra"/></remarks>
3268+
[Experimental(Experiments.Server_8_8, UrlFormat = Experiments.UrlFormat)]
32683269
GcraRateLimitResult StringGcraRateLimit(RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1.0, int count = 1, CommandFlags flags = CommandFlags.None);
32693270

32703271
/// <summary>

src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ IAsyncEnumerable<SortedSetEntry> SortedSetScanAsync(
796796
Task<ValueCondition?> StringDigestAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
797797

798798
/// <inheritdoc cref="IDatabase.StringGcraRateLimit(RedisKey, int, int, double, int, CommandFlags)"/>
799+
[Experimental(Experiments.Server_8_8, UrlFormat = Experiments.UrlFormat)]
799800
Task<GcraRateLimitResult> StringGcraRateLimitAsync(RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1.0, int count = 1, CommandFlags flags = CommandFlags.None);
800801

801802
/// <inheritdoc cref="IDatabase.StringGet(RedisKey, CommandFlags)"/>

src/StackExchange.Redis/PublicAPI/PublicAPI.Shipped.txt

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,6 @@ StackExchange.Redis.GeoUnit.Feet = 3 -> StackExchange.Redis.GeoUnit
481481
StackExchange.Redis.GeoUnit.Kilometers = 1 -> StackExchange.Redis.GeoUnit
482482
StackExchange.Redis.GeoUnit.Meters = 0 -> StackExchange.Redis.GeoUnit
483483
StackExchange.Redis.GeoUnit.Miles = 2 -> StackExchange.Redis.GeoUnit
484-
StackExchange.Redis.GcraRateLimitResult
485-
StackExchange.Redis.GcraRateLimitResult.AvailableRequests.get -> int
486-
StackExchange.Redis.GcraRateLimitResult.FullBurstAfterSeconds.get -> int
487-
StackExchange.Redis.GcraRateLimitResult.GcraRateLimitResult() -> void
488-
StackExchange.Redis.GcraRateLimitResult.GcraRateLimitResult(bool limited, int maxRequests, int availableRequests, int retryAfterSeconds, int fullBurstAfterSeconds) -> void
489-
StackExchange.Redis.GcraRateLimitResult.Limited.get -> bool
490-
StackExchange.Redis.GcraRateLimitResult.MaxRequests.get -> int
491-
StackExchange.Redis.GcraRateLimitResult.RetryAfterSeconds.get -> int
492484
StackExchange.Redis.HashEntry
493485
StackExchange.Redis.HashEntry.Equals(StackExchange.Redis.HashEntry other) -> bool
494486
StackExchange.Redis.HashEntry.HashEntry() -> void
@@ -785,7 +777,6 @@ StackExchange.Redis.IDatabase.StringGetSet(StackExchange.Redis.RedisKey key, Sta
785777
StackExchange.Redis.IDatabase.StringGetSetExpiry(StackExchange.Redis.RedisKey key, System.TimeSpan? expiry, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.RedisValue
786778
StackExchange.Redis.IDatabase.StringGetSetExpiry(StackExchange.Redis.RedisKey key, System.DateTime expiry, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.RedisValue
787779
StackExchange.Redis.IDatabase.StringGetWithExpiry(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.RedisValueWithExpiry
788-
StackExchange.Redis.IDatabase.StringGcraRateLimit(StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.GcraRateLimitResult
789780
StackExchange.Redis.IDatabase.StringIncrement(StackExchange.Redis.RedisKey key, double value, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> double
790781
StackExchange.Redis.IDatabase.StringIncrement(StackExchange.Redis.RedisKey key, long value = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> long
791782
StackExchange.Redis.IDatabase.StringLength(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> long
@@ -1030,7 +1021,6 @@ StackExchange.Redis.IDatabaseAsync.StringGetSetAsync(StackExchange.Redis.RedisKe
10301021
StackExchange.Redis.IDatabaseAsync.StringGetSetExpiryAsync(StackExchange.Redis.RedisKey key, System.TimeSpan? expiry, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.RedisValue>!
10311022
StackExchange.Redis.IDatabaseAsync.StringGetSetExpiryAsync(StackExchange.Redis.RedisKey key, System.DateTime expiry, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.RedisValue>!
10321023
StackExchange.Redis.IDatabaseAsync.StringGetWithExpiryAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.RedisValueWithExpiry>!
1033-
StackExchange.Redis.IDatabaseAsync.StringGcraRateLimitAsync(StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.GcraRateLimitResult>!
10341024
StackExchange.Redis.IDatabaseAsync.StringIncrementAsync(StackExchange.Redis.RedisKey key, double value, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<double>!
10351025
StackExchange.Redis.IDatabaseAsync.StringIncrementAsync(StackExchange.Redis.RedisKey key, long value = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<long>!
10361026
StackExchange.Redis.IDatabaseAsync.StringLengthAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<long>!
@@ -1720,7 +1710,6 @@ static StackExchange.Redis.ExtensionMethods.ToStringArray(this StackExchange.Red
17201710
static StackExchange.Redis.ExtensionMethods.ToStringDictionary(this StackExchange.Redis.HashEntry[]? hash) -> System.Collections.Generic.Dictionary<string!, string!>?
17211711
static StackExchange.Redis.ExtensionMethods.ToStringDictionary(this StackExchange.Redis.SortedSetEntry[]? sortedSet) -> System.Collections.Generic.Dictionary<string!, double>?
17221712
static StackExchange.Redis.ExtensionMethods.ToStringDictionary(this System.Collections.Generic.KeyValuePair<StackExchange.Redis.RedisKey, StackExchange.Redis.RedisValue>[]? pairs) -> System.Collections.Generic.Dictionary<string!, string!>?
1723-
static StackExchange.Redis.ExtensionMethods.TryAcquireGcraAsync(this StackExchange.Redis.IDatabaseAsync! database, StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, System.TimeSpan allow, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<bool>
17241713
static StackExchange.Redis.GeoEntry.operator !=(StackExchange.Redis.GeoEntry x, StackExchange.Redis.GeoEntry y) -> bool
17251714
static StackExchange.Redis.GeoEntry.operator ==(StackExchange.Redis.GeoEntry x, StackExchange.Redis.GeoEntry y) -> bool
17261715
static StackExchange.Redis.GeoPosition.operator !=(StackExchange.Redis.GeoPosition x, StackExchange.Redis.GeoPosition y) -> bool
@@ -2286,3 +2275,48 @@ StackExchange.Redis.Lease<T>.IsEmpty.get -> bool
22862275
[SER001]StackExchange.Redis.IDatabase.VectorSetRangeEnumerate(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue start = default(StackExchange.Redis.RedisValue), StackExchange.Redis.RedisValue end = default(StackExchange.Redis.RedisValue), long count = 100, StackExchange.Redis.Exclude exclude = StackExchange.Redis.Exclude.None, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Collections.Generic.IEnumerable<StackExchange.Redis.RedisValue>!
22872276
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetRangeAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue start = default(StackExchange.Redis.RedisValue), StackExchange.Redis.RedisValue end = default(StackExchange.Redis.RedisValue), long count = -1, StackExchange.Redis.Exclude exclude = StackExchange.Redis.Exclude.None, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.Lease<StackExchange.Redis.RedisValue>?>!
22882277
[SER001]StackExchange.Redis.IDatabaseAsync.VectorSetRangeEnumerateAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue start = default(StackExchange.Redis.RedisValue), StackExchange.Redis.RedisValue end = default(StackExchange.Redis.RedisValue), long count = 100, StackExchange.Redis.Exclude exclude = StackExchange.Redis.Exclude.None, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Collections.Generic.IAsyncEnumerable<StackExchange.Redis.RedisValue>!
2278+
override StackExchange.Redis.LCSMatchResult.LCSMatch.Equals(object? obj) -> bool
2279+
override StackExchange.Redis.LCSMatchResult.LCSMatch.GetHashCode() -> int
2280+
override StackExchange.Redis.LCSMatchResult.LCSMatch.ToString() -> string!
2281+
override StackExchange.Redis.LCSMatchResult.LCSPosition.Equals(object? obj) -> bool
2282+
override StackExchange.Redis.LCSMatchResult.LCSPosition.GetHashCode() -> int
2283+
override StackExchange.Redis.LCSMatchResult.LCSPosition.ToString() -> string!
2284+
StackExchange.Redis.LCSMatchResult.LCSMatch.Equals(in StackExchange.Redis.LCSMatchResult.LCSMatch other) -> bool
2285+
StackExchange.Redis.LCSMatchResult.LCSMatch.First.get -> StackExchange.Redis.LCSMatchResult.LCSPosition
2286+
StackExchange.Redis.LCSMatchResult.LCSMatch.Second.get -> StackExchange.Redis.LCSMatchResult.LCSPosition
2287+
StackExchange.Redis.LCSMatchResult.LCSPosition
2288+
StackExchange.Redis.LCSMatchResult.LCSPosition.End.get -> long
2289+
StackExchange.Redis.LCSMatchResult.LCSPosition.Equals(in StackExchange.Redis.LCSMatchResult.LCSPosition other) -> bool
2290+
StackExchange.Redis.LCSMatchResult.LCSPosition.LCSPosition() -> void
2291+
StackExchange.Redis.LCSMatchResult.LCSPosition.LCSPosition(long start, long end) -> void
2292+
StackExchange.Redis.LCSMatchResult.LCSPosition.Start.get -> long
2293+
StackExchange.Redis.RedisType.VectorSet = 8 -> StackExchange.Redis.RedisType
2294+
[SER005]StackExchange.Redis.TestHarness
2295+
[SER005]StackExchange.Redis.TestHarness.BufferValidator
2296+
[SER005]StackExchange.Redis.TestHarness.ChannelPrefix.get -> StackExchange.Redis.RedisChannel
2297+
[SER005]StackExchange.Redis.TestHarness.CommandMap.get -> StackExchange.Redis.CommandMap!
2298+
[SER005]StackExchange.Redis.TestHarness.KeyPrefix.get -> StackExchange.Redis.RedisKey
2299+
[SER005]StackExchange.Redis.TestHarness.Read(System.ReadOnlySpan<byte> value) -> StackExchange.Redis.RedisResult!
2300+
[SER005]StackExchange.Redis.TestHarness.TestHarness(StackExchange.Redis.CommandMap? commandMap = null, StackExchange.Redis.RedisChannel channelPrefix = default(StackExchange.Redis.RedisChannel), StackExchange.Redis.RedisKey keyPrefix = default(StackExchange.Redis.RedisKey)) -> void
2301+
[SER005]StackExchange.Redis.TestHarness.ValidateResp(string! expected, string! command, params System.Collections.Generic.ICollection<object!>! args) -> void
2302+
[SER005]StackExchange.Redis.TestHarness.ValidateResp(System.ReadOnlySpan<byte> expected, string! command, params System.Collections.Generic.ICollection<object!>! args) -> void
2303+
[SER005]StackExchange.Redis.TestHarness.ValidateRouting(in StackExchange.Redis.RedisKey expected, params System.Collections.Generic.ICollection<object!>! args) -> void
2304+
[SER005]StackExchange.Redis.TestHarness.Write(string! command, params System.Collections.Generic.ICollection<object!>! args) -> byte[]!
2305+
[SER005]StackExchange.Redis.TestHarness.Write(System.Buffers.IBufferWriter<byte>! target, string! command, params System.Collections.Generic.ICollection<object!>! args) -> void
2306+
[SER005]static StackExchange.Redis.TestHarness.AssertEqual(string! expected, System.ReadOnlySpan<byte> actual, System.Action<string!, string!>! handler) -> void
2307+
[SER005]static StackExchange.Redis.TestHarness.AssertEqual(System.ReadOnlySpan<byte> expected, System.ReadOnlySpan<byte> actual, System.Action<System.ReadOnlyMemory<byte>, System.ReadOnlyMemory<byte>>! handler) -> void
2308+
[SER005]virtual StackExchange.Redis.TestHarness.BufferValidator.Invoke(scoped System.ReadOnlySpan<byte> buffer) -> void
2309+
[SER005]virtual StackExchange.Redis.TestHarness.OnValidateFail(in StackExchange.Redis.RedisKey expected, in StackExchange.Redis.RedisKey actual) -> void
2310+
[SER005]virtual StackExchange.Redis.TestHarness.OnValidateFail(string! expected, string! actual) -> void
2311+
[SER005]virtual StackExchange.Redis.TestHarness.OnValidateFail(System.ReadOnlyMemory<byte> expected, System.ReadOnlyMemory<byte> actual) -> void
2312+
[SER008]StackExchange.Redis.GcraRateLimitResult
2313+
[SER008]StackExchange.Redis.GcraRateLimitResult.AvailableRequests.get -> int
2314+
[SER008]StackExchange.Redis.GcraRateLimitResult.FullBurstAfterSeconds.get -> int
2315+
[SER008]StackExchange.Redis.GcraRateLimitResult.GcraRateLimitResult() -> void
2316+
[SER008]StackExchange.Redis.GcraRateLimitResult.GcraRateLimitResult(bool limited, int maxRequests, int availableRequests, int retryAfterSeconds, int fullBurstAfterSeconds) -> void
2317+
[SER008]StackExchange.Redis.GcraRateLimitResult.Limited.get -> bool
2318+
[SER008]StackExchange.Redis.GcraRateLimitResult.MaxRequests.get -> int
2319+
[SER008]StackExchange.Redis.GcraRateLimitResult.RetryAfterSeconds.get -> int
2320+
[SER008]StackExchange.Redis.IDatabase.StringGcraRateLimit(StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.GcraRateLimitResult
2321+
[SER008]StackExchange.Redis.IDatabaseAsync.StringGcraRateLimitAsync(StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.GcraRateLimitResult>!
2322+
[SER008]static StackExchange.Redis.ExtensionMethods.TryAcquireGcraAsync(this StackExchange.Redis.IDatabaseAsync! database, StackExchange.Redis.RedisKey key, int maxBurst, int requestsPerPeriod, System.TimeSpan allow, double periodSeconds = 1, int count = 1, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.ValueTask<bool>

0 commit comments

Comments
 (0)