Commit Graph

24 Commits

Author SHA1 Message Date
octavonce 0cf6fd016d feat: added list_cf/2
This commit introduces a function which will list column families inside an existing database.
2018-04-06 18:59:45 -04:00
Griffin Smith c7c0788bb1 deps(): Update version of erlang_nif-sys
Update Cargo dependency on erlang_nif-sys, to work with OTP 20.2
2018-01-17 15:23:05 -05:00
Griffin Smith 81839aa6ae feat(): Allow creating database snapshots
Add a `create_snapshot` function, that creates a RocksDB database
snapshot from the given database handle and returns it.

There's a pretty fantastic amount of horribly unsafe Rust going on here
- primarily caused by the fact that the rust-rocksdb snapshot type is,
unlike Iterator or ColumnFamily or any of the other types that really
*should* be, parametrized by the lifetime of a borrowed reference to its
owner database. The abstraction provided by Rustler doesn't allow
non-static lifetime-parametrized struct types to be returned back to
Erlang as resources, for some technical type-mismatch reasons but also
practically because relying on the Erlang garbage collector to free our
stuff doesn't fit at *all* with rust's lifetime model.

The workaround here is to use `mem::transmute` (I told you it was
crazy...) to turn the snapshot reference from a `Snapshot<'a>` to a
`Snapshot<'static>`, and pass *that*, along with a held ARC reference to
the owning DB, to Erlang, and then when the Erlang GC decides it's time
to free the snapshot, go *back* to a first unbounded, then elided
lifetime to force the snapshot to be dropped.

I've done some cursory checking and regular operation (creating a
snapshot from a process then letting that process die) appears to not
leak the snapshots, but we should keep an eye on this to make sure we
don't have any leaks (or worse) in the future.

As a further note, the bit that parses out the argument for the NIFs
that now accept *either* a DB or a snapshot is a little mucky - that
should be revisited at a later date to see if we can clean it up a
little.
2017-11-30 15:30:06 -05:00
Griffin Smith 7590dbb5f3 deps(): Update dependency on rust_rocksdb 2017-10-26 14:08:35 -04:00
Griffin Smith 6f4986596d feat(options): add use_direct_io_for_flush_and_compaction
Add support for the `use_direct_io_for_flush_and_compaction` db option
2017-09-11 14:47:02 -04:00
Griffin Smith 072917eefe fix(): Remove disable_data_sync
This is removed in rocksdb-core
2017-08-23 16:34:41 -04:00
Griffin Smith bb627a4d9d deps(rocksdb): Depend on our fork of rust-rocksdb
Depend on our fork of rust-rocksdb, so we can get urbint/rust-rocksdb#1
2017-08-23 16:34:18 -04:00
Ryan Schmukler 87544c2e2b feat(): allow non-utf8 binary as keys
RocksDB supports any binary to be a key, not just UTF-8 encoded
strings. In the case of things like UUIDs, this difference can be a big
one (ie. 36 bytes vs 16 bytes).
2017-08-15 18:43:01 -04:00
Ryan Schmukler 36748e94e7 feat(): OTP 20 and Elixir 1.4.5 support 2017-06-29 14:36:51 -04:00
Ryan Schmukler 767483ca72 feat(): add Batch commands (atomic operations) 2017-06-15 14:25:19 -04:00
Ryan Schmukler cffdaa7d49 fix(): no longer crash if DB reference is released before an iterator ref 2017-05-26 13:42:50 -05:00
Ryan Schmukler 680e20a55c deps(): update rust dependencies 2017-05-26 13:42:42 -05:00
Ryan Schmukler f8dbe6a0db feat(): add delete, restore basic testing 2017-03-21 14:59:34 -04:00
Ryan Schmukler aab14d167e feat(): add auto opening of column families, streaming, enumerable and collectable 2017-03-21 14:09:51 -04:00
Ryan Schmukler 131b5df024 feat(): begin iterator, simplify API, refactor 2017-03-20 20:38:39 -04:00
Ryan Schmukler b25bbba795 chore(): update deps, tweak impls 2017-03-20 16:50:12 -04:00
Ryan Schmukler 34746d6751 fix(): get and put for erlang types 2017-03-02 20:36:12 -05:00
Ryan Schmukler 95b3bf6e7c feat(): implement basic get 2017-03-01 21:47:02 -05:00
Ryan Schmukler fcc3627ce9 feat(): add opening column families and put (with and without CF) 2017-02-28 23:45:01 -05:00
Ryan Schmukler 00107da301 feat(): implement create_cf/3 2017-02-28 22:32:03 -05:00
Ryan Schmukler 6ba1609e5a wip(rustler): port db options 2017-02-28 15:43:13 -05:00
Ryan Schmukler 41ba01b681 wip(restler): begin db_options serialization 2017-02-27 22:20:12 -05:00
Ryan Schmukler 3f70e06a34 wip(rustler): add count, db_handle struct 2017-02-27 21:51:04 -05:00
Ryan Schmukler 33e0e655f9 wip(rustler): wip port to rustler 2017-02-27 19:36:14 -05:00