@nxtedition/rocksdb 11.1.8 → 12.0.2

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
@@ -18,8 +18,6 @@
18
18
  #include <rocksdb/table.h>
19
19
  #include <rocksdb/write_batch.h>
20
20
 
21
- #include <boost/regex.hpp>
22
-
23
21
  #include <iostream>
24
22
  #include <memory>
25
23
  #include <optional>
@@ -1481,56 +1479,6 @@ NAPI_METHOD(batch_iterate) {
1481
1479
  return result;
1482
1480
  }
1483
1481
 
1484
- NAPI_METHOD(regex_init) {
1485
- NAPI_ARGV(1);
1486
-
1487
- std::string pattern;
1488
- NAPI_STATUS_THROWS(GetString(env, argv[0], pattern));
1489
-
1490
- try {
1491
- auto regex = std::make_unique<boost::regex>(pattern, boost::regex::optimize | boost::regex::ECMAScript);
1492
-
1493
- napi_value result;
1494
- NAPI_STATUS_THROWS(napi_create_external(env, regex.get(), Finalize<boost::regex>, regex.get(), &result));
1495
- regex.release();
1496
-
1497
- return result;
1498
- } catch (const std::exception& e) {
1499
- napi_throw_error(env, nullptr, e.what());
1500
- return 0;
1501
- }
1502
- }
1503
-
1504
- NAPI_METHOD(regex_test) {
1505
- NAPI_ARGV(4);
1506
-
1507
- boost::regex* regex;
1508
- NAPI_STATUS_THROWS(napi_get_value_external(env, argv[0], reinterpret_cast<void**>(&regex)));
1509
-
1510
- rocksdb::Slice value;
1511
- NAPI_STATUS_THROWS(GetValue(env, argv[1], value));
1512
-
1513
- int offset = 0;
1514
- NAPI_STATUS_THROWS(GetValue(env, argv[2], offset));
1515
- offset = std::max(0, std::min<int>(offset, value.size()));
1516
-
1517
- int length = 0;
1518
- NAPI_STATUS_THROWS(GetValue(env, argv[3], length));
1519
- length = std::max(0, std::min<int>(length, value.size() - offset));
1520
-
1521
- try {
1522
- const bool match = boost::regex_search(value.data() + offset, value.data() + offset + length, *regex);
1523
-
1524
- napi_value result;
1525
- NAPI_STATUS_THROWS(napi_get_boolean(env, match, &result));
1526
-
1527
- return result;
1528
- } catch (const std::exception& e) {
1529
- napi_throw_error(env, nullptr, e.what());
1530
- return 0;
1531
- }
1532
- }
1533
-
1534
1482
  NAPI_INIT() {
1535
1483
  NAPI_EXPORT_FUNCTION(db_init);
1536
1484
  NAPI_EXPORT_FUNCTION(db_open);
@@ -1558,7 +1506,4 @@ NAPI_INIT() {
1558
1506
  NAPI_EXPORT_FUNCTION(batch_merge);
1559
1507
  NAPI_EXPORT_FUNCTION(batch_count);
1560
1508
  NAPI_EXPORT_FUNCTION(batch_iterate);
1561
-
1562
- NAPI_EXPORT_FUNCTION(regex_init);
1563
- NAPI_EXPORT_FUNCTION(regex_test);
1564
1509
  }
package/binding.gyp CHANGED
@@ -3,31 +3,21 @@
3
3
  "targets": [
4
4
  {
5
5
  "target_name": "leveldown",
6
- "defines": [
7
- "BOOST_REGEX_STANDALONE=yes"
8
- ],
6
+ "defines": ["BOOST_REGEX_STANDALONE=yes"],
9
7
  "conditions": [
10
8
  [
11
9
  "OS == 'linux'",
12
10
  {
13
- "cflags": [
14
- "-msse4.2",
15
- "-mpclmul",
16
- "-mavx",
17
- "-mavx2",
18
- "-mbmi",
19
- "-mlzcnt"
11
+ "cflags": ["-march=znver1"],
12
+ "include_dirs": [
13
+ "/usr/lib/x86_64-linux-gnu/include",
14
+ "/usr/lib/include",
20
15
  ],
21
- "include_dirs": [
22
- "/usr/lib/x86_64-linux-gnu/include",
23
- "/usr/lib/include",
24
- # "/usr/local/Cellar/jemalloc/5.3.0/include"
25
- ],
26
- "ccflags": ["-flto"],
16
+ "ccflags": ["-flto", '-march=znver1'],
27
17
  "cflags!": ["-fno-exceptions"],
28
18
  "cflags_cc!": ["-fno-exceptions"],
29
- "ldflags": ["-flto", "-fuse-linker-plugin"]
30
- }
19
+ "ldflags": ["-flto", "-fuse-linker-plugin"],
20
+ },
31
21
  ],
32
22
  [
33
23
  "OS == 'mac'",
@@ -37,7 +27,7 @@
37
27
  "-Wno-sign-compare",
38
28
  "-Wno-unused-variable",
39
29
  "-Wno-unused-function",
40
- "-Wno-ignored-qualifiers"
30
+ "-Wno-ignored-qualifiers",
41
31
  ],
42
32
  "OTHER_CPLUSPLUSFLAGS": [
43
33
  "-mmacosx-version-min=13.4.0",
@@ -45,18 +35,18 @@
45
35
  "-fno-omit-frame-pointer",
46
36
  "-momit-leaf-frame-pointer",
47
37
  "-arch x86_64",
48
- "-arch arm64"
38
+ "-arch arm64",
49
39
  ],
50
40
  "GCC_ENABLE_CPP_RTTI": "YES",
51
41
  "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
52
- "MACOSX_DEPLOYMENT_TARGET": "13.4.0"
42
+ "MACOSX_DEPLOYMENT_TARGET": "13.4.0",
53
43
  }
54
- }
55
- ]
44
+ },
45
+ ],
56
46
  ],
57
47
  "dependencies": ["<(module_root_dir)/deps/rocksdb/rocksdb.gyp:rocksdb"],
58
- "include_dirs": ["<!(node -e \"require('napi-macros')\")", "/opt/homebrew/Cellar/boost/1.86.0/include"],
59
- "sources": ["binding.cc"]
48
+ "include_dirs": ["<!(node -e \"require('napi-macros')\")"],
49
+ "sources": ["binding.cc"],
60
50
  }
61
- ]
51
+ ],
62
52
  }
package/index.js CHANGED
@@ -5,7 +5,6 @@ const { AbstractLevel } = require('abstract-level')
5
5
  const ModuleError = require('module-error')
6
6
  const binding = require('./binding')
7
7
  const { ChainedBatch } = require('./chained-batch')
8
- const { Regex } = require('./regex')
9
8
  const { Iterator } = require('./iterator')
10
9
  const fs = require('node:fs')
11
10
  const assert = require('node:assert')
@@ -265,4 +264,3 @@ class RocksLevel extends AbstractLevel {
265
264
  }
266
265
 
267
266
  exports.RocksLevel = RocksLevel
268
- exports.Regex = Regex
package/iterator.js CHANGED
@@ -95,27 +95,27 @@ class Iterator extends AbstractIterator {
95
95
 
96
96
  _nextvSync (size, options) {
97
97
  if (this[kFinished]) {
98
- return []
98
+ return { rows: [], finished: true }
99
99
  }
100
100
 
101
- const { rows, finished } = binding.iterator_nextv(this[kContext], size)
101
+ const result = binding.iterator_nextv(this[kContext], size)
102
102
 
103
103
  this[kFirst] = false
104
- this[kFinished] = finished
104
+ this[kFinished] = result.finished
105
105
 
106
- return rows
106
+ return result
107
107
  }
108
108
 
109
109
  _close (callback) {
110
110
  try {
111
- this._syncClose()
111
+ this._closeSync()
112
112
  process.nextTick(callback)
113
113
  } catch (err) {
114
114
  process.nextTick(callback, err)
115
115
  }
116
116
  }
117
117
 
118
- _syncClose () {
118
+ _closeSync () {
119
119
  this[kCache] = kEmpty
120
120
  binding.iterator_close(this[kContext])
121
121
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/rocksdb",
3
- "version": "11.1.8",
3
+ "version": "12.0.2",
4
4
  "description": "A low-level Node.js RocksDB binding",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
package/regex.js DELETED
@@ -1,25 +0,0 @@
1
- 'use strict'
2
-
3
- const binding = require('./binding')
4
-
5
- class Regex {
6
- #context
7
-
8
- constructor (pattern) {
9
- this.#context = binding.regex_init(pattern)
10
- }
11
-
12
- test (buffer, byteOffset, byteLength) {
13
- if (byteOffset === undefined) {
14
- byteOffset = 0
15
- }
16
-
17
- if (byteLength === undefined) {
18
- byteLength = buffer.byteLength - byteOffset
19
- }
20
-
21
- return binding.regex_test(this.#context, buffer, byteOffset, byteLength)
22
- }
23
- }
24
-
25
- exports.Regex = Regex