Skip to content

Commit ebce7eb

Browse files
committed
ack experimental
1 parent 9a4b9c3 commit ebce7eb

7 files changed

Lines changed: 134 additions & 58 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>NU5105;NU1507</NoWarn>
13+
<NoWarn>$(NoWarn);NU5105;NU1507;SER001</NoWarn>
1414
<PackageReleaseNotes>https://stackexchange.github.io/StackExchange.Redis/ReleaseNotes</PackageReleaseNotes>
1515
<PackageProjectUrl>https://stackexchange.github.io/StackExchange.Redis/</PackageProjectUrl>
1616
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Diagnostics.CodeAnalysis;
2+
3+
namespace StackExchange.Redis
4+
{
5+
// example usage:
6+
// [Experimental(Experiments.SomeFeature, UrlFormat = Experiments.UrlFormat)]
7+
// where SomeFeature has the next label, for example "SER042", and /docs/exp/SER042.md exists
8+
internal static class Experiments
9+
{
10+
public const string UrlFormat = "https://stackexchange.github.io/StackExchange.Redis/exp/";
11+
public const string VectorSets = "SER001";
12+
}
13+
}
14+
15+
#if !NET8_0_OR_GREATER
16+
#pragma warning disable SA1403
17+
namespace System.Diagnostics.CodeAnalysis
18+
#pragma warning restore SA1403
19+
{
20+
[AttributeUsage(
21+
AttributeTargets.Assembly |
22+
AttributeTargets.Module |
23+
AttributeTargets.Class |
24+
AttributeTargets.Struct |
25+
AttributeTargets.Enum |
26+
AttributeTargets.Constructor |
27+
AttributeTargets.Method |
28+
AttributeTargets.Property |
29+
AttributeTargets.Field |
30+
AttributeTargets.Event |
31+
AttributeTargets.Interface |
32+
AttributeTargets.Delegate,
33+
Inherited = false)]
34+
internal sealed class ExperimentalAttribute(string diagnosticId) : Attribute
35+
{
36+
public string DiagnosticId { get; } = diagnosticId;
37+
public string? UrlFormat { get; set; }
38+
public string? Message { get; set; }
39+
}
40+
}
41+
#endif

src/StackExchange.Redis/Interfaces/IDatabase.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4+
using System.Diagnostics.CodeAnalysis;
45
using System.Net;
56

67
// ReSharper disable once CheckNamespace
@@ -3447,6 +3448,7 @@ IEnumerable<SortedSetEntry> SortedSetScan(
34473448
/// <param name="flags">The flags to use for this operation.</param>
34483449
/// <returns><see langword="true"/> if the element was added; <see langword="false"/> if it already existed.</returns>
34493450
/// <remarks><seealso href="https://redis.io/commands/vadd"/></remarks>
3451+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
34503452
bool VectorSetAdd(
34513453
RedisKey key,
34523454
RedisValue element,
@@ -3466,6 +3468,7 @@ bool VectorSetAdd(
34663468
/// <param name="flags">The flags to use for this operation.</param>
34673469
/// <returns>The cardinality of the vectorset.</returns>
34683470
/// <remarks><seealso href="https://redis.io/commands/vcard"/></remarks>
3471+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
34693472
long VectorSetLength(RedisKey key, CommandFlags flags = CommandFlags.None);
34703473

34713474
/// <summary>
@@ -3475,6 +3478,7 @@ bool VectorSetAdd(
34753478
/// <param name="flags">The flags to use for this operation.</param>
34763479
/// <returns>The dimension of vectors in the vectorset.</returns>
34773480
/// <remarks><seealso href="https://redis.io/commands/vdim"/></remarks>
3481+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
34783482
int VectorSetDimension(RedisKey key, CommandFlags flags = CommandFlags.None);
34793483

34803484
/// <summary>
@@ -3485,6 +3489,7 @@ bool VectorSetAdd(
34853489
/// <param name="flags">The flags to use for this operation.</param>
34863490
/// <returns>The vector as a pooled memory lease.</returns>
34873491
/// <remarks><seealso href="https://redis.io/commands/vemb"/></remarks>
3492+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
34883493
Lease<float>? VectorSetGetApproximateVector(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
34893494

34903495
/// <summary>
@@ -3495,6 +3500,7 @@ bool VectorSetAdd(
34953500
/// <param name="flags">The flags to use for this operation.</param>
34963501
/// <returns>The attributes as a JSON string.</returns>
34973502
/// <remarks><seealso href="https://redis.io/commands/vgetattr"/></remarks>
3503+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
34983504
string? VectorSetGetAttributesJson(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
34993505

35003506
/// <summary>
@@ -3504,6 +3510,7 @@ bool VectorSetAdd(
35043510
/// <param name="flags">The flags to use for this operation.</param>
35053511
/// <returns>Information about the vectorset.</returns>
35063512
/// <remarks><seealso href="https://redis.io/commands/vinfo"/></remarks>
3513+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35073514
VectorSetInfo? VectorSetInfo(RedisKey key, CommandFlags flags = CommandFlags.None);
35083515

35093516
/// <summary>
@@ -3514,6 +3521,7 @@ bool VectorSetAdd(
35143521
/// <param name="flags">The flags to use for this operation.</param>
35153522
/// <returns>True if the member exists, false otherwise.</returns>
35163523
/// <remarks><seealso href="https://redis.io/commands/vismember"/></remarks>
3524+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35173525
bool VectorSetContains(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
35183526

35193527
/// <summary>
@@ -3524,6 +3532,7 @@ bool VectorSetAdd(
35243532
/// <param name="flags">The flags to use for this operation.</param>
35253533
/// <returns>The linked members.</returns>
35263534
/// <remarks><seealso href="https://redis.io/commands/vlinks"/></remarks>
3535+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35273536
Lease<RedisValue>? VectorSetGetLinks(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
35283537

35293538
/// <summary>
@@ -3534,6 +3543,7 @@ bool VectorSetAdd(
35343543
/// <param name="flags">The flags to use for this operation.</param>
35353544
/// <returns>The linked members with their similarity scores.</returns>
35363545
/// <remarks><seealso href="https://redis.io/commands/vlinks"/></remarks>
3546+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35373547
Lease<VectorSetLink>? VectorSetGetLinksWithScores(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
35383548

35393549
/// <summary>
@@ -3543,6 +3553,7 @@ bool VectorSetAdd(
35433553
/// <param name="flags">The flags to use for this operation.</param>
35443554
/// <returns>A random member from the vectorset, or null if the vectorset is empty.</returns>
35453555
/// <remarks><seealso href="https://redis.io/commands/vrandmember"/></remarks>
3556+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35463557
RedisValue VectorSetRandomMember(RedisKey key, CommandFlags flags = CommandFlags.None);
35473558

35483559
/// <summary>
@@ -3553,6 +3564,7 @@ bool VectorSetAdd(
35533564
/// <param name="flags">The flags to use for this operation.</param>
35543565
/// <returns>Random members from the vectorset.</returns>
35553566
/// <remarks><seealso href="https://redis.io/commands/vrandmember"/></remarks>
3567+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35563568
RedisValue[] VectorSetRandomMembers(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
35573569

35583570
/// <summary>
@@ -3563,6 +3575,7 @@ bool VectorSetAdd(
35633575
/// <param name="flags">The flags to use for this operation.</param>
35643576
/// <returns><see langword="true"/> if the member was removed; <see langword="false"/> if it was not found.</returns>
35653577
/// <remarks><seealso href="https://redis.io/commands/vrem"/></remarks>
3578+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35663579
bool VectorSetRemove(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
35673580

35683581
/// <summary>
@@ -3574,6 +3587,7 @@ bool VectorSetAdd(
35743587
/// <param name="flags">The flags to use for this operation.</param>
35753588
/// <returns>True if successful.</returns>
35763589
/// <remarks><seealso href="https://redis.io/commands/vsetattr"/></remarks>
3590+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35773591
bool VectorSetSetAttributesJson(RedisKey key, RedisValue member, string jsonAttributes, CommandFlags flags = CommandFlags.None);
35783592

35793593
/// <summary>
@@ -3593,6 +3607,7 @@ bool VectorSetAdd(
35933607
/// <param name="flags">The flags to use for this operation.</param>
35943608
/// <returns>Similar vectors with their similarity scores.</returns>
35953609
/// <remarks><seealso href="https://redis.io/commands/vsim"/></remarks>
3610+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
35963611
Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByVector(
35973612
RedisKey key,
35983613
ReadOnlyMemory<float> vector,
@@ -3624,6 +3639,7 @@ bool VectorSetAdd(
36243639
/// <param name="flags">The flags to use for this operation.</param>
36253640
/// <returns>Similar vectors with their similarity scores.</returns>
36263641
/// <remarks><seealso href="https://redis.io/commands/vsim"/></remarks>
3642+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
36273643
Lease<VectorSimilarityResult>? VectorSetSimilaritySearchByMember(
36283644
RedisKey key,
36293645
RedisValue member,

src/StackExchange.Redis/Interfaces/IDatabaseAsync.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4+
using System.Diagnostics.CodeAnalysis;
45
using System.Net;
56
using System.Threading.Tasks;
67

@@ -848,6 +849,7 @@ IAsyncEnumerable<SortedSetEntry> SortedSetScanAsync(
848849
// Vector Set operations
849850

850851
/// <inheritdoc cref="IDatabase.VectorSetAdd(RedisKey, RedisValue, ReadOnlyMemory{float}, int?, VectorQuantizationType, int?, int?, bool, string?, CommandFlags)"/>
852+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
851853
Task<bool> VectorSetAddAsync(
852854
RedisKey key,
853855
RedisValue element,
@@ -861,42 +863,55 @@ Task<bool> VectorSetAddAsync(
861863
CommandFlags flags = CommandFlags.None);
862864

863865
/// <inheritdoc cref="IDatabase.VectorSetLength(RedisKey, CommandFlags)"/>
866+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
864867
Task<long> VectorSetLengthAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
865868

866869
/// <inheritdoc cref="IDatabase.VectorSetDimension(RedisKey, CommandFlags)"/>
870+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
867871
Task<int> VectorSetDimensionAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
868872

869873
/// <inheritdoc cref="IDatabase.VectorSetGetApproximateVector(RedisKey, RedisValue, CommandFlags)"/>
874+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
870875
Task<Lease<float>?> VectorSetGetApproximateVectorAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
871876

872877
/// <inheritdoc cref="IDatabase.VectorSetGetAttributesJson(RedisKey, RedisValue, CommandFlags)"/>
878+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
873879
Task<string?> VectorSetGetAttributesJsonAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
874880

875881
/// <inheritdoc cref="IDatabase.VectorSetInfo(RedisKey, CommandFlags)"/>
882+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
876883
Task<VectorSetInfo?> VectorSetInfoAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
877884

878885
/// <inheritdoc cref="IDatabase.VectorSetContains(RedisKey, RedisValue, CommandFlags)"/>
886+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
879887
Task<bool> VectorSetContainsAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
880888

881889
/// <inheritdoc cref="IDatabase.VectorSetGetLinks(RedisKey, RedisValue, CommandFlags)"/>
890+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
882891
Task<Lease<RedisValue>?> VectorSetGetLinksAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
883892

884893
/// <inheritdoc cref="IDatabase.VectorSetGetLinksWithScores(RedisKey, RedisValue, CommandFlags)"/>
894+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
885895
Task<Lease<VectorSetLink>?> VectorSetGetLinksWithScoresAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
886896

887897
/// <inheritdoc cref="IDatabase.VectorSetRandomMember(RedisKey, CommandFlags)"/>
898+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
888899
Task<RedisValue> VectorSetRandomMemberAsync(RedisKey key, CommandFlags flags = CommandFlags.None);
889900

890901
/// <inheritdoc cref="IDatabase.VectorSetRandomMembers(RedisKey, long, CommandFlags)"/>
902+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
891903
Task<RedisValue[]> VectorSetRandomMembersAsync(RedisKey key, long count, CommandFlags flags = CommandFlags.None);
892904

893905
/// <inheritdoc cref="IDatabase.VectorSetRemove(RedisKey, RedisValue, CommandFlags)"/>
906+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
894907
Task<bool> VectorSetRemoveAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None);
895908

896909
/// <inheritdoc cref="IDatabase.VectorSetSetAttributesJson(RedisKey, RedisValue, string, CommandFlags)"/>
910+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
897911
Task<bool> VectorSetSetAttributesJsonAsync(RedisKey key, RedisValue member, string jsonAttributes, CommandFlags flags = CommandFlags.None);
898912

899913
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByVector(RedisKey, ReadOnlyMemory{float}, long, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
914+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
900915
Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByVectorAsync(
901916
RedisKey key,
902917
ReadOnlyMemory<float> vector,
@@ -912,6 +927,7 @@ Task<bool> VectorSetAddAsync(
912927
CommandFlags flags = CommandFlags.None);
913928

914929
/// <inheritdoc cref="IDatabase.VectorSetSimilaritySearchByMember(RedisKey, RedisValue, long, bool, bool, double?, int?, string?, int?, bool, bool, CommandFlags)"/>
930+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
915931
Task<Lease<VectorSimilarityResult>?> VectorSetSimilaritySearchByMemberAsync(
916932
RedisKey key,
917933
RedisValue member,

src/StackExchange.Redis/KeyspaceIsolation/KeyPrefixed.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ public void WaitAll(params Task[] tasks) =>
815815
Inner.WaitAll(tasks);
816816

817817
// Vector Set operations - async methods
818+
[Experimental(Experiments.VectorSets, UrlFormat = Experiments.UrlFormat)]
818819
public Task<bool> VectorSetAddAsync(
819820
RedisKey key,
820821
RedisValue element,

0 commit comments

Comments
 (0)