diff --git a/src/NRedisStack/Gears/GearsCommandBuilder.cs b/src/NRedisStack/Gears/GearsCommandBuilder.cs deleted file mode 100644 index 8dec9026..00000000 --- a/src/NRedisStack/Gears/GearsCommandBuilder.cs +++ /dev/null @@ -1,86 +0,0 @@ -using NRedisStack.RedisStackCommands; -using NRedisStack.Gears.Literals; -namespace NRedisStack -{ - - [Obsolete] - public static class GearsCommandBuilder - { - [Obsolete] - public static SerializedCommand TFunctionLoad(string libraryCode, bool replace = false, string? config = null) - { - var args = new List() { GearsArgs.LOAD }; - - if (replace) - { - args.Add(GearsArgs.REPLACE); - } - - if (config != null) - { - args.Add(GearsArgs.CONFIG); - args.Add(config); - } - args.Add(libraryCode); - 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() { GearsArgs.LIST }; - - if (withCode) - { - args.Add(GearsArgs.WITHCODE); - } - - if (verbose > 0 && verbose < 4) - { - args.Add(new string('v', verbose)); - } - else if (verbose != 0) // verbose == 0 is the default so we don't need to throw an error - { - throw new ArgumentOutOfRangeException(nameof(verbose), "verbose must be between 1 and 3"); - } - - if (libraryName != null) - { - args.Add(GearsArgs.LIBRARY); - args.Add(libraryName); - } - - 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; - var commandArgs = new List() { $"{libraryName}.{functionName}" }; - - if (keys != null) - { - commandArgs.Add(keys.Length); - commandArgs.AddRange(keys); - } - else - { - commandArgs.Add(0); - } - - if (args != null) - { - commandArgs.AddRange(args); - } - - return new SerializedCommand(command, commandArgs); - } - } -} diff --git a/src/NRedisStack/Gears/GearsCommands.cs b/src/NRedisStack/Gears/GearsCommands.cs deleted file mode 100644 index 4787fa86..00000000 --- a/src/NRedisStack/Gears/GearsCommands.cs +++ /dev/null @@ -1,83 +0,0 @@ -using StackExchange.Redis; -namespace NRedisStack -{ - [Obsolete] - public static class GearsCommands //: GearsCommandsAsync, IGearsCommands - { - - /// - /// Load a new library to RedisGears. - /// - /// the library code. - /// a string representation of a JSON object - /// that will be provided to the library on load time, - /// for more information refer to - /// - /// library configuration - /// an optional argument, instructs RedisGears to replace the function if its already exists. - /// if everything was done correctly, Error otherwise. - /// //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(); - } - - /// - /// Delete a library from RedisGears. - /// - /// the name of the library to delete. - /// if the library was deleted successfully, Error otherwise. - /// //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(); - } - - /// - /// List the functions with additional information about each function. - /// - /// Show libraries code. - /// output verbosity level, higher number will increase verbosity level - /// specifying a library name (can be used - /// multiple times to show multiple libraries in a single command) - /// Information about the requested libraries. - /// //TODO: check this link when it's available - [Obsolete] - public static Dictionary[] TFunctionList(this IDatabase db, bool withCode = false, int verbose = 0, string? libraryName = null) - { - return db.Execute(GearsCommandBuilder.TFunctionList(withCode, verbose, libraryName)).ToDictionarys(); - } - - /// - /// Trigger a sync function. - /// - /// The library name contains the function. - /// The function name to run. - /// keys that will be touched by the function. - /// Additional argument to pass to the function. - /// The return value from the sync & async function on error in case of failure. - /// - [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)); - } - - /// - /// Trigger a async (Coroutine) function. - /// - /// The library name contains the function. - /// The function name to run. - /// keys that will be touched by the function. - /// Additional argument to pass to the function. - /// The return value from the sync & async function on error in case of failure. - /// - [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)); - } - } -} diff --git a/src/NRedisStack/Gears/GearsCommandsAsync.cs b/src/NRedisStack/Gears/GearsCommandsAsync.cs deleted file mode 100644 index 3963dfca..00000000 --- a/src/NRedisStack/Gears/GearsCommandsAsync.cs +++ /dev/null @@ -1,82 +0,0 @@ -using StackExchange.Redis; -namespace NRedisStack -{ - - public static class GearsCommandsAsync //: IGearsCommandsAsync - { - /// - /// Load a new library to RedisGears. - /// - /// the library code. - /// a string representation of a JSON object - /// that will be provided to the library on load time, - /// for more information refer to - /// - /// library configuration - /// an optional argument, instructs RedisGears to replace the function if its already exists. - /// if everything was done correctly, Error otherwise. - /// //TODO: add link to the command when it's available - [Obsolete] - public static async Task TFunctionLoadAsync(this IDatabase db, string libraryCode, string? config = null, bool replace = false) - { - return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionLoad(libraryCode, replace, config))).OKtoBoolean(); - } - - /// - /// Delete a library from RedisGears. - /// - /// the name of the library to delete. - /// if the library was deleted successfully, Error otherwise. - /// //TODO: add link to the command when it's available - [Obsolete] - public static async Task TFunctionDeleteAsync(this IDatabase db, string libraryName) - { - return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionDelete(libraryName))).OKtoBoolean(); - } - - /// - /// List the functions with additional information about each function. - /// - /// Show libraries code. - /// output verbosity level, higher number will increase verbosity level - /// specifying a library name (can be used - /// multiple times to show multiple libraries in a single command) - /// Information about the requested libraries. - /// //TODO: add link to the command when it's available - [Obsolete] - public static async Task[]> TFunctionListAsync(this IDatabase db, bool withCode = false, int verbose = 0, string? libraryName = null) - { - return (await db.ExecuteAsync(GearsCommandBuilder.TFunctionList(withCode, verbose, libraryName))).ToDictionarys(); - } - - /// - /// Trigger a sync function. - /// - /// The library name contains the function. - /// The function name to run. - /// keys that will be touched by the function. - /// Additional argument to pass to the function. - /// The return value from the sync & async function on error in case of failure. - /// - [Obsolete] - public async static Task 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)); - } - - /// - /// Trigger a async (Coroutine) function. - /// - /// The library name contains the function. - /// The function name to run. - /// keys that will be touched by the function. - /// Additional argument to pass to the function. - /// The return value from the sync & async function on error in case of failure. - /// - [Obsolete] - public async static Task 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)); - } - } -} diff --git a/src/NRedisStack/Gears/Literals/CommandArgs.cs b/src/NRedisStack/Gears/Literals/CommandArgs.cs deleted file mode 100644 index 4c9a44a9..00000000 --- a/src/NRedisStack/Gears/Literals/CommandArgs.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace NRedisStack.Gears.Literals -{ - internal class GearsArgs - { - public const string CONFIG = "CONFIG"; - public const string REPLACE = "REPLACE"; - public const string LOAD = "LOAD"; - public const string DELETE = "DELETE"; - public const string LIST = "LIST"; - public const string WITHCODE = "WITHCODE"; - public const string LIBRARY = "LIBRARY"; - } -} diff --git a/src/NRedisStack/Gears/Literals/Commands.cs b/src/NRedisStack/Gears/Literals/Commands.cs deleted file mode 100644 index 7a34dd7e..00000000 --- a/src/NRedisStack/Gears/Literals/Commands.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace NRedisStack.Gears.Literals -{ - /// - /// RedisGears command literals - /// - internal class RG - { - public const string TFUNCTION = "TFUNCTION"; - public const string TFCALL = "TFCALL"; - public const string TFCALLASYNC = "TFCALLASYNC"; - } -}