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
[NEW] Add an API for RedisModule of DiscardableResponse #10389
Comments
I think that another option we should consider is a reply builder, I imagine something like:
This will allow a module to maintain multiple replies objects and only at the end decide which one to send as reply and which one to discard (unlike the current suggestion where its only possible to maintain and discard the current reply). |
@MeirShpilraien I like the reply builder suggestion, we could probably leverage |
considering Meir's suggestion leverages the existing RedisModuleCallReply, i also support that. just some possibly missing context about the suggestion at the top: |
We have something similar at AWS. We have an API which allows you to get "blocks" to directly serialize data into, which avoids having to serialize data into a different buffer before calling addReply(). These blocks are composed together and can be submitted as a single reply. The intention isn't quite the same, but since this API requires setting a deferred reply, it might be useful to consider how we could support both of these two use cases. |
@madolson if you can, please suggest an API that can avoid the extra copying. |
Hi, here is the API we basically have internally. While reviewing it I noticed a couple of todo's pending before open sourcing that, so if we like this API proposal I can look into it.
|
@madolson Correct me if i'm wrong, doesn't the above API means that module needs to push RESP protocol bytes directly? After discussion with @oranagra we thought we can leverage the The advantage of this approach is that the module does not need to be aware of the protocol used by the current client (resp2 or resp3). We can also have To avoid buffer copies, we can match the underline data structure of the client reply buffers and the CallReply underline structure (client reply list can either contains @madolson @oranagra @yossigo if you agree I can try make a PR and continue the discussion there, let me know what you think. |
The problem/use-case that the feature addresses
Currently, if a module reaches an issue after a reply was sent to the server, there is no way to reverse that.
Description of the feature
Add 3 commands to the modules API:
RM_ReplyWithDiscardableResponse
which will flag replies as discardable.RM_ReplyDiscardDiscardableResponse
which will discard discardable replies.RM_ReplyKeepDiscardableResponse
which will accept discardable replies.Alternatives you've considered
Any alternative solutions or features you've considered, including references to existing open and closed feature requests in this repository.
Additional information
Requested for RediSearch.
@oranagra @MeirShpilraien @K-Jo
The text was updated successfully, but these errors were encountered: