@nxtedition/rocksdb 12.0.10 → 12.0.12
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
|
@@ -1021,6 +1021,9 @@ NAPI_METHOD(db_get_many_sync) {
|
|
|
1021
1021
|
int32_t highWaterMarkBytes = std::numeric_limits<int32_t>::max();
|
|
1022
1022
|
NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", highWaterMarkBytes));
|
|
1023
1023
|
|
|
1024
|
+
bool unsafe = false;
|
|
1025
|
+
NAPI_STATUS_THROWS(GetProperty(env, argv[2], "unsafe", unsafe));
|
|
1026
|
+
|
|
1024
1027
|
std::vector<rocksdb::Slice> keys;
|
|
1025
1028
|
keys.resize(count);
|
|
1026
1029
|
std::vector<rocksdb::Status> statuses;
|
|
@@ -1053,7 +1056,11 @@ NAPI_METHOD(db_get_many_sync) {
|
|
|
1053
1056
|
NAPI_STATUS_THROWS(napi_get_null(env, &row));
|
|
1054
1057
|
} else {
|
|
1055
1058
|
ROCKS_STATUS_THROWS_NAPI(statuses[n]);
|
|
1056
|
-
|
|
1059
|
+
if (unsafe) {
|
|
1060
|
+
NAPI_STATUS_THROWS(ConvertUnsafe(env, std::move(values[n]), valueEncoding, row));
|
|
1061
|
+
} else {
|
|
1062
|
+
NAPI_STATUS_THROWS(Convert(env, std::move(values[n]), valueEncoding, row));
|
|
1063
|
+
}
|
|
1057
1064
|
}
|
|
1058
1065
|
NAPI_STATUS_THROWS(napi_set_element(env, rows, n, row));
|
|
1059
1066
|
}
|
|
@@ -1082,6 +1089,9 @@ NAPI_METHOD(db_get_many) {
|
|
|
1082
1089
|
int32_t highWaterMarkBytes = std::numeric_limits<int32_t>::max();
|
|
1083
1090
|
NAPI_STATUS_THROWS(GetProperty(env, argv[2], "highWaterMarkBytes", highWaterMarkBytes));
|
|
1084
1091
|
|
|
1092
|
+
bool unsafe = false;
|
|
1093
|
+
NAPI_STATUS_THROWS(GetProperty(env, argv[2], "unsafe", unsafe));
|
|
1094
|
+
|
|
1085
1095
|
auto callback = argv[3];
|
|
1086
1096
|
|
|
1087
1097
|
struct State {
|
|
@@ -1133,7 +1143,11 @@ NAPI_METHOD(db_get_many) {
|
|
|
1133
1143
|
NAPI_STATUS_RETURN(napi_get_null(env, &row));
|
|
1134
1144
|
} else {
|
|
1135
1145
|
ROCKS_STATUS_RETURN_NAPI(state.statuses[n]);
|
|
1136
|
-
|
|
1146
|
+
if (unsafe) {
|
|
1147
|
+
NAPI_STATUS_RETURN(ConvertUnsafe(env, std::move(state.values[n]), valueEncoding, row));
|
|
1148
|
+
} else {
|
|
1149
|
+
NAPI_STATUS_RETURN(Convert(env, std::move(state.values[n]), valueEncoding, row));
|
|
1150
|
+
}
|
|
1137
1151
|
}
|
|
1138
1152
|
NAPI_STATUS_RETURN(napi_set_element(env, argv[1], n, row));
|
|
1139
1153
|
}
|
package/binding.gyp
CHANGED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[
|
|
9
9
|
"OS == 'linux'",
|
|
10
10
|
{
|
|
11
|
-
"cflags": ["-march=znver1"],
|
|
12
11
|
"include_dirs": [
|
|
13
12
|
"/usr/lib/x86_64-linux-gnu/include",
|
|
14
13
|
"/usr/lib/include",
|
|
15
14
|
],
|
|
15
|
+
"cflags": ["-march=znver1"],
|
|
16
16
|
"ccflags": ["-flto", '-march=znver1'],
|
|
17
17
|
"cflags!": ["-fno-exceptions"],
|
|
18
18
|
"cflags_cc!": ["-fno-exceptions"],
|
package/deps/rocksdb/rocksdb.gyp
CHANGED
|
@@ -111,15 +111,8 @@
|
|
|
111
111
|
"/usr/lib/include",
|
|
112
112
|
# "/usr/local/Cellar/jemalloc/5.3.0/include"
|
|
113
113
|
],
|
|
114
|
-
"cflags": [
|
|
115
|
-
|
|
116
|
-
"-mpclmul",
|
|
117
|
-
"-mavx",
|
|
118
|
-
"-mavx2",
|
|
119
|
-
"-mbmi",
|
|
120
|
-
"-mlzcnt"
|
|
121
|
-
],
|
|
122
|
-
"ccflags": ["-flto"],
|
|
114
|
+
"cflags": ["-march=znver1"],
|
|
115
|
+
"ccflags": ["-flto", "-march=znver1"],
|
|
123
116
|
"cflags!": ["-fno-exceptions"],
|
|
124
117
|
"cflags_cc!": ["-fno-exceptions"],
|
|
125
118
|
"ldflags": ["-flto", "-fuse-linker-plugin"],
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/util.h
CHANGED
|
@@ -271,16 +271,26 @@ napi_status Convert(napi_env env, T&& s, Encoding encoding, napi_value& result)
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
274
|
+
napi_status ConvertUnsafe(napi_env env, rocksdb::PinnableSlice&& s, Encoding encoding, napi_value& result) {
|
|
275
|
+
if (encoding == Encoding::Buffer) {
|
|
276
|
+
auto s2 = new rocksdb::PinnableSlice(std::move(s));
|
|
277
|
+
return napi_create_external_buffer(env, s2->size(), const_cast<char*>(s2->data()), Finalize<rocksdb::PinnableSlice>, s2, &result);
|
|
278
|
+
} else if (encoding == Encoding::String) {
|
|
279
|
+
return napi_create_string_utf8(env, s.data(), s.size(), &result);
|
|
280
|
+
} else {
|
|
281
|
+
return napi_invalid_arg;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
napi_status Convert(napi_env env, rocksdb::PinnableSlice&& s, Encoding encoding, napi_value& result) {
|
|
286
|
+
if (encoding == Encoding::Buffer) {
|
|
287
|
+
return napi_create_buffer_copy(env, s.size(), s.data(), nullptr, &result);
|
|
288
|
+
} else if (encoding == Encoding::String) {
|
|
289
|
+
return napi_create_string_utf8(env, s.data(), s.size(), &result);
|
|
290
|
+
} else {
|
|
291
|
+
return napi_invalid_arg;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
284
294
|
|
|
285
295
|
template <typename State, typename T1, typename T2>
|
|
286
296
|
napi_status runAsync(State&& state,
|