commands.go - Overview
This file defines the command structure and initialization for the DiceDB, including command metadata, pre-processing functions, and a registry of available commands. It supports different command types like custom commands, multi-shard commands, and single-shard commands, each with its own evaluation logic.
Detailed Documentation
Type DiceCmdMeta
type DiceCmdMeta struct {
Name string
Info string
Eval func([]string, *dstore.Store) []byte
Arity int
KeySpecs
SubCommands []string
IsMigrated bool
NewEval func([]string, *dstore.Store) *EvalResponse
StoreObjectEval func(*cmd.DiceDBCmd, *dstore.Store) *EvalResponse
}
Describes the metadata for a DiceDB command.
Name
: The name of the command.Info
: A brief description of the command.Eval
: The evaluation function for the command (older evaluation logic). It takes a slice of strings (arguments) and a pointer to adstore.Store
, and returns a byte slice.Arity
: The number of arguments the command accepts. Use negative values to indicate >= N.KeySpecs
: Specifies key-related information.SubCommands
: A list of sub-commands supported by the command.IsMigrated
: Indicates whether the command has been migrated to a newer evaluation mechanism (NewEval
).NewEval
: The newer evaluation function for the command. It takes a slice of strings (arguments) and a pointer to adstore.Store
, and returns a pointer to anEvalResponse
.StoreObjectEval
: A specialized evaluation function for commands that operate on an object. It takes acmd.DiceDBCmd
and a pointer to adstore.Store
, and returns a pointer to anEvalResponse
.
Type KeySpecs
type KeySpecs struct {
BeginIndex int
Step int
LastKey int
}
Defines specifications for keys.
BeginIndex
: The starting index for key arguments.Step
: The step size for key iteration.LastKey
: The index of the last key.
Variable PreProcessing
var (
PreProcessing = map[string]func([]string, *dstore.Store) *EvalResponse{}
DiceCmds = map[string]DiceCmdMeta{}
)
PreProcessing
: A map of command names to pre-processing functions. These functions take a slice of strings (arguments) and a pointer to adstore.Store
, and return a pointer to anEvalResponse
.DiceCmds
: A map of command names to theirDiceCmdMeta
metadata.
Variable helloCmdMeta
var (
helloCmdMeta = DiceCmdMeta{
Name: "HELLO",
Info: `HELLO always replies with a list of current server and connection properties, such as: versions, modules loaded, client ID, replication role and so forth`,
Eval: evalHELLO,
Arity: -1,
}
Defines the metadata for the HELLO
command.
Name
:"HELLO"
Info
: Description of theHELLO
command.Eval
:evalHELLO
function to evaluate the command.Arity
:-1
(accepts any number of arguments).
Variable authCmdMeta
authCmdMeta = DiceCmdMeta{
Name: "AUTH",
Info: `AUTH returns with an encoded "OK" if the user is authenticated.
If the user is not authenticated, it returns with an encoded error message`,
Eval: nil,
}
Defines the metadata for the AUTH
command.
Name
:"AUTH"
Info
: Description of theAUTH
command.Eval
:nil
(evaluation function is not defined).
Variable abortCmdMeta
abortCmdMeta = DiceCmdMeta{
Name: "ABORT",
Info: "Quit the server",
Eval: nil,
Arity: 1,
}
Defines the metadata for the ABORT
command.
Name
:"ABORT"
Info
: Description of theABORT
command.Eval
:nil
(evaluation function is not defined).Arity
:1
(accepts one argument).
Variable sleepCmdMeta
sleepCmdMeta = DiceCmdMeta{
Name: "SLEEP",
Info: `SLEEP sets db to sleep for the specified number of seconds.
The sleep time should be the only param in args.
Returns error response if the time param in args is not of integer format.
SLEEP returns RespOK after sleeping for mentioned seconds`,
Eval: evalSLEEP,
Arity: 1,
}
Defines the metadata for the SLEEP
command.
Name
:"SLEEP"
Info
: Description of theSLEEP
command.Eval
:evalSLEEP
function to evaluate the command.Arity
:1
(accepts one argument).
Variable objectCopyCmdMeta
objectCopyCmdMeta = DiceCmdMeta{
Name: "OBJECTCOPY",
Info: `COPY command copies the value stored at the source key to the destination key.`,
StoreObjectEval: evalCOPYObject,
IsMigrated: true,
Arity: -2,
}
Defines the metadata for the OBJECTCOPY
command.
Name
:"OBJECTCOPY"
Info
: Description of theOBJECTCOPY
command.StoreObjectEval
:evalCOPYObject
function to evaluate the command, operating on an object.IsMigrated
:true
(indicates that the command is migrated).Arity
:-2
(accepts two or more arguments).
Variable pfMergeCmdMeta
pfMergeCmdMeta = DiceCmdMeta{
Name: "PFMERGE",
Info: `PFMERGE destkey [sourcekey [sourcekey ...]]
Merges one or more HyperLogLog values into a single key.`,
IsMigrated: true,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
StoreObjectEval: evalPFMERGE,
}
Defines the metadata for the PFMERGE
command.
Name
:"PFMERGE"
Info
: Description of thePFMERGE
command.IsMigrated
:true
(indicates that the command is migrated).Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).StoreObjectEval
:evalPFMERGE
function to evaluate the command, operating on an object.
Variable jsonsetCmdMeta
jsonsetCmdMeta = DiceCmdMeta{
Name: "JSON.SET",
Info: `JSON.SET key path json-string
Sets a JSON value at the specified key.
Returns OK if successful.
Returns encoded error message if the number of arguments is incorrect or the JSON string is invalid.`,
NewEval: evalJSONSET,
Arity: -3,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.SET
command.
Name
:"JSON.SET"
Info
: Description of theJSON.SET
command.NewEval
:evalJSONSET
function to evaluate the command using the new evaluation logic.Arity
:-3
(accepts three or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsongetCmdMeta
jsongetCmdMeta = DiceCmdMeta{
Name: "JSON.GET",
Info: `JSON.GET key [path]
Returns the encoded RESP value of the key, if present
Null reply: If the key doesn't exist or has expired.
Error reply: If the number of arguments is incorrect or the stored value is not a JSON type.`,
NewEval: evalJSONGET,
Arity: 2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.GET
command.
Name
:"JSON.GET"
Info
: Description of theJSON.GET
command.NewEval
:evalJSONGET
function to evaluate the command using the new evaluation logic.Arity
:2
(accepts two arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsontoggleCmdMeta
jsontoggleCmdMeta = DiceCmdMeta{
Name: "JSON.TOGGLE",
Info: `JSON.TOGGLE key [path]
Toggles Boolean values between true and false at the path.Return
If the path is enhanced syntax:
1.Array of integers (0 - false, 1 - true) that represent the resulting Boolean value at each path.
2.If a value is a not a Boolean value, its corresponding return value is null.
3.NONEXISTENT if the document key does not exist.
If the path is restricted syntax:
1.String ("true"/"false") that represents the resulting Boolean value.
2.NONEXISTENT if the document key does not exist.
3.WRONGTYPE error if the value at the path is not a Boolean value.`,
NewEval: evalJSONTOGGLE,
Arity: 2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.TOGGLE
command.
Name
:"JSON.TOGGLE"
Info
: Description of theJSON.TOGGLE
command.NewEval
:evalJSONTOGGLE
function to evaluate the command using the new evaluation logic.Arity
:2
(accepts two arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsontypeCmdMeta
jsontypeCmdMeta = DiceCmdMeta{
Name: "JSON.TYPE",
Info: `JSON.TYPE key [path]
Returns string reply for each path, specified as the value's type.
Returns RespNIL If the key doesn't exist.
Error reply: If the number of arguments is incorrect.`,
NewEval: evalJSONTYPE,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.TYPE
command.
Name
:"JSON.TYPE"
Info
: Description of theJSON.TYPE
command.NewEval
:evalJSONTYPE
function to evaluate the command using the new evaluation logic.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsonclearCmdMeta
jsonclearCmdMeta = DiceCmdMeta{
Name: "JSON.CLEAR",
Info: `JSON.CLEAR key [path]
Returns an integer reply specifying the number ofmatching JSON arrays and
objects cleared +number of matching JSON numerical values zeroed.
Error reply: If the number of arguments is incorrect the key doesn't exist.`,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
NewEval: evalJSONCLEAR,
}
Defines the metadata for the JSON.CLEAR
command.
Name
:"JSON.CLEAR"
Info
: Description of theJSON.CLEAR
command.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONCLEAR
function to evaluate the command using the new evaluation logic.
Variable jsondelCmdMeta
jsondelCmdMeta = DiceCmdMeta{
Name: "JSON.DEL",
Info: `JSON.DEL key [path]
Returns an integer reply specified as the number of paths deleted (0 or more).
Returns RespZero if the key doesn't exist or key is expired.
Error reply: If the number of arguments is incorrect.`,
NewEval: evalJSONDEL,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.DEL
command.
Name
:"JSON.DEL"
Info
: Description of theJSON.DEL
command.NewEval
:evalJSONDEL
function to evaluate the command using the new evaluation logic.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsonarrappendCmdMeta
jsonarrappendCmdMeta = DiceCmdMeta{
Name: "JSON.ARRAPPEND",
Info: `JSON.ARRAPPEND key [path] value [value ...]
Returns an array of integer replies for each path, the array's new size,
or nil, if the matching JSON value is not an array.`,
Arity: -3,
IsMigrated: true,
NewEval: evalJSONARRAPPEND,
}
Defines the metadata for the JSON.ARRAPPEND
command.
Name
:"JSON.ARRAPPEND"
Info
: Description of theJSON.ARRAPPEND
command.Arity
:-3
(accepts three or more arguments).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONARRAPPEND
function to evaluate the command using the new evaluation logic.
Variable jsonforgetCmdMeta
jsonforgetCmdMeta = DiceCmdMeta{
Name: "JSON.FORGET",
Info: `JSON.FORGET key [path]
Returns an integer reply specified as the number of paths deleted (0 or more).
Returns RespZero if the key doesn't exist or key is expired.
Error reply: If the number of arguments is incorrect.`,
NewEval: evalJSONFORGET,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.FORGET
command.
Name
:"JSON.FORGET"
Info
: Description of theJSON.FORGET
command.NewEval
:evalJSONFORGET
function to evaluate the command using the new evaluation logic.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsonarrlenCmdMeta
jsonarrlenCmdMeta = DiceCmdMeta{
Name: "JSON.ARRLEN",
Info: `JSON.ARRLEN key [path]
Returns an array of integer replies.
Returns error response if the key doesn't exist or key is expired or the matching value is not an array.
Error reply: If the number of arguments is incorrect.`,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
NewEval: evalJSONARRLEN,
}
Defines the metadata for the JSON.ARRLEN
command.
Name
:"JSON.ARRLEN"
Info
: Description of theJSON.ARRLEN
command.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONARRLEN
function to evaluate the command using the new evaluation logic.
Variable jsonnummultbyCmdMeta
jsonnummultbyCmdMeta = DiceCmdMeta{
Name: "JSON.NUMMULTBY",
Info: `JSON.NUMMULTBY key path value
Multiply the number value stored at the specified path by a value.`,
NewEval: evalJSONNUMMULTBY,
Arity: 3,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.NUMMULTBY
command.
Name
:"JSON.NUMMULTBY"
Info
: Description of theJSON.NUMMULTBY
command.NewEval
:evalJSONNUMMULTBY
function to evaluate the command using the new evaluation logic.Arity
:3
(accepts three arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsonobjlenCmdMeta
jsonobjlenCmdMeta = DiceCmdMeta{
Name: "JSON.OBJLEN",
Info: `JSON.OBJLEN key [path]
Report the number of keys in the JSON object at path in key
Returns error response if the key doesn't exist or key is expired or the matching value is not an array.
Error reply: If the number of arguments is incorrect.`,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
NewEval: evalJSONOBJLEN,
}
Defines the metadata for the JSON.OBJLEN
command.
Name
:"JSON.OBJLEN"
Info
: Description of theJSON.OBJLEN
command.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONOBJLEN
function to evaluate the command using the new evaluation logic.
Variable jsondebugCmdMeta
jsondebugCmdMeta = DiceCmdMeta{
Name: "JSON.DEBUG",
Info: `evaluates JSON.DEBUG subcommand based on subcommand
JSON.DEBUG MEMORY returns memory usage by key in bytes
JSON.DEBUG HELP displays help message
`,
Arity: 2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
NewEval: evalJSONDebug,
}
Defines the metadata for the JSON.DEBUG
command.
Name
:"JSON.DEBUG"
Info
: Description of theJSON.DEBUG
command.Arity
:2
(accepts two arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONDebug
function to evaluate the command using the new evaluation logic.
Variable jsonobjkeysCmdMeta
jsonobjkeysCmdMeta = DiceCmdMeta{
Name: "JSON.OBJKEYS",
Info: `JSON.OBJKEYS key [path]
Retrieves the keys of a JSON object stored at path specified.
Null reply: If the key doesn't exist or has expired.
Error reply: If the number of arguments is incorrect or the stored value is not a JSON type.`,
NewEval: evalJSONOBJKEYS,
IsMigrated: true,
Arity: 2,
}
Defines the metadata for the JSON.OBJKEYS
command.
Name
:"JSON.OBJKEYS"
Info
: Description of theJSON.OBJKEYS
command.NewEval
:evalJSONOBJKEYS
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:2
(accepts two arguments).
Variable jsonarrpopCmdMeta
jsonarrpopCmdMeta = DiceCmdMeta{
Name: "JSON.ARRPOP",
Info: `JSON.ARRPOP key [path [index]]
Removes and returns an element from the index in the array and updates the array in memory.
Returns error if key doesn't exist.
Return nil if array is empty or there is no array at the path.
It supports negative index and is out of bound safe.
`,
Arity: -2,
IsMigrated: true,
NewEval: evalJSONARRPOP,
}
Defines the metadata for the JSON.ARRPOP
command.
Name
:"JSON.ARRPOP"
Info
: Description of theJSON.ARRPOP
command.Arity
:-2
(accepts two or more arguments).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONARRPOP
function to evaluate the command using the new evaluation logic.
Variable jsoningestCmdMeta
jsoningestCmdMeta = DiceCmdMeta{
Name: "JSON.INGEST",
Info: `JSON.INGEST key_prefix json-string
The whole key is generated by appending a unique identifier to the provided key prefix.
the generated key is then used to store the provided JSON value at specified path.
Returns unique identifier if successful.
Returns encoded error message if the number of arguments is incorrect or the JSON string is invalid.`,
NewEval: evalJSONINGEST,
Arity: -3,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
}
Defines the metadata for the JSON.INGEST
command.
Name
:"JSON.INGEST"
Info
: Description of theJSON.INGEST
command.NewEval
:evalJSONINGEST
function to evaluate the command using the new evaluation logic.Arity
:-3
(accepts three or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).
Variable jsonarrinsertCmdMeta
jsonarrinsertCmdMeta = DiceCmdMeta{
Name: "JSON.ARRINSERT",
Info: `JSON.ARRINSERT key path index value [value ...]
Returns an array of integer replies for each path.
Returns nil if the matching JSON value is not an array.
Returns error response if the key doesn't exist or key is expired or the matching value is not an array.
Error reply: If the number of arguments is incorrect.`,
NewEval: evalJSONARRINSERT,
IsMigrated: true,
Arity: -5,
KeySpecs: KeySpecs{BeginIndex: 1},
}
Defines the metadata for the JSON.ARRINSERT
command.
Name
:"JSON.ARRINSERT"
Info
: Description of theJSON.ARRINSERT
command.NewEval
:evalJSONARRINSERT
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:-5
(accepts five or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).
Variable jsonrespCmdMeta
jsonrespCmdMeta = DiceCmdMeta{
Name: "JSON.RESP",
Info: `JSON.RESP key [path]
Return the JSON present at key`,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1},
IsMigrated: true,
NewEval: evalJSONRESP,
}
Defines the metadata for the JSON.RESP
command.
Name
:"JSON.RESP"
Info
: Description of theJSON.RESP
command.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1}
(key specification with begin index 1).IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalJSONRESP
function to evaluate the command using the new evaluation logic.
Variable jsonarrtrimCmdMeta
jsonarrtrimCmdMeta = DiceCmdMeta{
Name: "JSON.ARRTRIM",
Info: `JSON.ARRTRIM key path start stop
Trim an array so that it contains only the specified inclusive range of elements
Returns an array of integer replies for each path.
Returns error response if the key doesn't exist or key is expired.
Error reply: If the number of arguments is incorrect.`,
NewEval: evalJSONARRTRIM,
IsMigrated: true,
Arity: -5,
}
Defines the metadata for the JSON.ARRTRIM
command.
Name
:"JSON.ARRTRIM"
Info
: Description of theJSON.ARRTRIM
command.NewEval
:evalJSONARRTRIM
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:-5
(accepts five or more arguments).
Variable incrByFloatCmdMeta
incrByFloatCmdMeta = DiceCmdMeta{
Name: "INCRBYFLOAT",
Info: `INCRBYFLOAT increments the value of the key in args by the specified increment,
if the key exists and the value is a number.
The key should be the first parameter in args, and the increment should be the second parameter.
If the key does not exist, a new key is created with increment's value.
If the value at the key is a string, it should be parsable to float64,
if not INCRBYFLOAT returns an error response.
INCRBYFLOAT returns the incremented value for the key after applying the specified increment if there are no errors.`,
Arity: 2,
NewEval: evalINCRBYFLOAT,
IsMigrated: true,
}
Defines the metadata for the INCRBYFLOAT
command.
Name
:"INCRBYFLOAT"
Info
: Description of theINCRBYFLOAT
command.Arity
:2
(accepts two arguments).NewEval
:evalINCRBYFLOAT
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).
Variable clientCmdMeta
clientCmdMeta = DiceCmdMeta{
Name: "CLIENT",
Info: `This is a container command for client connection commands.`,
NewEval: evalCLIENT,
IsMigrated: true,
Arity: -2,
}
Defines the metadata for the CLIENT
command.
Name
:"CLIENT"
Info
: Description of theCLIENT
command.NewEval
:evalCLIENT
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:-2
(accepts two or more arguments).
Variable latencyCmdMeta
latencyCmdMeta = DiceCmdMeta{
Name: "LATENCY",
Info: `This is a container command for latency diagnostics commands.`,
NewEval: evalLATENCY,
IsMigrated: true,
Arity: -2,
}
Defines the metadata for the LATENCY
command.
Name
:"LATENCY"
Info
: Description of theLATENCY
command.NewEval
:evalLATENCY
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:-2
(accepts two or more arguments).
Variable bfreserveCmdMeta
bfreserveCmdMeta = DiceCmdMeta{
Name: "BF.RESERVE",
Info: `BF.RESERVE command initializes a new bloom filter and allocation it's relevant parameters based on given inputs.
If no params are provided, it uses defaults.`,
IsMigrated: true,
NewEval: evalBFRESERVE,
Arity: -2,
KeySpecs: KeySpecs{BeginIndex: 1, Step: 1},
}
Defines the metadata for the BF.RESERVE
command.
Name
:"BF.RESERVE"
Info
: Description of theBF.RESERVE
command.IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalBFRESERVE
function to evaluate the command using the new evaluation logic.Arity
:-2
(accepts two or more arguments).KeySpecs
:KeySpecs{BeginIndex: 1, Step: 1}
(key specification with begin index 1 and step 1).
Variable bfaddCmdMeta
bfaddCmdMeta = DiceCmdMeta{
Name: "BF.ADD",
Info: `BF.ADD adds an element to
a bloom filter. If the filter does not exists, it will create a new one
with default parameters.`,
IsMigrated: true,
NewEval: evalBFADD,
Arity: 3,
KeySpecs: KeySpecs{BeginIndex: 1, Step: 1},
}
Defines the metadata for the BF.ADD
command.
Name
:"BF.ADD"
Info
: Description of theBF.ADD
command.IsMigrated
:true
(indicates that the command is migrated).NewEval
:evalBFADD
function to evaluate the command using the new evaluation logic.Arity
:3
(accepts three arguments).KeySpecs
:KeySpecs{BeginIndex: 1, Step: 1}
(key specification with begin index 1 and step 1).
Variable bfexistsCmdMeta
bfexistsCmdMeta = DiceCmdMeta{
Name: "BF.EXISTS",
Info: `BF.EXISTS checks existence of an element in a bloom filter.`,
NewEval: evalBFEXISTS,
IsMigrated: true,
Arity: 3,
KeySpecs: KeySpecs{BeginIndex: 1, Step: 1},
}
Defines the metadata for the BF.EXISTS
command.
Name
:"BF.EXISTS"
Info
: Description of theBF.EXISTS
command.NewEval
:evalBFEXISTS
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:3
(accepts three arguments).KeySpecs
:KeySpecs{BeginIndex: 1, Step: 1}
(key specification with begin index 1 and step 1).
Variable bfinfoCmdMeta
bfinfoCmdMeta = DiceCmdMeta{
Name: "BF.INFO",
Info: `BF.INFO returns the parameters and metadata of an existing bloom filter.`,
NewEval: evalBFINFO,
IsMigrated: true,
Arity: 2,
}
Defines the metadata for the BF.INFO
command.
Name
:"BF.INFO"
Info
: Description of theBF.INFO
command.NewEval
:evalBFINFO
function to evaluate the command using the new evaluation logic.IsMigrated
:true
(indicates that the command is migrated).Arity
:2
(accepts two arguments).
Variable setBitCmdMeta
setBitCmdMeta = DiceCmdMeta{
Name: "SETBIT",
Info: "SETBIT sets or clears the bit at offset in the string value stored at key",
IsMigrated: true,
NewEval: evalSETBIT,
}
Defines the metadata for the SETBIT
command.