Git Product home page Git Product logo

gorocks's Introduction

gorocks

gorocks is a Go wrapper for rocksdb based on levigo.

Building

You'll need the shared library build of rocksdb installed on your machine. The current rocksdb will build it by default.

The minimum version of rocksdb required is currently 1.7. If you require the use of an older version of rocksdb, see the fork of levigo for rocksdb 1.4. Prefer putting in the work to be up to date as rocksdb moves very quickly.

Now, if you build rocksdb and put the shared library and headers in one of the standard places for your OS, you'll be able to simply run:

go get github.com/tobyhede/gorocks

But, suppose you put the shared rocksdb library somewhere weird like /path/to/lib and the headers were installed in /path/to/include. To install levigo remotely, you'll run:

CGO_CFLAGS="-I/path/to/rocksdb/include" CGO_LDFLAGS="-L/path/to/rocksdb/lib" go get github.com/jmhodges/levigo

and there you go.

In order to build with snappy, you'll have to explicitly add "-lsnappy" to the CGO_LDFLAGS. Supposing that both snappy and rocksdb are in weird places, you'll run something like:

CGO_CFLAGS="-I/path/to/rocksdb/include -I/path/to/snappy/include"
CGO_LDFLAGS="-L/path/to/rocksdb/lib -L/path/to/snappy/lib -lsnappy" go get github.com/jmhodges/levigo

(and make sure the -lsnappy is after the snappy library path!).

Of course, these same rules apply when doing go build, as well.

Caveats

Comparators and WriteBatch iterators must be written in C in your own library. This seems like a pain in the ass, but remember that you'll have the rocksdb C API available to your in your client package when you import levigo.

An example of writing your own Comparator can be found in https://github.com/jmhodges/levigo/blob/master/examples.

gorocks's People

Contributors

jmhodges avatar milaz avatar albertjin avatar evanphx avatar jvshahid avatar soniah avatar mei-rune avatar

Watchers

James Cloos avatar Philippe Ombredanne 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.