Starkiller
finding a path through the programming world

Hacking Redis: Adding Interval Sets

Adding a Interval Set Datatype to Enable Operations on Ranges

Redis bills itself as a data structure server directly on its homepage; indeed, the project provides a myriad of data structures accessible in a key-value interface. In fact, Redis provides many key components that one might desire in a remote data structure server: a fast asynchronous networking layer, a reference-counting based memory management layer, multiple built-in persistence strategies, and immediate client support for new commands (for some clients, anyway).

However, what Redis lacks is an easy way to add new data structures to the core. Salvatore has explained why he is against a plugin system, and it seems as if such a system will not make its way to Redis. This means we'll have to add a new data structure directly to the Redis core.

Read More


Hacking Redis: Adding a Command

Add a native command to Redis with just a few simple modifications

Redis is a wonderful in-memory data structure database, developed by Salvatore Sanfilippo. Enough has been written about the strengths, weaknesses, and use-cases of Redis; I'm going to focus on the extensibility of Redis to perform custom tasks. To start on a relatively simple note, I'll outline the steps required to add a custom command directly to the Redis codebase.

Read More


Versioned APIs in Rails

Tricks for auto-generating versioned API methods and routes

The company I work for has included an HTTP API along with our core Rails product for a couple of years now. While we originally started with just a few generic API methods to give customers an alternative interface to our data, we quickly realized that we needed to take great care in the development and maturation of our API. Our customers helped us to identify three critical areas they needed assurance with when using our API:
  1. A guarantee that the API methods will always behave as defined and will be unchanging
  2. Thorough documentation describing how to execute each method and what data the method returns / receives.
  3. Error handling to cope with improperly formed requests by client applications
I'll be addressing each of these points in a series of posts following a sample project on Github. To address the problem of guaranteeing the integrity of the API, we need to use an API versioning scheme.

Read More