Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions sources/Valkey.Glide/BaseClient.SortedSetCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,77 @@ public async Task<ValkeyValue[]> SortedSetRangeByValueAsync(
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetRangeByValueAsync(key, min, max, exclude, order, skip, take));
}

public async Task<ValkeyValue[]> SortedSetCombineAsync(SetOperation operation, ValkeyKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetCombineAsync(operation, keys, weights, aggregate));
}

public async Task<SortedSetEntry[]> SortedSetCombineWithScoresAsync(SetOperation operation, ValkeyKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetCombineWithScoresAsync(operation, keys, weights, aggregate));
}

public async Task<long> SortedSetCombineAndStoreAsync(SetOperation operation, ValkeyKey destination, ValkeyKey first, ValkeyKey second, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetCombineAndStoreAsync(operation, destination, first, second, aggregate));
}

public async Task<long> SortedSetCombineAndStoreAsync(SetOperation operation, ValkeyKey destination, ValkeyKey[] keys, double[]? weights = null, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetCombineAndStoreAsync(operation, destination, keys, weights, aggregate));
}

public async Task<double> SortedSetIncrementAsync(ValkeyKey key, ValkeyValue member, double value, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetIncrementAsync(key, member, value));
}

public async Task<long> SortedSetIntersectionLengthAsync(ValkeyKey[] keys, long limit = 0, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetIntersectionLengthAsync(keys, limit));
}

public async Task<long> SortedSetLengthByValueAsync(ValkeyKey key, ValkeyValue min, ValkeyValue max, Exclude exclude = Exclude.None, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetLengthByValueAsync(key, min, max, exclude));
}

public async Task<SortedSetPopResult> SortedSetPopAsync(ValkeyKey[] keys, long count, Order order = Order.Ascending, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetPopAsync(keys, count, order));
}

public async Task<double?[]> SortedSetScoresAsync(ValkeyKey key, ValkeyValue[] members, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetScoresAsync(key, members));
}

public async Task<SortedSetEntry?> SortedSetBlockingPopAsync(ValkeyKey key, Order order, double timeout, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetBlockingPopAsync(key, order, timeout));
}

public async Task<SortedSetEntry[]> SortedSetBlockingPopAsync(ValkeyKey key, long count, Order order, double timeout, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
Utils.Requires<ArgumentException>(count == 1, "GLIDE does not currently support multipop BZPOPMIN or BZPOPMAX"); // TODO for the future
return await Command(Request.SortedSetBlockingPopAsync(key, count, order, timeout));
}

public async Task<SortedSetPopResult> SortedSetBlockingPopAsync(ValkeyKey[] keys, long count, Order order, double timeout, CommandFlags flags = CommandFlags.None)
{
Utils.Requires<NotImplementedException>(flags == CommandFlags.None, "Command flags are not supported by GLIDE");
return await Command(Request.SortedSetBlockingPopAsync(keys, count, order, timeout));
}
}
17 changes: 16 additions & 1 deletion sources/Valkey.Glide/Commands/Constants/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ public static class Constants
public const string MinMatchLenKeyword = "MINMATCHLEN";
public const string WithMatchLenKeyword = "WITHMATCHLEN";

/// <summary>
/// Keywords for sorted set conditional operations.
/// </summary>
public const string ExistsKeyword = "XX";
public const string NotExistsKeyword = "NX";
public const string GreaterThanKeyword = "GT";
public const string LessThanKeyword = "LT";

/// <summary>
/// Keywords for sorted set operations.
/// </summary>
public const string WeightsKeyword = "WEIGHTS";
public const string AggregateKeyword = "AGGREGATE";
public const string MinKeyword = "MIN";
public const string MaxKeyword = "MAX";

/// <summary>
/// The highest bound in the sorted set for lexicographical operations.
/// </summary>
Expand All @@ -60,5 +76,4 @@ public static class Constants
/// The lowest bound in the sorted set for score operations.
/// </summary>
public const string NegativeInfinityScore = "-inf";

}
Loading
Loading