-
Notifications
You must be signed in to change notification settings - Fork 66
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
Added RM_Call options #290
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The PR added the ability to use RM_Call with different options The available options are: 1. No writes 2. Script mode 3. Acl verification 4. OOM verification 5. Return errors as CallReply objects 6. Replicate the command to replica and AOF 7. Control the protocol version in which the replies will be returned The call option can be give to `call_ext` function which is the same as `call` but also accept the `CallOption` object. In addition the PR allow to get the reply as A CallReply object that wraps the Redis module API CallReply (RedisModuleCallReply*) and allow to avoid unneeded coppies and reply parsing.
Failure is because we need to upgrade the Redis version on CI |
Open
iddm
reviewed
Mar 21, 2023
iddm
previously approved these changes
Mar 21, 2023
iddm
reviewed
Mar 21, 2023
iddm
approved these changes
Mar 22, 2023
Merged
MeirShpilraien
pushed a commit
that referenced
this pull request
Apr 5, 2023
The PR adds Resp3 support for both, return result from module command and getting result as resp3 on `ctx.call_ext` (when resp3 option is used). Tests was added to verify both new functionalities. The PR also refactor the `CallReply` API introduced on #290. Instead of having 2 types of `CallReply` we now have one type such that the root call reply created with `'static` lifetime indicating that the user can hold it for as long as it want. Internal `CallReply` can outlive its father. As part of the refactoring, the `CallReply` was changed to be more rust friendly. `CallReply` was renamed to `CallResult = Result<CallReply, ErrorCallReply>`, `CallReply` is an enum which allows to check the `CallReply` type using a `match` statement.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR added the ability to use RM_Call with different options The available options are:
The call option can be give to
call_ext
function which is the same ascall
but also accept theCallOption
object.In addition the PR allow to get the reply as A CallReply object that wraps the Redis module API CallReply (RedisModuleCallReply*) and allow to avoid unneeded coppies and reply parsing.
Low Level Implementation details
To properly return
CallReply
object we need to be able to define a proper lifetime forCallReply
. The main problem is that Redis makes no distinction between root call reply and inner call reply (that is reachable from the root). The module writer need to make sure he only free the root call reply (and never hold some inner call reply for a longer time then its root).To expose those limitation we implement 2 types on
CallReplies
, theRootCallReply
and theInnerCallReply
. TheRootCallReply
has no life time restriction. TheInnerCallReply
can not outlive theRootCallReply
it was retrieved from.To make the user life easier, both, the
RootCallReply
and theInnerCallReply
implements theCallReply
trait that allows to write a generic code that will work on both.