Asynchronous NIF Rewrite
Created by: potatosalad
Using gburd/lmdb and basho-labs/wterl as a reference, I rewrote this NIF to use async_nif.h so that it is less blocking than the original synchronous version.
It should be a drop-in replacement to the 0.2.x version. I added an additional function, ekstat:close/1
, for forcing kstat_close(3kstat) to be called.
All of the tests are passing for me on SmartOS joyent_20140221T042147Z with Erlang R16B02.
I'm hoping to do something similar to project-fifo/erltrace when I have the time.
Hopefully you find this useful!
Edit 2014/03/05: I forgot to mention, the biggest change in this version in terms of backwards compatibility are the error messages. If there's an OOM error, for example, instead of returning (for example) {error, {kstat, "ks_nvpair_t malloc"}}
it will now return {error, {enomem, "Not enough space"}}
. The error checking is much more thorough now as well compared to the previous version.