How do I tell a RocksDB iterator to seek until the last matching prefix?
In Clojure using the RocksDB Java API:
(import '(org.rocksdb RocksDB Options ReadOptions RocksIterator Slice))
(let [opts (-> (ReadOptions.)
(.setPrefixSameAsStart true)
(.setTotalOrderSeek true))
iter (.newIterator db)]
(.seek iter (.getBytes ("some-prefix:"))
(.key iter))
=> "not-matching-prefix"
Do I have to manually check if the next key matches the prefix? This seems suboptimal because I have to stream in the whole key to check it, when RocksDB could eject early.