rocksdb-native 3.2.1 → 3.3.1
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/CMakeLists.txt +1 -1
- package/binding.c +5 -1
- package/lib/batch.js +27 -9
- package/lib/column-family.js +5 -1
- package/package.json +1 -1
- package/prebuilds/android-arm/rocksdb-native.bare +0 -0
- package/prebuilds/android-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/android-ia32/rocksdb-native.bare +0 -0
- package/prebuilds/android-x64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-arm64/rocksdb-native.node +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.bare +0 -0
- package/prebuilds/darwin-x64/rocksdb-native.node +0 -0
- package/prebuilds/ios-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/ios-arm64-simulator/rocksdb-native.bare +0 -0
- package/prebuilds/ios-x64-simulator/rocksdb-native.bare +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-arm64/rocksdb-native.node +0 -0
- package/prebuilds/linux-x64/rocksdb-native.bare +0 -0
- package/prebuilds/linux-x64/rocksdb-native.node +0 -0
- package/prebuilds/win32-arm64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-arm64/rocksdb-native.node +0 -0
- package/prebuilds/win32-x64/rocksdb-native.bare +0 -0
- package/prebuilds/win32-x64/rocksdb-native.node +0 -0
package/CMakeLists.txt
CHANGED
package/binding.c
CHANGED
|
@@ -28,6 +28,8 @@ typedef struct {
|
|
|
28
28
|
rocksdb_native_uint64_t table_block_size;
|
|
29
29
|
uint32_t table_cache_index_and_filter_blocks;
|
|
30
30
|
uint32_t table_format_version;
|
|
31
|
+
uint32_t optimize_filters_for_memory;
|
|
32
|
+
uint32_t no_block_cache;
|
|
31
33
|
} rocksdb_native_column_family_options_t;
|
|
32
34
|
|
|
33
35
|
typedef struct {
|
|
@@ -719,7 +721,7 @@ rocksdb_native_column_family_init(js_env_t *env, js_callback_info_t *info) {
|
|
|
719
721
|
column_family->descriptor = (rocksdb_column_family_descriptor_t) {
|
|
720
722
|
(const char *) name,
|
|
721
723
|
{
|
|
722
|
-
|
|
724
|
+
1,
|
|
723
725
|
options->compation_style,
|
|
724
726
|
options->enable_blob_files,
|
|
725
727
|
rocksdb_native__to_uint64(options->min_blob_size),
|
|
@@ -728,6 +730,8 @@ rocksdb_native_column_family_init(js_env_t *env, js_callback_info_t *info) {
|
|
|
728
730
|
rocksdb_native__to_uint64(options->table_block_size),
|
|
729
731
|
options->table_cache_index_and_filter_blocks,
|
|
730
732
|
options->table_format_version,
|
|
733
|
+
options->optimize_filters_for_memory,
|
|
734
|
+
options->no_block_cache,
|
|
731
735
|
}
|
|
732
736
|
};
|
|
733
737
|
|
package/lib/batch.js
CHANGED
|
@@ -20,6 +20,7 @@ class RocksDBBatch {
|
|
|
20
20
|
|
|
21
21
|
this._request = null
|
|
22
22
|
this._resolve = null
|
|
23
|
+
this._reject = null
|
|
23
24
|
|
|
24
25
|
this._handle = null
|
|
25
26
|
this._buffer = null
|
|
@@ -38,16 +39,20 @@ class RocksDBBatch {
|
|
|
38
39
|
this._autoDestroy = autoDestroy
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
_onfinished() {
|
|
42
|
+
_onfinished(err) {
|
|
42
43
|
const resolve = this._resolve
|
|
44
|
+
const reject = this._reject
|
|
43
45
|
|
|
44
46
|
this._operations = []
|
|
45
47
|
this._promises = []
|
|
46
48
|
this._request = null
|
|
47
49
|
this._resolve = null
|
|
50
|
+
this._reject = null
|
|
48
51
|
|
|
49
52
|
if (this._autoDestroy === true) this.destroy()
|
|
50
|
-
|
|
53
|
+
|
|
54
|
+
if (reject !== null && err) reject(err)
|
|
55
|
+
else if (resolve !== null) resolve()
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
_resize() {
|
|
@@ -96,8 +101,9 @@ class RocksDBBatch {
|
|
|
96
101
|
if (this._request) throw new Error('Request in progress')
|
|
97
102
|
if (this._destroyed) throw new Error('Batch is destroyed')
|
|
98
103
|
|
|
99
|
-
this._request = new Promise((resolve) => {
|
|
104
|
+
this._request = new Promise((resolve, reject) => {
|
|
100
105
|
this._resolve = resolve
|
|
106
|
+
this._reject = reject
|
|
101
107
|
})
|
|
102
108
|
|
|
103
109
|
this._flush()
|
|
@@ -166,21 +172,26 @@ exports.ReadBatch = class RocksDBReadBatch extends RocksDBBatch {
|
|
|
166
172
|
}
|
|
167
173
|
|
|
168
174
|
_onread(errs, values) {
|
|
175
|
+
let applied = true
|
|
176
|
+
|
|
169
177
|
for (let i = 0, n = this._promises.length; i < n; i++) {
|
|
170
178
|
const promise = this._promises[i]
|
|
171
179
|
if (promise === null) continue
|
|
172
180
|
|
|
173
181
|
const err = errs[i]
|
|
174
182
|
|
|
175
|
-
if (err)
|
|
176
|
-
|
|
183
|
+
if (err) {
|
|
184
|
+
applied = false
|
|
185
|
+
|
|
186
|
+
promise.reject(new Error(err))
|
|
187
|
+
} else {
|
|
177
188
|
promise.resolve(
|
|
178
189
|
values[i] ? this._decodeValue(Buffer.from(values[i])) : null
|
|
179
190
|
)
|
|
180
191
|
}
|
|
181
192
|
}
|
|
182
193
|
|
|
183
|
-
this._onfinished()
|
|
194
|
+
this._onfinished(applied ? null : new Error('Batch was not applied'))
|
|
184
195
|
}
|
|
185
196
|
|
|
186
197
|
get(key) {
|
|
@@ -227,15 +238,22 @@ exports.WriteBatch = class RocksDBWriteBatch extends RocksDBBatch {
|
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
_onwrite(err) {
|
|
241
|
+
let applied = true
|
|
242
|
+
|
|
230
243
|
for (let i = 0, n = this._promises.length; i < n; i++) {
|
|
231
244
|
const promise = this._promises[i]
|
|
232
245
|
if (promise === null) continue
|
|
233
246
|
|
|
234
|
-
if (err)
|
|
235
|
-
|
|
247
|
+
if (err) {
|
|
248
|
+
applied = false
|
|
249
|
+
|
|
250
|
+
promise.reject(new Error(err))
|
|
251
|
+
} else {
|
|
252
|
+
promise.resolve()
|
|
253
|
+
}
|
|
236
254
|
}
|
|
237
255
|
|
|
238
|
-
this._onfinished()
|
|
256
|
+
this._onfinished(applied ? null : new Error('Batch was not applied'))
|
|
239
257
|
}
|
|
240
258
|
|
|
241
259
|
put(key, value) {
|
package/lib/column-family.js
CHANGED
|
@@ -12,6 +12,8 @@ class RocksDBColumnFamily {
|
|
|
12
12
|
tableBlockSize = 8192,
|
|
13
13
|
tableCacheIndexAndFilterBlocks = true,
|
|
14
14
|
tableFormatVersion = 6,
|
|
15
|
+
optimizeFiltersForMemory = false,
|
|
16
|
+
blockCache = true,
|
|
15
17
|
// In case we are cloning
|
|
16
18
|
settings = null
|
|
17
19
|
} = opts
|
|
@@ -30,7 +32,9 @@ class RocksDBColumnFamily {
|
|
|
30
32
|
tableBlockSize & 0xffffffff,
|
|
31
33
|
Math.floor(tableBlockSize / 0x100000000),
|
|
32
34
|
tableCacheIndexAndFilterBlocks ? 1 : 0,
|
|
33
|
-
tableFormatVersion
|
|
35
|
+
tableFormatVersion,
|
|
36
|
+
optimizeFiltersForMemory ? 1 : 0,
|
|
37
|
+
blockCache ? 0 : 1
|
|
34
38
|
])
|
|
35
39
|
|
|
36
40
|
this._handle = binding.columnFamilyInit(name, this._settings)
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|