-
Notifications
You must be signed in to change notification settings - Fork 44
Adds support for PubSub state restoration #375
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
Adds support for PubSub state restoration #375
Conversation
|
@mzimbres this is a prototype of the pubsub state restoration feature. I'd like to get this done before the next release, so we can make The idea is that, when adding a This requires inspecting command arguments from This is still missing docs and tests - let me know if you think this is the right approach before spending time on these. Also, I can split the PR into smaller ones (e.g. deprecating the old extension point first) if you think it's best. |
|
This will be a great improvement over the current complex resubscribe loop, so you have my approval. I don't understand yet why |
At the point of |
I think we should avoid all this trouble by adding |
|
This does work for this task, but idk if it does for cluster (I don't have the answer to this question, maybe it does). Cluster needs to know the key each command is acting on and compute its hash to know where to direct the command to. We could support some syntax like Although you probably need a regular and a range version of the command. |
This looks interesting because with reflection we could perhaps generate these structs automatically from a description doc (I would call it |
|
ATM reflection can only generate aggregates. I lack the vision to know if that'd be enough (it wouldn't if we need a templated range, for instance). It'd much better for usability having functions in request, actually. But then request is gonna end up having zounds of functions, and not all of them used frequently. |
|
How about req.push2(subscribe, {"channel", "channel2"});Where subscribe is an object of type struct subscribe_t {
void operator ()(request& r, initializer_list<string_view>);
// maybe other overloads
};so push2 can just call into the passed object forwarding all the args. This way we can define each command (or family of commands) in a separate header. |
This is what I like most so far. I don't mind having lots of member function and overloads for each command. The complexity is not our invention but intrinsic to Redis. The only question is what to do when Valkey and Redis have a different definition for the same command. |
|
How about req.push2(subscribe).with({"ch1", "ch2"});The difference is that we avoid forwarding args in push2. This allows us to use things like initializer lists without incurring in problems. I'm wary of adding too many member functions to request. We can easily end up with 1000 member functions if we end up adding support for all commands, each one having different overloads. This may not be the best for compile times. |
|
@mzimbres I've implemented this in terms of |
Adds config::restore_pubsub_state and command_context
Deprecates the boost_redis_to_bulk extension point taking a std::string& argument, in favor of an extension point with the same name taking a command_context argument
close #367