I maintain rocksdb-ffm, a RocksDB binding for Java 25+ built on the Foreign Function & Memory API (no JNI, zero-copy via MemorySegment, just wrapping the C API in c.h).
I've now wrapped everything c.h offers, including every compression method and most of options. What's left is stuff the C API doesn't expose, such library version and build info (C macros aren't queryable via FFM), some event listener callbacks (useful for observability: JFR, Micrometer, OpenTelemetry), env, wide columns and secondary cache, secondary indexes and most likely more stuff I don't know yet.
rocksdbjni gets around this by linking C++ directly but my library can't call C++ in a stable way (name mangling, std::string layouts that vary by libc++), so the idea is to maintain a small patch on top of the C API: in the build that adds extern "C" functions next to db/c.cc. The idea is to "incubate" the patches in the library and, at the same time, to open a pull-request upstream for each of them (i.e. https://github.com/meta/rocksdb/pull/15141).
My questions:
1. Is a separate patch file the right mechanism? Do you see other solutions?
2. Is "everything is upstreamed too" realistic? What did you learn contributing to RocksDB or similar projects?