MyNixOS website logo
Description

Bindings to RocksDB.

direct-rocksdb

CircleCI AppVeyor

Bindings to RocksDB.

Building

This package builds RocksDB in place by default. This requires:

You can use the NINJA_J environment variable to control the number of threads used by ninja, e.g. NINJA_J=2. This is a hack for building on CI, since ninja seems to fail to detect the actual number of CPU cores available.

To skip building and link with system-wide RocksDB, use the system-rocksdb Cabal flag. This is not recommended, since this package is only developed with the latest release of RocksDB.

Using

Database.RocksDB.Internals contains the raw C bindings. All functions and enum values in rocksdb/c.h are covered. The opaque types like rocksdb_t, rocksdb_options_t have corresponding Haskell types like Rocksdb, RocksdbOptions. They are nullary datatypes and are only used to mark the Ptr phantom type.

The higher-level API is being worked on. Using functions like marshalOptions, openDB, you can obtain a ForeignPtr which carries a C resource. The garbage collector can automatically invokes the ForeignPtr finalizers, and you can also use finalizeForeignPtr with something like bracket or ResourceT to ensure scoped finalizing. Also, ByteStrings are used instead of raw buffers.

Some RocksDB functions require passing in a pointer to an error message buffer for error reporting. The higher-level API will obtain the error message and throw it with a RocksDBException when present.

About Windows support

Not working at the moment (builds but crashes when built with mingw-w64 toolchain). May switch to MSVC to fix it.

Metadata

Version

0.0.3

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows