-
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
add RESP3 new APIs #280
add RESP3 new APIs #280
Conversation
.with_context(|| "failed to run string.set")?; | ||
|
||
res.sort(); | ||
assert_eq!(&res, &["a", "b", "b", "c", "d", "e"]); |
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.
I was wondering how this test pass but then I notice that its not, also this client does not really check the reply is resp3 right?
@vityafx thanks for the review. I either addressed the comments or added more comments. Let me know what you think. |
@vityafx fixed the Debug implementation and also added Display. Let me know what you think. |
Main changes: * Key space notification API will get the keys as `&[u8]` instead of `&str` because key name can be binary. * ErrorReply was changed to be an enum of `RedisError` or general message so we can return this error type even without having an actual `RedisModuleCallReply` error. * Introduce `DetachContext` struct which implements `Sync` and `Send`. This can be used to create a global context for logging only. * `replicate` can accept also binary data and not only utf8. * `create_string` can accept binary data and not only utf8. * `authenticate_user` implementation was fixed to use the correct `RedisModuleAPI`. * `ThreadSafeContext` lock function was fixed to avoid reuse the context and avoid duplicate context free. * `RedisModule_Init` was split to `RedisModule_Init` and `RedisModule_InitAPI` so we can initialise the API without register a module. This is usefull for modules that load more plugins and want to initialise the `RedisModuleAPI` on the plugin but without Register it as a another module. We should consider back-port this change to Redis. * Move `init_func` callback after finish registration of commands and configuration so configuration value will be applied when called. * Introduce `safe_clone` for `RedisModuleString`. In general `RedisModuleString` is none atomic ref counted object. So it is not safe to clone it if Redis GIL is not hold. `safe_clone` gets a context reference which indicating that Redis GIL is held. * Implement serde serialise and de-serialise for `RedisString` * Fix configuration API `module_args_as_configuration` option to work correctly on imutable configurations. * Added option to specify module costume config get and set commands. Depends on: #280
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 ofCallReply
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. InternalCallReply
can outlive its father.As part of the refactoring, the
CallReply
was changed to be more rust friendly.CallReply
was renamed toCallResult = Result<CallReply, ErrorCallReply>
,CallReply
is an enum which allows to check theCallReply
type using amatch
statement.