rocksdb-native
Advanced tools
+14
-23
@@ -11,8 +11,2 @@ #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>>; | ||
@@ -45,4 +39,2 @@ using rocksdb_native_on_close_t = js_function_t<void, js_receiver_t>; | ||
| int lock; | ||
| js_env_t *env; | ||
@@ -281,3 +273,2 @@ js_persistent_t<js_receiver_t> ctx; | ||
| auto lock = db->lock; | ||
| auto teardown = db->teardown; | ||
@@ -317,10 +308,2 @@ | ||
| if (lock != -1) { | ||
| #ifdef _WIN32 | ||
| _close(lock); | ||
| #else | ||
| close(lock); | ||
| #endif | ||
| } | ||
| err = js_finish_deferred_teardown_callback(teardown); | ||
@@ -364,4 +347,3 @@ assert(err == 0); | ||
| bool use_direct_io_for_flush_and_compaction, | ||
| int32_t max_file_opening_threads, | ||
| int32_t lock | ||
| int32_t max_file_opening_threads | ||
| ) { | ||
@@ -381,3 +363,2 @@ int err; | ||
| db->env = env; | ||
| db->lock = lock; | ||
| db->closing = false; | ||
@@ -387,3 +368,3 @@ db->exiting = false; | ||
| db->options = (rocksdb_options_t) { | ||
| 1, | ||
| 3, | ||
| read_only, | ||
@@ -399,3 +380,4 @@ create_if_missing, | ||
| use_direct_io_for_flush_and_compaction, | ||
| max_file_opening_threads | ||
| max_file_opening_threads, | ||
| -1, | ||
| }; | ||
@@ -422,2 +404,3 @@ | ||
| js_array_t column_families_array, | ||
| int lock, | ||
| js_receiver_t ctx, | ||
@@ -459,2 +442,4 @@ rocksdb_native_on_open_t on_open | ||
| db->options.lock = lock; | ||
| err = rocksdb_open(&db->handle, &req->handle, path, &db->options, column_families, handles, len, rocksdb_native__on_open); | ||
@@ -466,2 +451,8 @@ | ||
| if (lock >= 0) { | ||
| uv_fs_t fs; | ||
| err = uv_fs_close(NULL, &fs, lock, NULL); | ||
| assert(err == 0); | ||
| } | ||
| throw js_pending_exception; | ||
@@ -1328,3 +1319,3 @@ } | ||
| rocksdb_read_options_t options = { | ||
| .version = 0, | ||
| .version = 1, | ||
| .async_io = async_io, | ||
@@ -1331,0 +1322,0 @@ .fill_cache = fill_cache |
+1
-1
@@ -12,3 +12,3 @@ cmake_minimum_required(VERSION 4.0) | ||
| fetch_package("github:holepunchto/librocksdb#1fa9c8c") | ||
| fetch_package("github:holepunchto/librocksdb#65ec235") | ||
| fetch_package("github:holepunchto/libjstl#098664c") | ||
@@ -15,0 +15,0 @@ |
+14
-5
@@ -31,3 +31,3 @@ const ReadyResource = require('ready-resource') | ||
| maxFileOpeningThreads = 16, | ||
| lock = -1, | ||
| lock = null, | ||
| preopen = null | ||
@@ -50,2 +50,3 @@ } = opts | ||
| this._columnsFlushed = false | ||
| this._lock = lock | ||
| this._preopen = preopen | ||
@@ -72,4 +73,3 @@ this._readBatches = [] | ||
| useDirectIOForFlushAndCompaction, | ||
| maxFileOpeningThreads, | ||
| lock | ||
| maxFileOpeningThreads | ||
| ) | ||
@@ -144,4 +144,6 @@ } | ||
| async _open() { | ||
| await Promise.resolve() // allow column families to populate if ondemand | ||
| await Promise.resolve() // Allow column families to populate if on-demand | ||
| if (this._lock) await this._lock.ready() | ||
| if (this._preopen) await this._preopen | ||
@@ -158,2 +160,4 @@ | ||
| const lock = this._lock === null ? -1 : this._lock.transfer() | ||
| req.handle = binding.open( | ||
@@ -164,2 +168,3 @@ this._handle, | ||
| this.columnFamilies.map((c) => c._handle), | ||
| lock, | ||
| req, | ||
@@ -205,3 +210,7 @@ onopen | ||
| await promise | ||
| try { | ||
| await promise | ||
| } finally { | ||
| if (this._lock) await this._lock.close() | ||
| } | ||
@@ -208,0 +217,0 @@ function onclose(err) { |
+7
-1
| { | ||
| "name": "rocksdb-native", | ||
| "version": "3.10.1", | ||
| "version": "3.11.0", | ||
| "description": "librocksdb bindings for JavaScript", | ||
@@ -9,2 +9,6 @@ "exports": { | ||
| }, | ||
| "imports": { | ||
| "fs": "bare-fs", | ||
| "default": "fs" | ||
| }, | ||
| "files": [ | ||
@@ -51,2 +55,3 @@ "index.js", | ||
| "bare-compat-napi": "^1.3.0", | ||
| "bare-fs": "^4.5.0", | ||
| "brittle": "^3.5.0", | ||
@@ -56,2 +61,3 @@ "cmake-bare": "^1.1.14", | ||
| "cmake-napi": "^1.0.6", | ||
| "fd-lock": "^2.0.0", | ||
| "prettier": "^3.6.2", | ||
@@ -58,0 +64,0 @@ "prettier-config-holepunch": "^2.0.0" |
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
1097
0.64%183010152
-0.35%9
28.57%