Level / abstract-level

Abstract class for a lexicographically sorted key-value database.
MIT License
123 stars 8 forks source link

flush() instead of sync=true #25

Closed ronag closed 2 years ago

ronag commented 2 years ago

I believe an API with a flush() and flushSync() method would be more efficient than having a sync parameter to each call and probably provide the same functionality.

vweevers commented 2 years ago

Do LevelDB and RocksDB have such APIs?

ronag commented 2 years ago

RocksDB does. Will need to check LevelDb.

ronag commented 2 years ago

LevelDb doesn’t but as far I can see just writing an empty batch with sync true should be sufficient to emulate it.

vweevers commented 2 years ago

OK. In that case it can just be a rocks-level feature. I don't see a point to emulating it for LevelDB (if the purpose is to have a more efficient mechanism than sync: true) and it shouldn't be part of the abstract-level interface anyway (even if LevelDB did support it).