Level / rocksdb

Pure C++ Node.js RocksDB binding. An abstract-leveldown compliant store.
MIT License
230 stars 54 forks source link

use napi_create_int64 for approximate size #175

Closed larskuhtz closed 3 years ago

larskuhtz commented 3 years ago

The PR is a port of this change from Level/leveldown.

Currently the binding for approximateSize stores the result as uint32. This supports only databases of up to 4GB and returns wrong results for larger DBs.

The PR changes the code to use the full uint64 that is returned from RocksDB and converts it to a Javascript number using napi_create_int64. The result is approximate for values that do not satisfy Number.isSafeInteger(). This should be fine because the original value returned by RocksDB is "approximate" in first place.

vweevers commented 3 years ago

5.1.0