Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Coverage - Implement ZMSCORE #77

Closed
TalZaccai opened this issue Mar 22, 2024 · 3 comments · Fixed by #118
Closed

API Coverage - Implement ZMSCORE #77

TalZaccai opened this issue Mar 22, 2024 · 3 comments · Fixed by #118
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@TalZaccai
Copy link
Contributor

TalZaccai commented Mar 22, 2024

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:

  1. Add the new command info to the sortedSetCommandsInfoMap in the RespCommandsInfo class (Garnet.server/Resp/RespCommandsInfo.cs)
  2. Add the new command string to the returned HashSet in the RespInfo.GetCommands method (Garnet.server/Resp/RespInfo.cs)
  3. 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)
  4. Implement the wrapper method to the storage layer in StorageSession (Garnet.server/Storage/Session/ObjectStore/SortedSetOps.cs)
  5. 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)
  6. 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)
  7. Add a new method to SortedSetObjImpl which will perform the required operation on the hash object (Garnet.server/Objects/SortedSet/SortedSetObjectImpl.cs)
  8. 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)
  9. Add an appropriate case to the switch in TransactionManager.SortedSetObjectKeys (Garnet.server/Transaction/TxnKeyManager.cs)
  10. 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!

@TalZaccai TalZaccai added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 22, 2024
@tisilent
Copy link
Contributor

I want to give it a try. 👻

@darrenge
Copy link
Contributor

Great! Thanks for your help! Let us know if you have any questions :)

@tisilent
Copy link
Contributor

wow

@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants