commit | 68211f31c26d4a42d27e59827a6507be7cbc2dc9 | [log] [tgz] |
---|---|---|
author | Adam Kocoloski <kocolosk@apache.org> | Tue Nov 02 16:34:37 2021 -0400 |
committer | Adam Kocoloski <kocolosk@apache.org> | Sat Nov 06 10:30:06 2021 -0400 |
tree | b865a04a9ba01ec66a68fa2724650276c4c1040b | |
parent | 956920ec44c9e0aca4ea3d2bd71f2bec290a1abf [diff] |
Upgrade to rebar3, add Windows support This patch updates erlfdb to build using rebar3. It relies on rebar3's `pc` plugin to build the NIF instead of the compiled copy of davisp's erlang-native-compiler, which does essentially the same thing. I left the rebar_gdb_plugin code in the repo, although I did not update that plugin to make it compatible with rebar3 yet. With rebar3 in place, I also made the changes necessary to support Windows. One gotcha is that the unit tests will fail unless you set the erlfdb test_cluster_file environment variable to point to a running fdb.cluster file. I didn't get through all the hoops to make the approach of spinning up an embedded fdbserver work in a x-platform way. Apparently Windows doesn't let you supply a Python script for the spawn_executable argument of erlang:open_port/2. I added a rebar3 profile to help here. The following command will cause the test suite to connect to an FDB server that is managing its configuration in the default location on Windows: rebar3 as win32_external_fdbserver eunit
This project is a NIF wrapper for the FoundationDB C API. Documentation on the main API can be found here.
This project also provides a conforming implementation of the Tuple and Directory layers.
Assuming you have installed the FoundationDB C API library, building erlfdb is as simple as:
$ make
Alternatively, adding erlfdb as a rebar dependency should Just Work ®.
Documentation for installing FoundationDB can be found here for macOS or here for Linux.
A simple example showing how to open a database and read and write keys:
Eshell V9.3.3.6 (abort with ^G) 1> Db = erlfdb:open(<<"/usr/local/etc/foundationdb/fdb.cluster">>). {erlfdb_database,#Ref<0.2859661758.3941466120.85406>} 2> ok = erlfdb:set(Db, <<"foo">>, <<"bar">>). ok 3> erlfdb:get(Db, <<"foo">>). <<"bar">> 4> erlfdb:get(Db, <<"bar">>). not_found
FoundationDB has a custom binding tester that can be used to test whether changes have broken compatibility. See the BINDING_TESTER documentation for instructions on building and running that system.