rocksdb-native 3.5.5 → 3.5.6

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 CHANGED
@@ -13,7 +13,7 @@ if(target MATCHES "win32")
13
13
  add_compile_options(/MT$<$<CONFIG:Debug>:d>)
14
14
  endif()
15
15
 
16
- fetch_package("github:holepunchto/librocksdb#dbebf66")
16
+ fetch_package("github:holepunchto/librocksdb#4a8e385")
17
17
 
18
18
  add_bare_module(rocksdb_native_bare)
19
19
 
package/binding.c CHANGED
@@ -85,7 +85,6 @@ typedef struct {
85
85
  rocksdb_read_batch_t handle;
86
86
 
87
87
  rocksdb_read_t *reads;
88
- char **errors;
89
88
 
90
89
  size_t capacity;
91
90
 
@@ -98,7 +97,6 @@ typedef struct {
98
97
  rocksdb_write_batch_t handle;
99
98
 
100
99
  rocksdb_write_t *writes;
101
- char **errors;
102
100
 
103
101
  size_t capacity;
104
102
 
@@ -141,6 +139,10 @@ rocksdb_native__on_open(rocksdb_open_t *handle, int status) {
141
139
 
142
140
  js_env_t *env = req->env;
143
141
 
142
+ const rocksdb_column_family_descriptor_t *descriptors = handle->column_families;
143
+
144
+ rocksdb_column_family_t **handles = handle->handles;
145
+
144
146
  if (db->exiting) {
145
147
  err = js_delete_reference(env, req->on_open);
146
148
  assert(err == 0);
@@ -220,9 +222,9 @@ rocksdb_native__on_open(rocksdb_open_t *handle, int status) {
220
222
  assert(err == 0);
221
223
  }
222
224
 
223
- free((void *) handle->column_families);
225
+ free((void *) descriptors);
224
226
 
225
- free(handle->handles);
227
+ free(handles);
226
228
  }
227
229
 
228
230
  static void
@@ -1264,19 +1266,12 @@ rocksdb_native_read_buffer(js_env_t *env, js_callback_info_t *info) {
1264
1266
 
1265
1267
  js_value_t *handle;
1266
1268
 
1267
- uint8_t *data;
1268
- err = js_create_arraybuffer(env, capacity * sizeof(rocksdb_read_t) + capacity * sizeof(char *), (void **) &data, &handle);
1269
+ rocksdb_read_t *reads;
1270
+ err = js_create_arraybuffer(env, capacity * sizeof(rocksdb_read_t), (void **) &reads, &handle);
1269
1271
  assert(err == 0);
1270
1272
 
1271
1273
  req->capacity = capacity;
1272
-
1273
- size_t offset = 0;
1274
-
1275
- req->reads = (rocksdb_read_t *) &data[offset];
1276
-
1277
- offset += capacity * sizeof(rocksdb_read_t);
1278
-
1279
- req->errors = (char **) &data[offset];
1274
+ req->reads = reads;
1280
1275
 
1281
1276
  return handle;
1282
1277
  }
@@ -1300,7 +1295,7 @@ rocksdb_native__on_read(rocksdb_read_batch_t *handle, int status) {
1300
1295
  for (size_t i = 0; i < len; i++) {
1301
1296
  js_value_t *result;
1302
1297
 
1303
- char *error = req->errors[i];
1298
+ char *error = req->handle.errors[i];
1304
1299
 
1305
1300
  if (error) continue;
1306
1301
 
@@ -1329,7 +1324,7 @@ rocksdb_native__on_read(rocksdb_read_batch_t *handle, int status) {
1329
1324
  for (size_t i = 0; i < len; i++) {
1330
1325
  js_value_t *result;
1331
1326
 
1332
- char *error = req->errors[i];
1327
+ char *error = req->handle.errors[i];
1333
1328
 
1334
1329
  if (error) {
1335
1330
  err = js_create_string_utf8(env, (utf8_t *) error, -1, &result);
@@ -1461,7 +1456,7 @@ rocksdb_native_read(js_env_t *env, js_callback_info_t *info) {
1461
1456
  assert(err == 0);
1462
1457
  }
1463
1458
 
1464
- err = rocksdb_read(&db->handle, &req->handle, req->reads, req->errors, len, &options, rocksdb_native__on_read);
1459
+ err = rocksdb_read(&db->handle, &req->handle, req->reads, len, &options, rocksdb_native__on_read);
1465
1460
  assert(err == 0);
1466
1461
 
1467
1462
  return NULL;
@@ -1505,19 +1500,12 @@ rocksdb_native_write_buffer(js_env_t *env, js_callback_info_t *info) {
1505
1500
 
1506
1501
  js_value_t *handle;
1507
1502
 
1508
- uint8_t *data;
1509
- err = js_create_arraybuffer(env, capacity * sizeof(rocksdb_write_t) + capacity * sizeof(char *), (void **) &data, &handle);
1503
+ rocksdb_write_t *writes;
1504
+ err = js_create_arraybuffer(env, capacity * sizeof(rocksdb_write_t), (void **) &writes, &handle);
1510
1505
  assert(err == 0);
1511
1506
 
1512
1507
  req->capacity = capacity;
1513
-
1514
- size_t offset = 0;
1515
-
1516
- req->writes = (rocksdb_write_t *) &data[offset];
1517
-
1518
- offset += capacity * sizeof(rocksdb_write_t);
1519
-
1520
- req->errors = (char **) &data[offset];
1508
+ req->writes = writes;
1521
1509
 
1522
1510
  return handle;
1523
1511
  }
@@ -1786,7 +1774,7 @@ rocksdb_native_flush(js_env_t *env, js_callback_info_t *info) {
1786
1774
  err = rocksdb_flush(&db->handle, &req->handle, column_family->handle, NULL, rocksdb_native__on_flush);
1787
1775
  assert(err == 0);
1788
1776
 
1789
- return NULL;
1777
+ return handle;
1790
1778
  }
1791
1779
 
1792
1780
  static js_value_t *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rocksdb-native",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "librocksdb bindings for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",