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.
The PR is a port of this change from Level/leveldown.
Currently the binding for
approximateSize
stores the result asuint32
. 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 usingnapi_create_int64
. The result is approximate for values that do not satisfyNumber.isSafeInteger()
. This should be fine because the original value returned by RocksDB is "approximate" in first place.