couchdb-erlfdb.git
8 months agoInstall FDB synchronously main v1.3.5
Adam Kocoloski [Tue, 25 Jan 2022 23:19:47 +0000 (18:19 -0500)] 
Install FDB synchronously

We were seeing CI failures where the FDB installation would not be
completed before we tried to invoke `fdbcli --version`

8 months agoFix issues caused by foundationdb.org breakage
Adam Kocoloski [Tue, 25 Jan 2022 19:39:05 +0000 (14:39 -0500)] 
Fix issues caused by foundationdb.org breakage

The foundationdb.org collapse and subsequent move to GitHub created a
bit of fallout:

* Update package URLs from foundationdb.org to github.com

* Install Python package via pip as it's not published on GitHub

* Bump version to 6.3.23 as pypi has limited release selection

* Vendor the create_cluster_file.bash script (FDB elected to remove it
  from their published container builds).

8 months agoUpdate URL for FDB packages
Adam Kocoloski [Tue, 25 Jan 2022 18:15:03 +0000 (13:15 -0500)] 
Update URL for FDB packages

8 months agoDeallocate future mutex in the future resource destructor
Nick Vatamaniuc [Tue, 25 Jan 2022 17:31:45 +0000 (12:31 -0500)] 
Deallocate future mutex in the future resource destructor

Otherwise we end up leaking mutexes https://github.com/apache/couchdb-erlfdb/issues/49

10 months agoAvoid reserved keys in tests (#48)
Adam Kocoloski [Fri, 26 Nov 2021 20:44:29 +0000 (15:44 -0500)] 
Avoid reserved keys in tests (#48)

10 months agoRefactor build matrix (#43)
Adam Kocoloski [Wed, 17 Nov 2021 15:48:45 +0000 (10:48 -0500)] 
Refactor build matrix (#43)

Rework and simplify the build through the following enhancements:

* Build against multiple Erlang/OTP versions

* Merge Ubuntu and Windows into a matrix build

* Simplify config by using default fdb.cluster

The last one is a bit obvious in hindsight. We don't need to be passing
around custom overrides for the fdb.cluster file location; all we really
need to do is just trust FDB to figure it out on each platform. To do this
we allow for setting the test_cluster_file env to `system_default` instead
of a path to a specific cluster file.

10 months agoPublish coverage to coveralls.io
Adam Kocoloski [Wed, 10 Nov 2021 19:35:07 +0000 (14:35 -0500)] 
Publish coverage to coveralls.io

10 months agoEnable code coverage for eunit + bindingtester
Adam Kocoloski [Wed, 10 Nov 2021 18:59:44 +0000 (13:59 -0500)] 
Enable code coverage for eunit + bindingtester

The EUnit coverage is on by default. The bindingtester can be enabled
by defining the COVER_ENABLED environment variable. It writes to the
same directory that EUnit does; namely "_build/test/cover/" if ERL_LIBS
is defined to point to the "test" profile for erlfdb (as it should be
for code coverage analysis). For example:

COVER_ENABLED=1 ERL_LIBS=_build/test/lib/erlfdb /usr/src/foundationdb/bindings/bindingtester/bindingtester.py erlang --test-name api --instruction-prefix api --num-ops 10000

We could try to be a little smarter here and align to rebar3's config
options, but I didn't bother with that for now.

10 months agoImplement wrapper for get_estimated_range_size API
Adam Kocoloski [Tue, 9 Nov 2021 16:05:37 +0000 (11:05 -0500)] 
Implement wrapper for get_estimated_range_size API

This is new in 6.3.

10 months agoSupport 6.2.x and 6.3.x in devcontainer
Adam Kocoloski [Tue, 9 Nov 2021 13:36:50 +0000 (08:36 -0500)] 
Support 6.2.x and 6.3.x in devcontainer

6.3 changed the bindingtester code to use Python3, so we need to make
sure to install the Python bindings (used by the binding tester) with
the right version of Python conditional on the minor version of FDB.

10 months agoAdd a matrix job to run binding tests
Adam Kocoloski [Fri, 5 Nov 2021 21:15:31 +0000 (17:15 -0400)] 
Add a matrix job to run binding tests

This job uses the same container image as the .devcontainer. It runs
each of the binding tests for every supported API version (currently
620 and 630), except for `scripted` which only works with the current
API version. It relies on a service container for the underlying FDB
server.

10 months agoFix OOB array access in get_string_array
Adam Kocoloski [Wed, 10 Nov 2021 13:34:23 +0000 (08:34 -0500)] 
Fix OOB array access in get_string_array

Silly bug here, but we didn't catch because for some reason the
get_addresses_for_key function is not part of the bindings tester
specifications. I added a brutally simply unit test to cover it.

10 months agoMerge pull request #37 from apache/configure-fdb-version
Adam Kocoloski [Tue, 9 Nov 2021 12:34:13 +0000 (07:34 -0500)] 
Merge pull request #37 from apache/configure-fdb-version

Configure FDB_API_VERSION dynamically, add full support for FDB 6.3.x

10 months agoMerge pull request #33 from apache/erlfmt
Adam Kocoloski [Tue, 9 Nov 2021 12:32:59 +0000 (07:32 -0500)] 
Merge pull request #33 from apache/erlfmt

Format code using erlfmt

10 months agoAdd support for ENABLE_RUN_LOOP_PROFILING 37/head
Adam Kocoloski [Tue, 9 Nov 2021 01:04:33 +0000 (20:04 -0500)] 
Add support for ENABLE_RUN_LOOP_PROFILING

This is the new name for ENABLE_SLOW_TASK_PROFILING.

10 months agoBuild against latest 6.2 / 6.3 in CI
Adam Kocoloski [Mon, 8 Nov 2021 22:18:30 +0000 (17:18 -0500)] 
Build against latest 6.2 / 6.3 in CI

10 months agoDetect FDB_API_VERSION from fdbcli --version
Adam Kocoloski [Mon, 8 Nov 2021 21:36:14 +0000 (16:36 -0500)] 
Detect FDB_API_VERSION from fdbcli --version

10 months agoRemove CXXFLAGS (this is not C++)
root [Sun, 7 Nov 2021 14:58:46 +0000 (14:58 +0000)] 
Remove CXXFLAGS (this is not C++)

10 months agoAllow command-line override of FDB_API_VERSION
root [Sun, 7 Nov 2021 14:57:59 +0000 (14:57 +0000)] 
Allow command-line override of FDB_API_VERSION

11 months agoEnsure erlfmt compliance in CI 33/head
Adam Kocoloski [Fri, 5 Nov 2021 14:46:51 +0000 (10:46 -0400)] 
Ensure erlfmt compliance in CI

11 months agoFormat code using erlfmt
Adam Kocoloski [Wed, 3 Nov 2021 01:44:29 +0000 (21:44 -0400)] 
Format code using erlfmt

11 months agoAdd erlfmt as a project_plugin
Adam Kocoloski [Wed, 3 Nov 2021 01:15:00 +0000 (21:15 -0400)] 
Add erlfmt as a project_plugin

11 months agoAdd a dev container configuration for VS Code (#27)
Adam Kocoloski [Sat, 6 Nov 2021 18:14:26 +0000 (14:14 -0400)] 
Add a dev container configuration for VS Code (#27)

This creates a development environment with a FoundationDB server and
an erlfdb client in two containers, sharing a network through Docker
Compose.

It uses the FDB image published to Docker Hub for the FDB container, and
downloads the FDB client packages from foundationdb.org to provide the
development headers and libraries. Once the Docker Compose setup is
created, VS Code executes the `create_cluster_file.bash` script to write
down a cluster file containing the IP address in the compose network
where the FDB service can be found, and initializes the FDB server with
a new database.

The use of an external FDB container allows the erlfdb container to be
re-created as needed without losing the underlying data in the FDB
container.

11 months agoRestore ignores for rebar2 artifacts
Adam Kocoloski [Sat, 6 Nov 2021 14:27:44 +0000 (10:27 -0400)] 
Restore ignores for rebar2 artifacts

11 months agoEnable CI using GitHub Actions
Adam Kocoloski [Tue, 2 Nov 2021 20:42:51 +0000 (16:42 -0400)] 
Enable CI using GitHub Actions

This patch sets up a simple GH Action configuration to build and unit
test erlfdb on Windows and Linux. We could get a lot fancier here; my
initial goal was simply to avoid regressions in x-platform support.

I'm using a handful of third-party actions to make this setup work:

- https://github.com/erlef/setup-beam
- https://github.com/ilammy/msvc-dev-cmd
- https://github.com/mxschmitt/action-tmate

ASF policy prohibits the direct use of third-party Actions because it's
not possible to code review each chamnge to them. Importing them as a
submodule pins the action to a specific commit and is the accepted
workaround at this time.

11 months agoUpgrade to rebar3, add Windows support
Adam Kocoloski [Tue, 2 Nov 2021 20:34:37 +0000 (16:34 -0400)] 
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

11 months agoMake dialyzer happy (#32)
Adam Kocoloski [Wed, 3 Nov 2021 20:55:13 +0000 (16:55 -0400)] 
Make dialyzer happy (#32)

* Update a couple of type specs to match reality
* Remove dead code

11 months agoMinor update to metadata
Adam Kocoloski [Tue, 2 Nov 2021 21:00:24 +0000 (17:00 -0400)] 
Minor update to metadata

11 months agoEnable GH issues (#28)
Adam Kocoloski [Fri, 29 Oct 2021 16:54:38 +0000 (12:54 -0400)] 
Enable GH issues (#28)

15 months agoEnsure application environment is loaded (#26)
Adam Kocoloski [Fri, 11 Jun 2021 18:50:00 +0000 (14:50 -0400)] 
Ensure application environment is loaded (#26)

erlfdb is a library application, but starting the app is still
required to make the application environment variables accessible.
Without this hack the `test_cluster_file` setting has no effect during
eunit test executions.

17 months agoUpdate enc (port compiler) to work with Erlang 23 v1.3.4
Nick Vatamaniuc [Sun, 18 Apr 2021 02:53:05 +0000 (22:53 -0400)] 
Update enc (port compiler) to work with Erlang 23

18 months agoMake the default wait timeout infinity (continued) v1.3.3
Nick Vatamaniuc [Tue, 6 Apr 2021 16:26:50 +0000 (12:26 -0400)] 
Make the default wait timeout infinity (continued)

This the continuation of https://github.com/apache/couchdb-erlfdb/pull/22. There,
we updated only one `after` clause and forgot the other. The reasoning is the
same as before -- make erlfdb behave consistent with other FDB clients which
do not have top level client-side timeouts for futures.

18 months agoMake the default wait timeout infinity v1.3.2
Nick Vatamaniuc [Mon, 29 Mar 2021 22:47:53 +0000 (18:47 -0400)] 
Make the default wait timeout infinity

This brings the default behavior in line with other FoundationDB client
libraries which don't use client-side timeouts when waiting for futures to
fire.

A few other reasons are:

  * Currently we may generate spurious future `ready` messages when timeouts
fire during overload scenarios. The caller would have to know to flush ready
messages if they caught a `{timeout, _}`

 * The response may succeed under 5 seconds, but it would be queued in the
   networking layer and throw a `timeout` error on the Erlang side.

 * Timeouts can be set as a transaction or db handle options. It's easier to
   apply configuration defaults there than for individual wait functions.

 * Watch futures are not bound by the 5 second transaction time limit, and
   they'd have to know about the default `wait/1,2` call timeout to know to
   extend it or set it to `infinity`.

18 months agoAdd ERLFDB_IS_RETRYABLE/2 guard v1.3.1
Nick Vatamaniuc [Thu, 25 Mar 2021 22:42:18 +0000 (18:42 -0400)] 
Add ERLFDB_IS_RETRYABLE/2 guard

This is a guard which may be used to catch and handle retryable errors. It's
more ergonomic as a guard than a function, since the handler won't have to
catch and re-throw unwanted (non-retryable) exceptions.

Along with a guard, some common FDB error codes are also defined. It's not an
exhaustive list and mostly consists of retryable and a few other common errors.

18 months agoMake monitor.py use /usr/bin/env python3 v1.3.0
Nick Vatamaniuc [Tue, 9 Mar 2021 21:58:00 +0000 (16:58 -0500)] 
Make monitor.py use /usr/bin/env python3

Previously it was set to `/usr/bin/python`, however on later versions
of Ubuntu and other OSes `/usr/bin/python` is missing. Users may install the
`python-is-python3` package but that is not ideal.

18 months agoMerge pull request #19 from skunkwerks/fix/bsd-hier
Dave Cottlehuber [Tue, 9 Mar 2021 21:56:58 +0000 (21:56 +0000)] 
Merge pull request #19 from skunkwerks/fix/bsd-hier

look in /usr/local/bin/ before /usr/local/sbin/

18 months agolook in /usr/local/bin/ before /usr/local/sbin/ 19/head
Dave Cottlehuber [Mon, 20 Jan 2020 20:13:33 +0000 (20:13 +0000)] 
look in /usr/local/bin/ before /usr/local/sbin/

according to [heir(7)](https://man.freebsd.org/cgi/hier) /sbin/ is for
binaries fundamental to single-user and multi-user environments, which
fdb is definitely not.

18 months agoFix erlfdb_database_set_option `else` case v1.2.9
Nick Vatamaniuc [Tue, 9 Mar 2021 20:04:44 +0000 (15:04 -0500)] 
Fix erlfdb_database_set_option `else` case

This was detected with more a recent compiler as an uninitialized variable:

```
c_src/main.c: In function 'erlfdb_database_set_option':
c_src/main.c:818:9: error: 'option' may be used uninitialized in this function [-Werror=maybe-uninitialized]
```

19 months agoRevert "look in /usr/local/bin/ before /usr/local/sbin/" v1.2.8
Dave Cottlehuber [Fri, 5 Mar 2021 17:11:56 +0000 (17:11 +0000)] 
Revert "look in /usr/local/bin/ before /usr/local/sbin/"

This reverts commit 9ebcc0957cdb9d3a32761b5b25cc6777e3266411.

19 months agoRevert "update enc to allow building on OTP23+"
Dave Cottlehuber [Fri, 5 Mar 2021 17:11:53 +0000 (17:11 +0000)] 
Revert "update enc to allow building on OTP23+"

This reverts commit 0eeca574cc0f0d93d383897a869afc5844ac65e9.

19 months agoUse client buggify options on the client v1.2.7
Nick Vatamaniuc [Thu, 4 Mar 2021 23:06:16 +0000 (18:06 -0500)] 
Use client buggify options on the client

Previously we used plain buggify options which are meant for the server. Switch
them to the client versions.

Can check if it works with: ```
ERL_ZFLAGS="-erlfdb network_options '[client_buggify_enable, {client_buggify_section_activated_probability, 60}, {client_buggify_section_fired_probability, 60}]'" make elixir tests=test/elixir/test/basics_test.exs
```

19 months agolook in /usr/local/bin/ before /usr/local/sbin/
Dave Cottlehuber [Mon, 20 Jan 2020 20:13:33 +0000 (20:13 +0000)] 
look in /usr/local/bin/ before /usr/local/sbin/

according to [heir(7)](https://man.freebsd.org/cgi/hier) /sbin/ is for
binaries fundamental to single-user and multi-user environments, which
fdb is definitely not.

19 months agoupdate enc to allow building on OTP23+
Dave Cottlehuber [Wed, 6 Jan 2021 10:42:23 +0000 (10:42 +0000)] 
update enc to allow building on OTP23+

Also as far back as OTP21. In 2021, the Ericsson OTP team only
officially support OTP22 & OTP23, and in 2022, OTP 24 will replace
OTP22.

See  https://github.com/davisp/erlang-native-compiler/pull/2

19 months agoMerge pull request #15 from apache/freebsd v1.2.6
Joan Touzet [Wed, 3 Mar 2021 17:00:14 +0000 (12:00 -0500)] 
Merge pull request #15 from apache/freebsd

Add /usr/local/{include|lib} to CFLAGS/LDFLAGS

19 months agoAdd /usr/local/{include|lib} to CFLAGS/LDFLAGS 15/head
Joan Touzet [Wed, 3 Mar 2021 08:18:11 +0000 (03:18 -0500)] 
Add /usr/local/{include|lib} to CFLAGS/LDFLAGS

19 months agoAllow fold_range_wait in snapshot mode (#14) v1.2.5
Adam Kocoloski [Mon, 1 Mar 2021 13:23:16 +0000 (08:23 -0500)] 
Allow fold_range_wait in snapshot mode (#14)

This is just a convenience function in case the calling code happens
to supply an erlfdb_snapshot structure instead of an erlfdb_transaction.
It has no actual effect on the semantics since this is merely waiting
on the previously-created future.

21 months agoAvoid sending future ready messages when flushed v1.2.4
Paul J. Davis [Mon, 14 Dec 2020 21:21:22 +0000 (15:21 -0600)] 
Avoid sending future ready messages when flushed

There's a small race condition in `erlfdb:flush_future_message` if the
`is_ready` returns true before the future's callback is invoked to send
the ready message. This adds an API to silence the message from a future
to close this race condition.

Fixes apache/couchdb#3294

22 months agoIdempotent snapshot handle setting v1.2.3
Nick Vatamaniuc [Mon, 16 Nov 2020 20:54:12 +0000 (15:54 -0500)] 
Idempotent snapshot handle setting

If a transaction handle is already a snapshot, make setting it a snapshot again
a no-op.

2 years agoMerge pull request #10 from apache/report-conflicting-keys master
Paul J. Davis [Wed, 2 Sep 2020 20:34:48 +0000 (15:34 -0500)] 
Merge pull request #10 from apache/report-conflicting-keys

Add support for reporting conflicting keys

2 years agoAdd support for reporting conflicting keys 10/head
Paul J. Davis [Wed, 2 Sep 2020 18:55:27 +0000 (13:55 -0500)] 
Add support for reporting conflicting keys

Transactions that fail due to a conflict can be hard to debug. This
exposes a recent feature that reports keys that were in conflict if a
transaction has to be retried due to a conflict.

2 years agoDo not apply default future timeouts to commit and on_error response v1.2.2
Nick Vatamaniuc [Tue, 9 Jun 2020 17:48:07 +0000 (13:48 -0400)] 
Do not apply default future timeouts to commit and on_error response

`commit` should timeout based on the default transaction_too_old (1007) error
or from an explicitly set transaction timeout option (1031).

`on_error` may sleep for some time which is determined by the backoff and retry
counts,it is limited and is guaranteed to return back.

2 years agoCancel fold range futures v1.2.1
Nick Vatamaniuc [Tue, 19 May 2020 19:13:49 +0000 (15:13 -0400)] 
Cancel fold range futures

Previously we had functions to create and wait on fold range futures, but no way
to cancel them. This commit add clauses to `cancel/1,2` to do just that.

Also, once the `?IS_FOLD_FUTURE` macro is defined, use it in a few function
heads instead of the previously used `{fold_info, _, _}` tuple.

2 years agoMerge pull request #6 from apache/fix-monitor-path-detection v1.2.0
iilyak [Thu, 7 May 2020 09:36:35 +0000 (02:36 -0700)] 
Merge pull request #6 from apache/fix-monitor-path-detection

code:priv_dir/1 expects application name

2 years agocode:priv_dir/1 expects application name 6/head
ILYA Khlopotov [Thu, 7 May 2020 08:02:20 +0000 (01:02 -0700)] 
code:priv_dir/1 expects application name

2 years agoAvoid the system key range in the eunit test random key generator. v1.1.0
Nick Vatamaniuc [Thu, 23 Apr 2020 04:57:05 +0000 (00:57 -0400)] 
Avoid the system key range in the eunit test random key generator.

Previously the generator could sometimes return values in the system
range and tests would fail with the unexpected 2004 error.

2 years agoAllow setting some default transaction options on the db handle
Nick Vatamaniuc [Thu, 23 Apr 2020 04:48:48 +0000 (00:48 -0400)] 
Allow setting some default transaction options on the db handle

Since FDB version 6.1 [1] it is possible to set default transaction
options on database handles, and any transactions created from that
handle will inherit those options.

[1] https://apple.github.io/foundationdb/old-release-notes/release-notes-610.html

2 years agoAdd .asf.yaml file for commits and notifications
Nick Vatamaniuc [Wed, 22 Apr 2020 18:54:10 +0000 (14:54 -0400)] 
Add .asf.yaml file for commits and notifications

Instructions from [Apache Infra](https://cwiki.apache.org/confluence/display/INFRA/.asf.yaml+features+for+git+repositories#id-.asf.yamlfeaturesforgitrepositories-Notificationsettingsforrepositories)

2 years agoDo not commit read-only transactions
Nick Vatamaniuc [Wed, 22 Apr 2020 16:25:31 +0000 (12:25 -0400)] 
Do not commit read-only transactions

This might save a round-trip to the network thread [1]. It also follows the
recommendation in the C api docs [2].

[1] https://forums.foundationdb.org/t/performance-of-read-only-transactions/1998
[2] https://apple.github.io/foundationdb/api-c.html#c.fdb_transaction_commit

However, it turns out in order for the watches to fire the read-only
transaction still has to commit, so avoid this optimization if has_watches(Tx)
is true.

2 years agoImplement has_watches(Tx) transaction flag
Nick Vatamaniuc [Wed, 22 Apr 2020 16:24:42 +0000 (12:24 -0400)] 
Implement has_watches(Tx) transaction flag

Returns true if transaction has created any watches. If writes are disallowed,
watches are also cannot be created.

2 years agoMerge pull request #1 from apache/dont-create-new-tx-object-on-retries
Nick Vatamaniuc [Sat, 18 Apr 2020 20:49:13 +0000 (16:49 -0400)] 
Merge pull request #1 from apache/dont-create-new-tx-object-on-retries

Do not create a new transaction object during retries

2 years agoDo not create a new transaction object during retries 1/head
Nick Vatamaniuc [Sat, 18 Apr 2020 19:16:23 +0000 (15:16 -0400)] 
Do not create a new transaction object during retries

`on_error` function automatically resets the transaction object but
preserves retry and backoff-related information in the object. Avoid
creating a new transaction object which would lose that context in
case transactions retry more than 2 times.

Reference:
https://apple.github.io/foundationdb/api-c.html#c.fdb_transaction_on_error

2 years agoMerge pull request #17 from cloudant-labs/encode-lists-like-binaries v1.0.0
Kyle Snavely [Fri, 27 Mar 2020 16:47:01 +0000 (12:47 -0400)] 
Merge pull request #17 from cloudant-labs/encode-lists-like-binaries

erlfdb_tuple:encode/2 should handle lists through binary conversion

2 years agoerlfdb_tuple:encode/2 should provide a clear error message when provided
Kyle Snavely [Thu, 26 Mar 2020 02:48:37 +0000 (20:48 -0600)] 
erlfdb_tuple:encode/2 should provide a clear error message when provided
with a bad term to encode

2 years agoAdd transaction option to disallow writes
Nick Vatamaniuc [Sat, 25 Jan 2020 04:03:28 +0000 (23:03 -0500)] 
Add transaction option to disallow writes

Add `disallow_writes | allow_writes` transaction options.

If the transaction hasn't done any writes yet, it is possible to set the
`disallow_writes` option, and then every write attempt will throw a
`writes_not_allowed` error.

2 years agoBump API level to 620
Nick Vatamaniuc [Mon, 6 Jan 2020 20:56:29 +0000 (15:56 -0500)] 
Bump API level to 620

This comes with a few changes:

 * `fdb_future_get_version` was renamed to `fdb_future_get_int64`
 * a new API: `fdb_transaction_get_approximate_size`
 * `size_limit` transaction option

Reference: https://apple.github.io/foundationdb/release-notes.html#bindings

2 years agoMerge pull request #9 from cloudant-labs/add-get-error-string
Nick Vatamaniuc [Mon, 25 Nov 2019 17:05:41 +0000 (12:05 -0500)] 
Merge pull request #9 from cloudant-labs/add-get-error-string

Expose error string description function in the API

2 years agoExpose error string description function in the API
Nick Vatamaniuc [Mon, 25 Nov 2019 17:00:34 +0000 (12:00 -0500)] 
Expose error string description function in the API

2 years agoAdd instructions on running the fdb bindingtester
Paul J. Davis [Tue, 29 Oct 2019 21:40:36 +0000 (16:40 -0500)] 
Add instructions on running the fdb bindingtester

2 years agoMerge pull request #6 from cloudant-labs/update-api-level-to-610
Nick Vatamaniuc [Tue, 29 Oct 2019 21:33:37 +0000 (17:33 -0400)] 
Merge pull request #6 from cloudant-labs/update-api-level-to-610

Switch API level to 610

2 years agoSwitch API level to 610
Nick Vatamaniuc [Mon, 28 Oct 2019 23:03:37 +0000 (19:03 -0400)] 
Switch API level to 610

There were some changes that had to be accounted for:

 * Cluster is gone, so cluster futures, resources, etc were removed

 * Create database returns a database object not future, so database future
   type is removed.

 * It's possible to use json tracing format on the client, so added that
   netowrk option.

2 years agoAdd a debug utility function
Paul J. Davis [Tue, 29 Oct 2019 21:14:04 +0000 (16:14 -0500)] 
Add a debug utility function

2 years agoEnsure intialization of offset
Paul J. Davis [Tue, 29 Oct 2019 21:12:47 +0000 (16:12 -0500)] 
Ensure intialization of offset

If we don't initialize offset here its possible that a key selector
could apply the provided offset to an uninitialized value passed in from
the calling function.

3 years agoAdding a better README
Paul J. Davis [Wed, 25 Sep 2019 15:44:20 +0000 (10:44 -0500)] 
Adding a better README

3 years agoReplace get_range_raw with fold_range_future/wait
Paul J. Davis [Tue, 6 Aug 2019 16:47:40 +0000 (11:47 -0500)] 
Replace get_range_raw with fold_range_future/wait

This has been bugging me for awhile in that we're not properly handling
the return value from the range future. The `more` return value in
particular was ignored.

Rather than force people to have to repeatedly reimplement this I've
changed `get_range_raw` with a pair of functions `fold_range_future` and
`fold_range_wait`. This allows us the benefit of the async approach
while also ensuring we're not dealing with partial ranges being returned
to users.

3 years agoMerge pull request #5 from cloudant-labs/improve-message-flushing
Nick Vatamaniuc [Mon, 1 Jul 2019 17:17:05 +0000 (13:17 -0400)] 
Merge pull request #5 from cloudant-labs/improve-message-flushing

Improve message flushing

3 years agoImprove message flushing when waiting for a future
Nick Vatamaniuc [Thu, 20 Jun 2019 21:50:50 +0000 (17:50 -0400)] 
Improve message flushing when waiting for a future

Re-use the same function as cancel/2. Also, flush after getting the result to
decreases the change of the message being missed.

3 years agoAdd cancel/2 function, which takes an options argument
Nick Vatamaniuc [Thu, 20 Jun 2019 21:43:46 +0000 (17:43 -0400)] 
Add cancel/2 function, which takes an options argument

When futures are canceled, they may have a `ready` message already in the
mailbox. There is now a way to flush that message with the `[flush]` option.
That is currently the only option.

3 years agoRemember to free the msg_env on future destruction
Paul J. Davis [Thu, 20 Jun 2019 20:59:34 +0000 (15:59 -0500)] 
Remember to free the msg_env on future destruction

3 years agoMark futures as cancelled
Paul J. Davis [Thu, 20 Jun 2019 15:16:11 +0000 (10:16 -0500)] 
Mark futures as cancelled

This allows callers to cancel futures without having to worry about
receiving a `ready` message if the future completes before the
cancellation is applied.

Its possible that a message for this already in the callers message
queue. In which case you can call `cancel(Future, [flush])` to remove
that message.

3 years agoFix reference counting of ErlFDBFuture resources
Paul J. Davis [Thu, 20 Jun 2019 14:45:40 +0000 (09:45 -0500)] 
Fix reference counting of ErlFDBFuture resources

I forgot to account for the fact that we need to keep a reference to the
ErlFDBFuture resources while they are being processed by the network
thread. This change accounts for that fact.

3 years agoMake erlfdb_get_key_selector more user friendly
Paul J. Davis [Fri, 14 Jun 2019 19:16:33 +0000 (14:16 -0500)] 
Make erlfdb_get_key_selector more user friendly

Previously it was not possible to combine the `lt`/`lteq`/`gt`/`gteq`
behaviors with an offset without duplicating all of the logic in
`erlfdb_get_key_selector`. This changes that so a skip can be applied
onto any of those atom based selectors.

3 years agoAdd get_next_tx_id API
Paul J. Davis [Thu, 2 May 2019 17:36:14 +0000 (12:36 -0500)] 
Add get_next_tx_id API

This API provides a transaction ID that can be used in the 12 byte
version stamps to distinguish between version stamps created in a single
transaction. There's a limit of 65,535 transaction ids afterwhich this
function starts throwing badarg exceptions.

3 years agoExpose get_raw_range
Paul J. Davis [Thu, 2 May 2019 17:21:17 +0000 (12:21 -0500)] 
Expose get_raw_range

This allows clients to access the raw futures for range requests.
Clients of this API are then required to manager their own iteration
state and continuation logic.

3 years agoFix get_last_error/1
Paul J. Davis [Fri, 26 Apr 2019 18:30:50 +0000 (13:30 -0500)] 
Fix get_last_error/1

Make sure to use the correct `get/1` function.

3 years agoAdd utilities for creating test clusters
Paul J. Davis [Fri, 26 Apr 2019 17:55:46 +0000 (12:55 -0500)] 
Add utilities for creating test clusters

These utilities allow us to setup a test cluster for use during unit
tests. By default this will setup a cluster once per VM and also re-use
state from old test runs if it exists. Tests should ensure an empty
cluster when necessary by specifying the `empty` option when calling
`erlfdb_util:get_test_db/1`.

3 years agoFlush `ready` message if already sent
Nick Vatamaniuc [Mon, 22 Apr 2019 20:22:44 +0000 (16:22 -0400)] 
Flush `ready` message if already sent

3 years agoRelease future resources properly
Paul J. Davis [Fri, 19 Apr 2019 16:01:39 +0000 (11:01 -0500)] 
Release future resources properly

This prevented all future objects from being properly garbage collected.

3 years agoAdd an API for getting the previous error
Paul J. Davis [Thu, 18 Apr 2019 14:21:56 +0000 (09:21 -0500)] 
Add an API for getting the previous error

3 years agoExpose is_read_only/1 API
Paul J. Davis [Tue, 16 Apr 2019 20:51:47 +0000 (15:51 -0500)] 
Expose is_read_only/1 API

3 years agoStore the error code for clients
Paul J. Davis [Fri, 12 Apr 2019 18:15:27 +0000 (13:15 -0500)] 
Store the error code for clients

Clients of the transactional API may need to refer to which error
occurred in order to react appropriately on transaction retries.

3 years agoAdd tracking of read only transactions
Paul J. Davis [Fri, 12 Apr 2019 17:53:08 +0000 (12:53 -0500)] 
Add tracking of read only transactions

3 years agoOnly unpack the tail after the provided prefix
Paul J. Davis [Tue, 26 Mar 2019 22:08:43 +0000 (17:08 -0500)] 
Only unpack the tail after the provided prefix

3 years agoExport unpack/2
Paul J. Davis [Tue, 26 Mar 2019 22:08:06 +0000 (17:08 -0500)] 
Export unpack/2

3 years agoAllow specifying a prefix for unpack and range
Paul J. Davis [Tue, 26 Mar 2019 20:33:06 +0000 (15:33 -0500)] 
Allow specifying a prefix for unpack and range

This pretty much removes any usefulness from `erlfdb_subspace` since
Erlang doesn't support operator overrides or other similar syntactic
sugar that makes subspaces useful in other languages.

3 years agoUpdate directory-layer-design.md
Kyle Snavely [Fri, 22 Mar 2019 15:02:07 +0000 (11:02 -0400)] 
Update directory-layer-design.md

Just small typos I observed on reviewing the notes.

3 years agoMatch Python catching all exceptions
Paul J. Davis [Mon, 25 Feb 2019 16:52:49 +0000 (10:52 -0600)] 
Match Python catching all exceptions

3 years agoImplement the DirectoryLayer
Paul J. Davis [Fri, 22 Feb 2019 17:19:36 +0000 (11:19 -0600)] 
Implement the DirectoryLayer

This implements a DirectoryLayer intends to behave identically to the
Python version. Soak tests have so far run as long as an hour without
finding issues. However I plan on trying to get that number to upwards
of 24 hours or more.

3 years agoFix wait_for_empty calls in concurrent testing
Paul J. Davis [Fri, 22 Feb 2019 17:13:52 +0000 (11:13 -0600)] 
Fix wait_for_empty calls in concurrent testing

3 years agoUse the new snapshot object for API tests
Paul J. Davis [Fri, 22 Feb 2019 17:12:21 +0000 (11:12 -0600)] 
Use the new snapshot object for API tests

3 years agoFix test runs with concurrency
Paul J. Davis [Fri, 22 Feb 2019 17:10:17 +0000 (11:10 -0600)] 
Fix test runs with concurrency