/foundationdb-haskell

Haskell FFI bindings to the FoundationDB C API

Primary LanguageHaskellBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

GitHub CI

API Docs

Haskell bindings for the FoundationDB C client. Currently contains FFI bindings to all of the C API, a Transaction monad for defining transactions (example), and implementations of the standard tuple, subspace and directory layers.

I am not using this in a production-like context, but I have exercised the code rather heavily (heavy transaction rates for days at a time) in both local and cloud environments. The major missing component is directory partitions, but I haven't needed them yet. Generally speaking, the directory layer is the least exercised part of the library.

Supported FoundationDB versions

Currently supports 5.2.x through 7.1.x. By default, this package builds assuming that you have installed the latest supported version of FoundationDB. If not, you need to set the appropriate flag when building the library. For example, if you installed FoundationDB 6.0.x, you need to build with

stack build --flag foundationdb-haskell:fdb-version-600

or

cabal configure -f fdb-version-600 && cabal build

Development

Generating options from fdb.options

FoundationDB provides a specification of available client options. We generate the FoundationDB.Options module from this file with the generate-options executable in this project.

To build the generate-options executable, pass the with-generate-options flag when building. For example, when building with stack, the command is

stack build --flag foundationdb-haskell:with-generate-options

You can then invoke it on fdb.options.

stack exec generate-options -- --file /usr/include/foundationdb/fdb.options

this will create a number of files in the current directory, which should be moved to src/FoundationDB/Options/. A few of the generated files are redundant with what's already generated by c2hs from the header file, and should be omitted.

Generating docs/

stack hoogle --keep-going

copy result to docs/