This as added to make while-loops easy:
while iter.next() {
...
}
But this involves adding a layer of custom logic on top of the RocksDB
API. This is probably a bad idea given that this API is meant to closely
match the underlying iterator API in RocksDB, so this commit changes
that.
The new way to iterate is as follows:
while iter.valid() {
...
iter.next();
}
None of these methods have been in a past released version so I don't think we should worry about backwards compatibility.
Changes as follows:
- Renamed ``compression`` to ``set_compression_type``. I think this is a much clearer name
- Renamed ``add_merge_operator`` to ``set_merge_operator`` and ``add_comparator`` to ``set_comparator``. Both of these methods replace the entire value of their respective option so "add" is the wrong term to use here.
- Renamed ``set_block_cache_size_mb`` to ``rocksdb_options_optimize_for_point_lookup``. To match RocksDB's API
This makes it easier for people who are using the try!() macro to convert errors into their own Error type. It isn't possible to diffrentiate between errors raised from RocksDB and other string errors at the moment.
This adds a simple ``Error`` type that wraps ``String``. People using RocksDB can now implement ``impl From<rocksdb::Error> for MyError`` and add custom behaviour for handling RocksDB errors.