-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Here's your opportunity to implement a RESP command in Garnet!
Syntax:
ZMSCORE key member [member ...]
Command description:
Returns the scores associated with the specified members
in the sorted set stored at key
.
For every member
that does not exist in the sorted set, a nil value is returned.
Response:
One of the following:
Nil reply: if the member does not exist in the sorted set.
Array reply: a list of string member
scores as double-precision floating point numbers.
How to approach this task:
- Add the new command info to the sortedSetCommandsInfoMap in the RespCommandsInfo class (Garnet.server/Resp/RespCommandsInfo.cs)
- Add the new command string to the returned HashSet in the RespInfo.GetCommands method (Garnet.server/Resp/RespInfo.cs)
- Add the appropriate fast parsing logic for the new command in the RespCommand.FastParseArrayCommand method (use other commands as reference) (Garnet.server/Resp/RespCommand.cs)
- Implement the wrapper method to the storage layer in StorageSession (Garnet.server/Storage/Session/ObjectStore/SortedSetOps.cs)
- Define a new method in IGarnetAPI and implement it in GarnetApiObjectCommands, calling the method you have implemented in step #4 (Garnet.server/API/IGarnetAPI.cs, Garnet.server/API/GarnetApiObjectCommands.cs)
- Add a new method to the RespServerSession class which will call the storage API and return the appropriate response (Garnet.server/Resp/Objects/SortedSetCommands.cs)
- Add a new method to SortedSetObjImpl which will perform the required operation on the hash object (Garnet.server/Objects/SortedSet/SortedSetObjectImpl.cs)
- Add a new enum value to SortedSetOperation and add the appropriate case to the switch in SortedSetObject.Operate, in which you will call the method defined in step #8 (Garnet.server/Objects/SortedSet/SortedSetObject.cs)
- Add an appropriate case to the switch in TransactionManager.SortedSetObjectKeys (Garnet.server/Transaction/TxnKeyManager.cs)
- Add tests for the new command in the RespSortedSetTests class (Garnet.test/RespSortedSetTests.cs)
Tip: First add a simple test that calls the new command and use it to debug as you develop, it will make your life much easier!
If you have any questions, the Garnet team is here to help!
southpyj
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed