rocksdb-native
Advanced tools
+35
-1
@@ -11,2 +11,8 @@ #include <assert.h> | ||
| #ifdef _WIN32 | ||
| #include <io.h> | ||
| #else | ||
| #include <unistd.h> | ||
| #endif | ||
| using rocksdb_native_on_open_t = js_function_t<void, js_receiver_t, std::optional<js_string_t>>; | ||
@@ -39,2 +45,4 @@ using rocksdb_native_on_close_t = js_function_t<void, js_receiver_t>; | ||
| int lock; | ||
| js_env_t *env; | ||
@@ -273,2 +281,3 @@ js_persistent_t<js_receiver_t> ctx; | ||
| auto lock = db->lock; | ||
| auto teardown = db->teardown; | ||
@@ -308,2 +317,10 @@ | ||
| if (lock != -1) { | ||
| #ifdef _WIN32 | ||
| _close(lock); | ||
| #else | ||
| close(lock); | ||
| #endif | ||
| } | ||
| err = js_finish_deferred_teardown_callback(teardown); | ||
@@ -347,3 +364,4 @@ assert(err == 0); | ||
| bool use_direct_io_for_flush_and_compaction, | ||
| int32_t max_file_opening_threads | ||
| int32_t max_file_opening_threads, | ||
| int32_t lock | ||
| ) { | ||
@@ -363,2 +381,3 @@ int err; | ||
| db->env = env; | ||
| db->lock = lock; | ||
| db->closing = false; | ||
@@ -1799,2 +1818,9 @@ db->exiting = false; | ||
| static void | ||
| rocksdb_native__on_snapshot_teardown(void *data) { | ||
| auto snapshot = reinterpret_cast<rocksdb_native_snapshot_t *>(data); | ||
| rocksdb_snapshot_destroy(&snapshot->handle); | ||
| } | ||
| static js_arraybuffer_t | ||
@@ -1819,2 +1845,5 @@ rocksdb_native_snapshot_create(js_env_t *env, js_arraybuffer_span_of_t<rocksdb_native_t, 1> db) { | ||
| err = js_add_teardown_callback(env, rocksdb_native__on_snapshot_teardown, snapshot); | ||
| assert(err == 0); | ||
| return handle; | ||
@@ -1825,3 +1854,8 @@ } | ||
| rocksdb_native_snapshot_destroy(js_env_t *env, js_arraybuffer_span_of_t<rocksdb_native_snapshot_t, 1> snapshot) { | ||
| int err; | ||
| rocksdb_snapshot_destroy(&snapshot->handle); | ||
| err = js_remove_teardown_callback(env, rocksdb_native__on_snapshot_teardown, snapshot); | ||
| assert(err == 0); | ||
| } | ||
@@ -1828,0 +1862,0 @@ |
+2
-0
@@ -82,2 +82,4 @@ const ColumnFamily = require('./lib/column-family') | ||
| async close({ force } = {}) { | ||
| if (!this._state.opened) await this._state.ready() | ||
| if (this._index !== -1) this._state.removeSession(this) | ||
@@ -84,0 +86,0 @@ |
+3
-1
@@ -31,2 +31,3 @@ const ReadyResource = require('ready-resource') | ||
| maxFileOpeningThreads = 16, | ||
| lock = -1, | ||
| preopen = null | ||
@@ -70,3 +71,4 @@ } = opts | ||
| useDirectIOForFlushAndCompaction, | ||
| maxFileOpeningThreads | ||
| maxFileOpeningThreads, | ||
| lock | ||
| ) | ||
@@ -73,0 +75,0 @@ } |
+1
-1
| { | ||
| "name": "rocksdb-native", | ||
| "version": "3.10.0", | ||
| "version": "3.10.1", | ||
| "description": "librocksdb bindings for JavaScript", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
183644962
01090
0.28%