• User can now enable no-wait mode, which chooses whether we use the
    EVRUN_NOWAIT flag in ev_run. The default is off, so that we don't
    use 100% CPU. Note added in tutorial to enable when performance
    is critical. Added to the speed test examples.
    
    Bump to 0.2.1. Remove patch number from HISTORY entry - that's what the
    git log is for. Make note on minor release.
    Hayk Martirosyan authored
     
    Browse File »




  • Refactor state management code to use three methods .connect(),
    .disconnect(), and .wait(). Start conforming to uniform coding style
    already applied to Command class.
    
    Split off subscribe functionality into its own class Subscriber. This is
    good because it was introducing unnecessary state and complexity into
    the main client. Now, Redox handles publishing like any other command
    and the Subscriber receives messages.
    Hayk Martirosyan authored
     
    Browse File »

  • Now, there is only one callback for command(), and it returns a const
    reference to the Command object. The user is responsible for error
    checking using c.ok(), c.status(), and getting the reply with c.reply().
    This significantly cleans up the library code and the user code.
    
    Greatly refactored the data type specialization code in command.cpp.
    Hayk Martirosyan authored
     
    Browse File »

  • subscribe/unsubscribe/publish with proper and working callbacks. Guard
    added that throws an exception if a non-pubsub command is issued after a
    subscribe.
    
    Also removed all std:: prefixes from redox.cpp. Just made the decision
    for "using namespace std" there for readability. Not a header, of
    course.
    
    Also added another async watcher for breaking the loop, since ev_break
    doesn't actually do anything when called outside of an ev_run callback.
    Hayk Martirosyan authored
     
    Browse File »

  • utils/logger.[ch]pp gives a logger implementation based on ostringstream
    that is pretty nice. I took this from Stack Overflow and added some
    things to make syntax nicer. Changed all cout and cerr statements in
    Redox to be of the form logger.{debug/info/warning/error/fatal}() <<
    stuff. Arguments for non-printed statements are still evaluated. Gives a
    performance hit if we actually add statements on every callback and run
    speed tests. For most use cases, doesn't matter. For now, not including
    such low level output anyway. Would be nice to have a macro to leave
    out/include the low-level logs at compile-time.
    Hayk Martirosyan authored
     
    Browse File »
  • Implemented limited but useful binary data support without breaking the
    API. If the last character of the command is a ", look for the first ",
    and everything in between the quotes treat as binary data. Takes care of
    setting a key with a binary value. Not useful if there need to be
    multiple binary entries in one command, or for binary keys. Also need to
    be careful if the last character of the value actually needs to be a
    quote, in which case we need to quote the value.
    Hayk Martirosyan authored
     
    Browse File »

  • Added GTest under test/. Great for unit testing commands. Added some
    nice helper functions to make writing tests easy.
    
    Added options to CMakeLists to build the library, tests, and examples
    separately, configurable through ccmake. Also default the build type
    to RelWithDebInfo, but don't override user settings.
    Hayk Martirosyan authored
     
    Browse File »

  • Consolidated user callbacks into one, improved some logic.
    Hayk Martirosyan authored
     
    Browse File »
  • Created an atomic_int connect_state that keeps track of not yet
    connected, connected, disconnected, and errors. Used to implement good
    error behavior when the server is down and you start() a Redox instance,
    or when the server goes down in the middle of running commands. Now,
    nothing should hang, but should return errors (or throw exceptions) when
    the server goes down.
    
    Also added hooks for a user connect/disconnect callback in the
    constructor, which is helpful for client programs.
    
    Added an example with three Redox clients in one thread.
    Hayk Martirosyan authored
     
    Browse File »




  • 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.
    Hayk Martirosyan authored
     
    Browse File »
  • Move as much as possible into the .cpp file, and clean things up.
    Hayk Martirosyan authored
     
    Browse File »
  • 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.
    Hayk Martirosyan authored
     
    Browse File »


  • Hayk Martirosyan authored
     
    Browse File »
  • The event loop (now libev) now runs in a separate detached thread,
    which is abstracted away from the user, who only calls a nonblocking
    .start() method. This thread loops continously, alternating telling
    Redis about asynchronous commands ready to send, and running one
    iteration of the event loop, where all pending events are taken
    care of. This greatly simplifies the user code.
    
    Additionally, some clever tricker is implemented now to handle
    memory management well with the templated command types. The
    difficulty comes from the fact that we pass redis a void pointer
    only, and must retreive everything from that (so, we can't use
    shared_ptr for the whole thing). Thus, we use maps of void pointers
    to their templated data structure pointers, where the memory address
    of the pointer serves as the key.
    Hayk Martirosyan authored
     
    Browse File »