Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

README.md

RocksServer is server for RocksDB

Supports the following operations:

  • Get value / multi-values by key / keys
  • Set value / multi-values by key / keys
  • Delete key/keys from DB
  • Check if key exists
  • Imcrement value by key
  • Itereate key-value pairs by key-prefix
  • Itereate key-value pairs by seek key or key-prefix

For more details see: protocol description

##Dependency RocksDB, LibEvent

The compiler should support C++11

Install & Run

First install RocksDB dependences:

sudo apt install libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev

Then clone the repository:

git clone --recursive https://github.com/valmat/RocksServer
cd RocksServer

or

git clone https://github.com/valmat/RocksServer
cd RocksServer
git submodule update

After then compile dependencies:

./deps/make.sh

Compile:

cd src
make

After: edit config.ini and run

./RocksServer.bin config.ini

Or you can install it:

switch to root and run

make install

Usage

Exemple of usage:

Or any your own implementation by protocol description.

How to extend

First you need implement your own request listener. To do this, you should to implement the interface

template<typename ProtIn, typename ProtOut>
struct RequestBase: public RequestSuperBase
{
    virtual void run(const ProtIn &, const ProtOut &) = 0;
};

For example: RequestPing.h

struct RequestPing : public RequestBase<ProtocolInTrivial, ProtocolOut>
{
    virtual void run(const ProtocolInTrivial &in, const ProtocolOut &out) override
    {
        out.setStr("pong");
    }
};

After that, you need to implement a plugin: smpl_plug.cpp

#include <rocksserver/api.h>
#include "RequestPing.h"

PLUGIN(Extension &extension)
{
    extension.bind("/ping", new RequestPing());
}

Compile your plugin:

g++ -I. -I"/usr/include/rocksserver/include" -Wall -O3 -std=c++11 -fPIC -c smpl_plug.cpp -o smpl_plug.o
g++ -Wall -std=c++11 -O3 -shared smpl_plug.o -o smpl_plug.so

and copy to /usr/lib/rocksserver/plugins

cp -f smpl_plug.so /usr/lib/rocksserver/plugins/smpl_plug.so

Restart RocksServer. See example how to extend RocksServer.

How to customize

Just edit config.ini

License

BSD

You can’t perform that action at this time.