Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crclark/foundationdb-haskell

Haskell FFI bindings to the FoundationDB C API
https://github.com/crclark/foundationdb-haskell

database ffi-bindings foundationdb

Last synced: 16 days ago
JSON representation

Haskell FFI bindings to the FoundationDB C API

Awesome Lists containing this project

README

        

[![GitHub CI](https://github.com/crclark/foundationdb-haskell/workflows/CI/badge.svg)](https://github.com/crclark/foundationdb-haskell/actions)

[API Docs](https://crclark.github.io/foundationdb-haskell/)

Haskell bindings for the FoundationDB C client. Currently contains FFI bindings to all of the C API, a `Transaction` monad for defining transactions ([example](https://github.com/crclark/foundationdb-haskell/blob/1f8d0ba2c4985d2fe3d8e6fcbc852c01050af9bb/tests/Properties.hs#L48)), 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](https://github.com/apple/foundationdb/blob/master/fdbclient/vexillographer/fdb.options) 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/`