@nxtedition/rocksdb 10.3.7 → 10.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/binding.cc
CHANGED
package/chained-batch.js
CHANGED
|
@@ -59,18 +59,16 @@ class ChainedBatch extends AbstractChainedBatch {
|
|
|
59
59
|
_write (options, callback) {
|
|
60
60
|
callback = fromCallback(callback, kPromise)
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
process.nextTick(callback, err)
|
|
67
|
-
}
|
|
62
|
+
// NOTE: `this` needs to be referenced until callback is called
|
|
63
|
+
this[kWrite](this, this[kBatchContext], options ?? EMPTY, (err) => {
|
|
64
|
+
callback(err, null, this)
|
|
65
|
+
})
|
|
68
66
|
|
|
69
67
|
return callback[kPromise]
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
_writeSync (options) {
|
|
73
|
-
binding.batch_write_sync(this[kDbContext], this[kBatchContext], options)
|
|
71
|
+
binding.batch_write_sync(this[kDbContext], this[kBatchContext], options ?? EMPTY)
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
_close (callback) {
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/util.h
CHANGED
|
@@ -263,22 +263,22 @@ static napi_status GetProperty(napi_env env,
|
|
|
263
263
|
return GetValue(env, value, result);
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
266
|
+
// NOTE: napi_create_external_buffer is slow with finalizer...
|
|
267
|
+
// template <typename T>
|
|
268
|
+
// napi_status Convert(napi_env env, rocksdb::PinnableSlice* s, Encoding encoding, napi_value& result) {
|
|
269
|
+
// if (!s || !s->IsPinned()) {
|
|
270
|
+
// return napi_get_null(env, &result);
|
|
271
|
+
// } else if (encoding == Encoding::Buffer) {
|
|
272
|
+
// auto ptr = new rocksdb::PinnableSlice(std::move(*s));
|
|
273
|
+
// return napi_create_external_buffer(env, ptr->size(), const_cast<char*>(ptr->data()),
|
|
274
|
+
// Finalize<rocksdb::PinnableSlice>, ptr, &result);
|
|
275
|
+
// return napi_create_buffer_copy(env, s->size(), s->data(), nullptr, &result);
|
|
276
|
+
// } else if (encoding == Encoding::String) {
|
|
277
|
+
// return napi_create_string_utf8(env, s->data(), s->size(), &result);
|
|
278
|
+
// } else {
|
|
279
|
+
// return napi_invalid_arg;
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
282
282
|
|
|
283
283
|
template <typename T>
|
|
284
284
|
napi_status Convert(napi_env env, T&& s, Encoding encoding, napi_value& result) {
|