Skip to content

Commit

Permalink
Deprecate Triggers and Functions (#343)
Browse files Browse the repository at this point in the history
deprecate T&F
  • Loading branch information
atakavci authored Oct 1, 2024
1 parent 0a8bdfa commit 0171221
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 211 deletions.
5 changes: 5 additions & 0 deletions src/NRedisStack/Gears/GearsCommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace NRedisStack
{

[Obsolete]
public static class GearsCommandBuilder
{
[Obsolete]
public static SerializedCommand TFunctionLoad(string libraryCode, bool replace = false, string? config = null)
{
var args = new List<object>() { GearsArgs.LOAD };
Expand All @@ -23,11 +25,13 @@ public static SerializedCommand TFunctionLoad(string libraryCode, bool replace =
return new SerializedCommand(RG.TFUNCTION, args);
}

[Obsolete]
public static SerializedCommand TFunctionDelete(string libraryName)
{
return new SerializedCommand(RG.TFUNCTION, GearsArgs.DELETE, libraryName);
}

[Obsolete]
public static SerializedCommand TFunctionList(bool withCode = false, int verbose = 0, string? libraryName = null)
{
var args = new List<object>() { GearsArgs.LIST };
Expand Down Expand Up @@ -55,6 +59,7 @@ public static SerializedCommand TFunctionList(bool withCode = false, int verbose
return new SerializedCommand(RG.TFUNCTION, args);
}

[Obsolete]
public static SerializedCommand TFCall(string libraryName, string functionName, string[]? keys = null, string[]? args = null, bool async = false)
{
string command = async ? RG.TFCALLASYNC : RG.TFCALL;
Expand Down
7 changes: 6 additions & 1 deletion src/NRedisStack/Gears/GearsCommands.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using StackExchange.Redis;
namespace NRedisStack
{

[Obsolete]
public static class GearsCommands //: GearsCommandsAsync, IGearsCommands
{

Expand All @@ -17,6 +17,7 @@ public static class GearsCommands //: GearsCommandsAsync, IGearsCommands
/// <param name="replace">an optional argument, instructs RedisGears to replace the function if its already exists.</param>
/// <returns><see langword="true"/> if everything was done correctly, Error otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfunction-load/"/></remarks> //TODO: check this link when it's available
[Obsolete]
public static bool TFunctionLoad(this IDatabase db, string libraryCode, bool replace = false, string? config = null)
{
return db.Execute(GearsCommandBuilder.TFunctionLoad(libraryCode, replace, config)).OKtoBoolean();
Expand All @@ -28,6 +29,7 @@ public static bool TFunctionLoad(this IDatabase db, string libraryCode, bool rep
/// <param name="libraryName">the name of the library to delete.</param>
/// <returns><see langword="true"/> if the library was deleted successfully, Error otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfunction-delete/"/></remarks> //TODO: check this link when it's available
[Obsolete]
public static bool TFunctionDelete(this IDatabase db, string libraryName)
{
return db.Execute(GearsCommandBuilder.TFunctionDelete(libraryName)).OKtoBoolean();
Expand All @@ -42,6 +44,7 @@ public static bool TFunctionDelete(this IDatabase db, string libraryName)
/// multiple times to show multiple libraries in a single command)</param>
/// <returns>Information about the requested libraries.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfunction-list/"/></remarks> //TODO: check this link when it's available
[Obsolete]
public static Dictionary<string, RedisResult>[] TFunctionList(this IDatabase db, bool withCode = false, int verbose = 0, string? libraryName = null)
{
return db.Execute(GearsCommandBuilder.TFunctionList(withCode, verbose, libraryName)).ToDictionarys();
Expand All @@ -56,6 +59,7 @@ public static Dictionary<string, RedisResult>[] TFunctionList(this IDatabase db,
/// <param name="args">Additional argument to pass to the function.</param>
/// <returns>The return value from the sync &amp; async function on error in case of failure.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfcall"/></remarks>
[Obsolete]
public static RedisResult TFCall_(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null)
{
return db.Execute(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async: false));
Expand All @@ -70,6 +74,7 @@ public static RedisResult TFCall_(this IDatabase db, string libraryName, string
/// <param name="args">Additional argument to pass to the function.</param>
/// <returns>The return value from the sync &amp; async function on error in case of failure.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfcallasync"/></remarks>
[Obsolete]
public static RedisResult TFCallAsync_(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null)
{
return db.Execute(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async: true));
Expand Down
5 changes: 5 additions & 0 deletions src/NRedisStack/Gears/GearsCommandsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class GearsCommandsAsync //: IGearsCommandsAsync
/// <param name="replace">an optional argument, instructs RedisGears to replace the function if its already exists.</param>
/// <returns><see langword="true"/> if everything was done correctly, Error otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/"/></remarks> //TODO: add link to the command when it's available
[Obsolete]
public static async Task<bool> TFunctionLoadAsync(this IDatabase db, string libraryCode, string? config = null, bool replace = false)
{
return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionLoad(libraryCode, replace, config))).OKtoBoolean();
Expand All @@ -27,6 +28,7 @@ public static async Task<bool> TFunctionLoadAsync(this IDatabase db, string libr
/// <param name="libraryName">the name of the library to delete.</param>
/// <returns><see langword="true"/> if the library was deleted successfully, Error otherwise.</returns>
/// <remarks><seealso href="https://redis.io/commands/"/></remarks> //TODO: add link to the command when it's available
[Obsolete]
public static async Task<bool> TFunctionDeleteAsync(this IDatabase db, string libraryName)
{
return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionDelete(libraryName))).OKtoBoolean();
Expand All @@ -41,6 +43,7 @@ public static async Task<bool> TFunctionDeleteAsync(this IDatabase db, string li
/// multiple times to show multiple libraries in a single command)</param>
/// <returns>Information about the requested libraries.</returns>
/// <remarks><seealso href="https://redis.io/commands/"/></remarks> //TODO: add link to the command when it's available
[Obsolete]
public static async Task<Dictionary<string, RedisResult>[]> TFunctionListAsync(this IDatabase db, bool withCode = false, int verbose = 0, string? libraryName = null)
{
return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionList(withCode, verbose, libraryName))).ToDictionarys();
Expand All @@ -55,6 +58,7 @@ public static async Task<Dictionary<string, RedisResult>[]> TFunctionListAsync(t
/// <param name="args">Additional argument to pass to the function.</param>
/// <returns>The return value from the sync &amp; async function on error in case of failure.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfcall"/></remarks>
[Obsolete]
public async static Task<RedisResult> TFCall_Async(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null)
{
return await db.ExecuteAsync(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async: false));
Expand All @@ -69,6 +73,7 @@ public async static Task<RedisResult> TFCall_Async(this IDatabase db, string lib
/// <param name="args">Additional argument to pass to the function.</param>
/// <returns>The return value from the sync &amp; async function on error in case of failure.</returns>
/// <remarks><seealso href="https://redis.io/commands/tfcallasync"/></remarks>
[Obsolete]
public async static Task<RedisResult> TFCallAsync_Async(this IDatabase db, string libraryName, string functionName, string[]? keys = null, string[]? args = null)
{
return await db.ExecuteAsync(GearsCommandBuilder.TFCall(libraryName, functionName, keys, args, async: true));
Expand Down
210 changes: 0 additions & 210 deletions tests/NRedisStack.Tests/Gears/GearsTests.cs

This file was deleted.

0 comments on commit 0171221

Please sign in to comment.