ratgo is a Go wrapper for RocksDb
Package ratgo provides the ability to create and access RocksDB databases.
RocksDB is a database built by facebook and based on the LevelDB.
This wrapper is based on the levigo which is a wrapper for LevelDB. Thanks to the author Albert Strasheim.
If there are any problems, you can contact me all the time: lizhe.ted@gmail.com
Because RocksDB is still under development, it's interface are not stable and may change during the process. So this package may also not stable.
This wrapper only contains a PARTIAL range of functions.
If you are advanced user, I really recommend you to see their introduction to get full apis.
1.You'll need to clone a copy of RocksDB.
git clone https://github.com/facebook/rocksdb.git
2.Clone a copy of ratgo, and do the following cmd to copy the c.h, and c.cc to the destination place.
git clone https://github.com/senarukana/ratgo.git
cd ratgo
cp ratgo/c.h rocksdb/include/c.h
cp ratgo/c.cc rocksdb/db/c.cc
2.Build the RocksDB and installed the library.
Here is a simple installation:
cd RockDBPATH
make
sudo cp -r /include/rocksdb/ /usr/local/include/
sudo cp librocksdb.a /usr/local/lib/
3.Now, if you build RocksDB and put the shared library and
go get github.com/senarukana/ratgo
4.Test ratgo
go test github.com/senarukana/ratgo
But, suppose you put the shared LevelDB library somewhere weird like /path/to/lib and the headers were installed in /path/to/include.
To install ratgo remotely, you'll run:
CGO_CFLAGS="-I/path/to/rocksdb/include" CGO_LDFLAGS="-L/path/to/rocksdb/lib" go get github.com/senarukana/ratgo
You can see the test in ratgo_test.go or examples in folder examples/ to see how to use it.
I currently use this to build a distributed database RationalDB