-
Notifications
You must be signed in to change notification settings - Fork 3
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
Allow querying and returning multiple items at once in chainHead_unstable_storage
#51
Conversation
chainHead_unstable_storage
chainHead_unstable_storage
chainHead_unstable_storage
chainHead_unstable_storage
It actually closes: #47 and #48
From the consumer point of view: the ideal API would be such that it would return an Object (rather than returning an Array) where the keys of this Object would be the different keys that were passed on the However, if this makes the implementation of the JSON-RPC server even more complex and/or unperformant, then it's not a big deal, of course, since we can handle that on the client-side. |
That means that the server might have to wait for some of the results to have come back. |
I'm afraid that I didn't explain myself very well. With what I'm proposing the server wouldn't have to wait, no. It would just send an Object with what it has at the moment. If later it receives more data, then it can send another But again, if this means a lot of headaches on the server-side, then the API that you are suggesting is perfectly fine, for sure! This is just a "nice to have" from the consumer standpoint, not a big deal. |
So, @tomaka: what do you think about emitting a dictionary, rather than emitting an list? Does it make sense? Does it make the spec and/or the implementation on the server too complex? Once again: that suggestion was just a "it would be even nicer, if...". So, if you are on the fence, then let's go with what's in this PR. The last thing that I would want is for this PR to become stale. Please let me know what's your preference. Thanks! |
The server can accommodate both solutions, because if sending an object is too annoying it can always bypass the problem by sending multiple However, if the server wants to generate as few In other words, the best possible server-side performance can only be achieved if you return a list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomaka thank you so much for listening to the feedback and for acting so promptly on it. From the side of someone who is trying to create a JSON-RPC client based on this spec: I have to say that I'm super happy with these changes.
I will let @lexnv merge this, in case that he has some questions or reservations on his end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for extending this 🙏
Co-authored-by: Alexandru Vasile <[email protected]>
Close #48
Close #47
This complicates the API quite a bit, and a lot of subtle details needed to change in order for this to work:
key
in order to avoid ambiguities when you request the closest descendant Merkle value of multiple items at the same time.