Skip to content

Commit 788f5e0

Browse files
committed
limit [SER002] to the digest-related features, to prevent warnings on overload resolution
1 parent 94e0090 commit 788f5e0

File tree

8 files changed

+42
-39
lines changed

8 files changed

+42
-39
lines changed

src/StackExchange.Redis/Interfaces/IDatabase.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,7 +3182,6 @@ IEnumerable<SortedSetEntry> SortedSetScan(
31823182
/// <param name="when">The condition to enforce.</param>
31833183
/// <param name="flags">The flags to use for this operation.</param>
31843184
/// <remarks>See <seealso href="https://redis.io/commands/delex"/>.</remarks>
3185-
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
31863185
bool StringDelete(RedisKey key, ValueCondition when, CommandFlags flags = CommandFlags.None);
31873186

31883187
/// <summary>
@@ -3422,7 +3421,6 @@ IEnumerable<SortedSetEntry> SortedSetScan(
34223421
/// <param name="when">The condition to enforce.</param>
34233422
/// <param name="flags">The flags to use for this operation.</param>
34243423
/// <remarks>See <seealso href="https://redis.io/commands/delex"/>.</remarks>
3425-
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
34263424
#pragma warning disable RS0027
34273425
bool StringSet(RedisKey key, RedisValue value, TimeSpan? expiry, ValueCondition when, CommandFlags flags = CommandFlags.None);
34283426
#pragma warning restore RS0027

src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ IAsyncEnumerable<SortedSetEntry> SortedSetScanAsync(
773773
Task<long> StringDecrementAsync(RedisKey key, long value = 1, CommandFlags flags = CommandFlags.None);
774774

775775
/// <inheritdoc cref="IDatabase.StringDelete(RedisKey, ValueCondition, CommandFlags)"/>
776-
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
777776
Task<bool> StringDeleteAsync(RedisKey key, ValueCondition when, CommandFlags flags = CommandFlags.None);
778777

779778
/// <inheritdoc cref="IDatabase.StringDecrement(RedisKey, double, CommandFlags)"/>
@@ -843,7 +842,6 @@ IAsyncEnumerable<SortedSetEntry> SortedSetScanAsync(
843842
Task<bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan? expiry = null, bool keepTtl = false, When when = When.Always, CommandFlags flags = CommandFlags.None);
844843

845844
/// <inheritdoc cref="IDatabase.StringSet(RedisKey, RedisValue, TimeSpan?, ValueCondition, CommandFlags)"/>
846-
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
847845
#pragma warning disable RS0027 // Public API with optional parameter(s) should have the most parameters amongst its public overloads
848846
Task<bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan? expiry, ValueCondition when, CommandFlags flags = CommandFlags.None);
849847
#pragma warning restore RS0027

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,3 +2073,30 @@ static StackExchange.Redis.Expiration.KeepTtl.get -> StackExchange.Redis.Expirat
20732073
static StackExchange.Redis.Expiration.Persist.get -> StackExchange.Redis.Expiration
20742074
static StackExchange.Redis.Expiration.implicit operator StackExchange.Redis.Expiration(System.DateTime when) -> StackExchange.Redis.Expiration
20752075
static StackExchange.Redis.Expiration.implicit operator StackExchange.Redis.Expiration(System.TimeSpan ttl) -> StackExchange.Redis.Expiration
2076+
override StackExchange.Redis.ValueCondition.Equals(object? obj) -> bool
2077+
override StackExchange.Redis.ValueCondition.GetHashCode() -> int
2078+
override StackExchange.Redis.ValueCondition.ToString() -> string!
2079+
StackExchange.Redis.RedisFeatures.DeleteWithValueCheck.get -> bool
2080+
StackExchange.Redis.RedisFeatures.SetWithValueCheck.get -> bool
2081+
StackExchange.Redis.ValueCondition
2082+
StackExchange.Redis.ValueCondition.ValueCondition() -> void
2083+
static StackExchange.Redis.ValueCondition.Always.get -> StackExchange.Redis.ValueCondition
2084+
static StackExchange.Redis.ValueCondition.Exists.get -> StackExchange.Redis.ValueCondition
2085+
static StackExchange.Redis.ValueCondition.implicit operator StackExchange.Redis.ValueCondition(StackExchange.Redis.When when) -> StackExchange.Redis.ValueCondition
2086+
static StackExchange.Redis.ValueCondition.NotExists.get -> StackExchange.Redis.ValueCondition
2087+
static StackExchange.Redis.ValueCondition.operator !(in StackExchange.Redis.ValueCondition value) -> StackExchange.Redis.ValueCondition
2088+
StackExchange.Redis.IDatabase.StringDelete(StackExchange.Redis.RedisKey key, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
2089+
StackExchange.Redis.IDatabase.StringSet(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue value, System.TimeSpan? expiry, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
2090+
StackExchange.Redis.IDatabaseAsync.StringDeleteAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
2091+
StackExchange.Redis.IDatabaseAsync.StringSetAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue value, System.TimeSpan? expiry, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
2092+
[SER002]StackExchange.Redis.IDatabase.StringDigest(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.ValueCondition?
2093+
[SER002]StackExchange.Redis.IDatabaseAsync.StringDigestAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.ValueCondition?>!
2094+
[SER002]StackExchange.Redis.ValueCondition.AsDigest() -> StackExchange.Redis.ValueCondition
2095+
[SER002]StackExchange.Redis.ValueCondition.Value.get -> StackExchange.Redis.RedisValue
2096+
[SER002]static StackExchange.Redis.ValueCondition.CalculateDigest(System.ReadOnlySpan<byte> value) -> StackExchange.Redis.ValueCondition
2097+
[SER002]static StackExchange.Redis.ValueCondition.DigestEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
2098+
[SER002]static StackExchange.Redis.ValueCondition.DigestNotEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
2099+
[SER002]static StackExchange.Redis.ValueCondition.Equal(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
2100+
[SER002]static StackExchange.Redis.ValueCondition.NotEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
2101+
[SER002]static StackExchange.Redis.ValueCondition.ParseDigest(System.ReadOnlySpan<byte> digest) -> StackExchange.Redis.ValueCondition
2102+
[SER002]static StackExchange.Redis.ValueCondition.ParseDigest(System.ReadOnlySpan<char> digest) -> StackExchange.Redis.ValueCondition
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1 @@
11
#nullable enable
2-
StackExchange.Redis.RedisFeatures.DeleteWithValueCheck.get -> bool
3-
StackExchange.Redis.RedisFeatures.SetWithValueCheck.get -> bool
4-
[SER002]override StackExchange.Redis.ValueCondition.Equals(object? obj) -> bool
5-
[SER002]override StackExchange.Redis.ValueCondition.GetHashCode() -> int
6-
[SER002]override StackExchange.Redis.ValueCondition.ToString() -> string!
7-
[SER002]StackExchange.Redis.IDatabase.StringDelete(StackExchange.Redis.RedisKey key, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
8-
[SER002]StackExchange.Redis.IDatabase.StringDigest(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> StackExchange.Redis.ValueCondition?
9-
[SER002]StackExchange.Redis.IDatabase.StringSet(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue value, System.TimeSpan? expiry, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> bool
10-
[SER002]StackExchange.Redis.IDatabaseAsync.StringDeleteAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
11-
[SER002]StackExchange.Redis.IDatabaseAsync.StringDigestAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<StackExchange.Redis.ValueCondition?>!
12-
[SER002]StackExchange.Redis.IDatabaseAsync.StringSetAsync(StackExchange.Redis.RedisKey key, StackExchange.Redis.RedisValue value, System.TimeSpan? expiry, StackExchange.Redis.ValueCondition when, StackExchange.Redis.CommandFlags flags = StackExchange.Redis.CommandFlags.None) -> System.Threading.Tasks.Task<bool>!
13-
[SER002]StackExchange.Redis.ValueCondition
14-
[SER002]StackExchange.Redis.ValueCondition.AsDigest() -> StackExchange.Redis.ValueCondition
15-
[SER002]StackExchange.Redis.ValueCondition.Value.get -> StackExchange.Redis.RedisValue
16-
[SER002]StackExchange.Redis.ValueCondition.ValueCondition() -> void
17-
[SER002]static StackExchange.Redis.ValueCondition.Always.get -> StackExchange.Redis.ValueCondition
18-
[SER002]static StackExchange.Redis.ValueCondition.CalculateDigest(System.ReadOnlySpan<byte> value) -> StackExchange.Redis.ValueCondition
19-
[SER002]static StackExchange.Redis.ValueCondition.DigestEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
20-
[SER002]static StackExchange.Redis.ValueCondition.DigestNotEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
21-
[SER002]static StackExchange.Redis.ValueCondition.Equal(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
22-
[SER002]static StackExchange.Redis.ValueCondition.Exists.get -> StackExchange.Redis.ValueCondition
23-
[SER002]static StackExchange.Redis.ValueCondition.implicit operator StackExchange.Redis.ValueCondition(StackExchange.Redis.When when) -> StackExchange.Redis.ValueCondition
24-
[SER002]static StackExchange.Redis.ValueCondition.NotEqual(in StackExchange.Redis.RedisValue value) -> StackExchange.Redis.ValueCondition
25-
[SER002]static StackExchange.Redis.ValueCondition.NotExists.get -> StackExchange.Redis.ValueCondition
26-
[SER002]static StackExchange.Redis.ValueCondition.operator !(in StackExchange.Redis.ValueCondition value) -> StackExchange.Redis.ValueCondition
27-
[SER002]static StackExchange.Redis.ValueCondition.ParseDigest(System.ReadOnlySpan<byte> digest) -> StackExchange.Redis.ValueCondition
28-
[SER002]static StackExchange.Redis.ValueCondition.ParseDigest(System.ReadOnlySpan<char> digest) -> StackExchange.Redis.ValueCondition

src/StackExchange.Redis/StackExchange.Redis.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<DefineConstants Condition="'$(TargetFramework)' != 'net461'">$(DefineConstants);VECTOR_SAFE</DefineConstants>
1313
<DefineConstants Condition="'$(TargetFramework)' != 'net461' and '$(TargetFramework)' != 'net472' and '$(TargetFramework)' != 'netstandard2.0'">$(DefineConstants);UNIX_SOCKET</DefineConstants>
1414
<PackageReadmeFile>README.md</PackageReadmeFile>
15-
<Nowarn>$(NoWarn);SER002</Nowarn>
1615
</PropertyGroup>
1716

1817
<ItemGroup>

src/StackExchange.Redis/ValueCondition.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
namespace StackExchange.Redis;
99

1010
/// <summary>
11-
/// Represents a check for an existing value, for use in conditional operations such as <c>DELEX</c> or <c>SET ... IFEQ</c>.
11+
/// Represents a check for an existing value - this could be existence (NX/XX), equality (IFEQ/IFNE), or digest equality (IFDEQ/IFDNE).
1212
/// </summary>
13-
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
1413
public readonly struct ValueCondition
1514
{
1615
internal enum ConditionKind : byte
@@ -108,7 +107,11 @@ public override string ToString()
108107
/// <summary>
109108
/// Gets the underlying value for this condition.
110109
/// </summary>
111-
public RedisValue Value => _value;
110+
public RedisValue Value
111+
{
112+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
113+
get => _value;
114+
}
112115

113116
private ValueCondition(ConditionKind kind, in RedisValue value)
114117
{
@@ -136,26 +139,32 @@ private ValueCondition(ConditionKind kind, in RedisValue value)
136139
/// <summary>
137140
/// Create a value equality condition with the supplied value.
138141
/// </summary>
142+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
139143
public static ValueCondition Equal(in RedisValue value) => new(ConditionKind.ValueEquals, value);
140144

141145
/// <summary>
142146
/// Create a value non-equality condition with the supplied value.
143147
/// </summary>
148+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
149+
144150
public static ValueCondition NotEqual(in RedisValue value) => new(ConditionKind.ValueNotEquals, value);
145151

146152
/// <summary>
147153
/// Create a digest equality condition, computing the digest of the supplied value.
148154
/// </summary>
155+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
149156
public static ValueCondition DigestEqual(in RedisValue value) => value.Digest();
150157

151158
/// <summary>
152159
/// Create a digest non-equality condition, computing the digest of the supplied value.
153160
/// </summary>
161+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
154162
public static ValueCondition DigestNotEqual(in RedisValue value) => !value.Digest();
155163

156164
/// <summary>
157165
/// Calculate the digest of a payload, as an equality test. For a non-equality test, use <see cref="NotEqual"/> on the result.
158166
/// </summary>
167+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
159168
public static ValueCondition CalculateDigest(ReadOnlySpan<byte> value)
160169
{
161170
// the internal impl of XxHash3 uses ulong (not Span<byte>), so: use
@@ -167,6 +176,7 @@ public static ValueCondition CalculateDigest(ReadOnlySpan<byte> value)
167176
/// <summary>
168177
/// Creates an equality match based on the specified digest bytes.
169178
/// </summary>
179+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
170180
public static ValueCondition ParseDigest(ReadOnlySpan<char> digest)
171181
{
172182
if (digest.Length != 2 * DigestBytes) ThrowDigestLength();
@@ -201,6 +211,7 @@ private static byte ParseNibble(int b)
201211
/// <summary>
202212
/// Creates an equality match based on the specified digest bytes.
203213
/// </summary>
214+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
204215
public static ValueCondition ParseDigest(ReadOnlySpan<byte> digest)
205216
{
206217
if (digest.Length != 2 * DigestBytes) ThrowDigestLength();
@@ -341,6 +352,7 @@ internal static Span<char> WriteHex(long value, Span<char> target)
341352
/// <summary>
342353
/// Convert a value condition to a digest condition.
343354
/// </summary>
355+
[Experimental(Experiments.Server_8_4, UrlFormat = Experiments.UrlFormat)]
344356
public ValueCondition AsDigest() => _kind switch
345357
{
346358
ConditionKind.ValueEquals => _value.Digest(),

tests/StackExchange.Redis.Tests/DigestIntegrationTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace StackExchange.Redis.Tests;
66

7-
#pragma warning disable SER002 // 8.4
8-
97
public class DigestIntegrationTests(ITestOutputHelper output, SharedConnectionFixture fixture)
108
: TestBase(output, fixture)
119
{

tests/StackExchange.Redis.Tests/DigestUnitTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace StackExchange.Redis.Tests;
99

10-
#pragma warning disable SER002 // 8.4
11-
1210
public class DigestUnitTests(ITestOutputHelper output) : TestBase(output)
1311
{
1412
[Theory]

0 commit comments

Comments
 (0)