Use bindgen to auto generate FFI
See https://github.com/rust-lang/rust-bindgen
Also, notice that https://github.com/rust-rocksdb/rust-rocksdb is already using bindgen, maybe we can rebase to it and add what we need.
I would like to try it ~
Please mind that the upstream c.cc has an issue where it will return incorrect bloom filter:https://github.com/facebook/rocksdb/issues/6129 The issue was fixed in our c.cc. I'm not sure if our fork has more fixes not included upstream. cc @Connor1996 @fredchenbj
Oh, seems we should take a careful look at the difference when updating c.cc @fredchenbj
I make some general illustrations about this task here:
- the migration plan has three steps:
- make some change in c.h & c.c to make bindgen work in pr https://github.com/tikv/rust-rocksdb/pull/401. Then use the old crocksdb's c.h and bindgen to generate ffi rust code, and make it work for all dependency code; this step now is in progress in pr https://github.com/tikv/rust-rocksdb/pull/398.
- replace with upstreams's c.h & c.cc, and make all code in c.h conform to rocksdb's style, here we would only include rocksdb's c.h and not change it at all. Here we would fix the problem caused by the difference of c.h & c.cc between here and upstream.
- try to use rocksdb cpp api to generate ffi rust code. This step would be some challenging, and i now have not taken too much consideration.