Khepri 0.1.1
At this point, Khepri should be considered Alpha and not production ready. The API will likely evolve and future releases will likely introduce breaking changes. The goal of this release is to make it easy for anyone to try it and possibly give feedback.
What's new in Khepri 0.1.1
ReadWrite
argument to khepri_tx:transaction/2
changes
The transaction API changed: khepri_tx:transaction/2
now takes the atoms ro
, rw
or auto
as its second argument, instead of a boolean or auto
. It makes it a bit clearer what the argument means out of context, compared to a boolean. This impacts the following APIs:
khepri:transaction/2
khepri:transaction/3
khepri_machine:transaction/2
khepri_machine:transaction/3
Here are the modifications you will have to do in your code:
%% Read/write transaction:
khepri:transaction(StoreId, Fun, true). % Up until 0.1.0
khepri:transaction(StoreId, Fun, rw). % Starting from 0.1.1
%% Read/only transaction:
khepri:transaction(StoreId, Fun, false). % Up until 0.1.0
khepri:transaction(StoreId, Fun, ro). % Starting from 0.1.1
The use of the auto
argument remains unchanged.
See commit d7893f3.
Auto-detection of R/W transaction fixed
When a transaction function used another anonymous function which was declared outside of the transaction, that second anonymous function was not analyzed to determine the R/W nature. Therefore, if the transaction function didn't use khepri_tx:put/2
or khepri_tx:delete/1
, it would be considered a read-only transaction. Unfortunately, if the second anonymous function did use one of those two APIs, the transaction would abort with a store_update_denied
error.
The transaction below would be detected as read-only even though it calls khepri_tx:delete/1
:
Fun = fun() -> khepri_tx:delete([foo]) end,
khepri_tx:to_standalone_fun(
fun() -> Fun() end,
auto),
Pull request #7 fixes this problem.
Other changes
- Ra was updated from 2.0.1 to 2.0.2.
- Several improvements and fixes to the testsuites and the specifications.
- To be able to run Dialyzer on the testsuites, they are compiled at the same time as the actual source code of Khepri. Unfortunately, it means that PropEr becomes a regular dependency (instead of a test dependency), even though it is not used at runtime. That said it is a regular dependency from Rebar point of view, but not Erlang and the PropEr application won't be started or used at runtime.
Download
Khepri 0.1.1 is available from Hex.pm: https://hex.pm/packages/khepri/0.1.1
Upgrade
Using Rebar:
-
Update your
rebar.config
:%% In rebar.config {deps, [{khepri, "0.1.1"}]}.
-
Run
rebar3 upgrade
.
Using Erlang.mk:
-
Update your
Makefile
:%% In your Makefile dep_khepri = hex 0.1.1
-
Remove the
deps/khepri
directory. The new version will be fetched the next time you build your project.