GithubHelp home page GithubHelp logo

skyformat99 / exoredis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jysandy/exoredis

0.0 2.0 0.0 46 KB

A small redis clone, implementing a subset of its commands

CMake 1.20% C++ 88.99% Python 9.80%

exoredis's Introduction

ExoRedis

By J. Y. Sandilya

Dependencies

To build ExoRedis you will need:

  • A C++14 compliant C++ compiler (I suggest g++4.9 or better). I myself use g++ 5.2.
  • CMake. CMake is a C++ build system. It should be available through your distro's package manager.
  • The Boost C++ libraries. These should be available through your distro's package manager.

To install CMake and Boost on Ubuntu, simply run:

sudo apt-get install cmake libboost-all-dev

There are different ways to install the right C++ compiler. If you are using Ubuntu 14.04 then the default g++ package gives you version 4.8.4 which is not recent enough. You will have to use a PPA to install a more recent version. On the other hand if you are using a more recent version of Ubuntu then the default package should do. I myself use Ubuntu 15.10, which gives me g++5.2.

Dependencies of the integration tests

The integration tests are written in Python. To run the integration tests you will need:

  • Python 3.5.1. I suggest using Anaconda/Miniconda to install it.
  • pytest

To install Miniconda, follow the instructions here. I suggest you add the path to your .bashrc when prompted.
Once Miniconda is installed, create a new Python 3 environment for exoredis, activate it and install pytest:

conda create exoredis python=3
source activate exoredis
pip install pytest

Building ExoRedis

First make sure you have the dependencies installed. Then, from the exoredis root directory:

mkdir build
cd build
cmake ..
make

Note: This requires that the symlink /usr/bin/c++ points to your C++14 compiler (if you have installed it using a PPA on Ubuntu, you can use update-alternatives to change this if you want). If this is not the case, use the following commands instead:

mkdir build
cd build
cmake -D CMAKE_CXX_COMPILER=/path/to/your/compiler ..
make

Running ExoRedis

All commands are to be run from the build/ directory.

Running the tests
./unit_tests/tests       # Unit tests
source activate exoredis # Skip this if you've already
                         # activated the env
py.test                  # Integration tests

There should be zero failures. Please get back to me if any test fails.

Running ExoRedis

It is as simple as:

./exoredis <file_name>

Ctrl-C will stop the server.

Code structure

The entry point is in exoredis.cpp. This file also contains the exoredis_server class -- the fundamental server class of ExoRedis.
Logic for handling a connection is in the db_session class in db_session.hpp and db_session.cpp. This class is responsible for reading a command, parsing it, calling the DB API to execute the command and writing the response (or error, as the case may be).
The exostore class is the database class. It implements logic to get, set and expire keys. Data structures are implemented in binary_string and sorted_set. There are also a couple of supporting classes: sorted_set_key and sorted_map_key.
Unit tests are located in the unit_tests folder. Integration tests are in the integration_tests folder.

exoredis's People

Contributors

jysandy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.