-
Added Command<nullptr_t> which successfully returns NIL replies from Redis, with REDOX_OK. Also renamed constants from REDISX_ -> REDOX_. Moved a bunch of code from redox.cpp into command.cpp, where it logically makes more sense.
-
Move as much as possible into the .cpp file, and clean things up.
-
Found out that ev_timer watchers have a void* data that allows currying information to the libev callbacks! That means I could stick the Command* in there and completely get rid of the global timer_callbacks map that was needed before. Additionally, we can move ev_timer into the Command object instead of separately allocating it on the heap. Simplifies management. Implemented a synchronous loop speed test based on the latest and greatest command_blocking(). Happy to see it is around 30k/s, which is 100% network delays.
-
Several hours of multithreaded debugging to find a nasty extra ampersand. command_blocking() now returns a Command object with the value and status accessible through methods. Added the option to free memory or not for Command objects when command() is called. If free_memory = true, then the Command object is freed after the callback or error callback returns. If free_memory = false, then the user must call cmd->free(). To implement this, we have to pass in a blank function to the freeObject entry in the hiredis redisReader, because otherwise it automatically frees memory. This was not cool for the blocking case.
-
Implemented error callbacks for command(). Now, either the success or error callbacks are guaranteed to return for any command. Added constants for error types. Many improvements and fixes for memory management. Command objects keep track of pending replies and delete themselves when completed. Changed ReplyT value to remove the const and reference requirements. Now, you do command<ReplyT> and the callback should take a const ReplyT&, whatever the type is. Makes things more uniform.
-
Renamed CommandAsync to Command to make things simpler, and refactored into its own file. command() now returns a pointer to the created Command object, which the client can pass into cancel() to stop any delayed or repeating calls. This is very important for an asynchronous client.
-
Uses libev timer watchers to queue commands on a regular interval. Very fast. Still need to handle deactivation of timers from the user side.