@nxtedition/rocksdb 7.0.32 → 7.0.35
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 +20 -11
- package/index.js +11 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
package/binding.cc
CHANGED
|
@@ -544,7 +544,13 @@ struct Updates {
|
|
|
544
544
|
bool values,
|
|
545
545
|
bool data,
|
|
546
546
|
const rocksdb::ColumnFamilyHandle* column)
|
|
547
|
-
: database_(database),
|
|
547
|
+
: database_(database),
|
|
548
|
+
sequence_(seqNumber),
|
|
549
|
+
start_(seqNumber),
|
|
550
|
+
keys_(keys),
|
|
551
|
+
values_(values),
|
|
552
|
+
data_(data),
|
|
553
|
+
column_(column) {}
|
|
548
554
|
|
|
549
555
|
void Close() { iterator_.reset(); }
|
|
550
556
|
|
|
@@ -561,7 +567,8 @@ struct Updates {
|
|
|
561
567
|
}
|
|
562
568
|
|
|
563
569
|
Database* database_;
|
|
564
|
-
int64_t
|
|
570
|
+
int64_t sequence_;
|
|
571
|
+
int64_t start_;
|
|
565
572
|
std::unique_ptr<rocksdb::TransactionLogIterator> iterator_;
|
|
566
573
|
bool keys_;
|
|
567
574
|
bool values_;
|
|
@@ -940,24 +947,23 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
940
947
|
}
|
|
941
948
|
|
|
942
949
|
rocksdb::Status Execute(Database& database) override {
|
|
943
|
-
rocksdb::TransactionLogIterator::ReadOptions options;
|
|
944
|
-
|
|
945
950
|
if (!updates_->iterator_) {
|
|
946
|
-
|
|
951
|
+
rocksdb::TransactionLogIterator::ReadOptions options;
|
|
952
|
+
const auto status = database_->db_->GetUpdatesSince(updates_->sequence_, &updates_->iterator_, options);
|
|
947
953
|
if (!status.ok()) {
|
|
948
954
|
return status;
|
|
949
955
|
}
|
|
950
|
-
} else {
|
|
956
|
+
} else if (updates_->iterator_->Valid()) {
|
|
951
957
|
updates_->iterator_->Next();
|
|
952
958
|
}
|
|
953
959
|
|
|
954
|
-
if (!updates_->iterator_->Valid()) {
|
|
960
|
+
if (!updates_->iterator_->Valid() || !updates_->iterator_->status().ok()) {
|
|
955
961
|
return updates_->iterator_->status();
|
|
956
962
|
}
|
|
957
963
|
|
|
958
964
|
auto batch = updates_->iterator_->GetBatch();
|
|
959
965
|
|
|
960
|
-
updates_->
|
|
966
|
+
updates_->sequence_ = batch.sequence;
|
|
961
967
|
|
|
962
968
|
count_ = batch.writeBatchPtr->Count();
|
|
963
969
|
cache_.reserve(batch.writeBatchPtr->Count() * 4);
|
|
@@ -966,7 +972,7 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
966
972
|
}
|
|
967
973
|
|
|
968
974
|
napi_status OnOk(napi_env env, napi_value callback) override {
|
|
969
|
-
napi_value argv[
|
|
975
|
+
napi_value argv[5];
|
|
970
976
|
|
|
971
977
|
NAPI_STATUS_RETURN(napi_get_null(env, &argv[0]));
|
|
972
978
|
|
|
@@ -981,11 +987,13 @@ struct UpdatesNextWorker final : public rocksdb::WriteBatch::Handler, public Wor
|
|
|
981
987
|
NAPI_STATUS_RETURN(napi_set_element(env, argv[1], idx, val));
|
|
982
988
|
}
|
|
983
989
|
|
|
984
|
-
NAPI_STATUS_RETURN(napi_create_int64(env, updates_->
|
|
990
|
+
NAPI_STATUS_RETURN(napi_create_int64(env, updates_->sequence_, &argv[2]));
|
|
985
991
|
|
|
986
992
|
NAPI_STATUS_RETURN(napi_create_int64(env, count_, &argv[3]));
|
|
987
993
|
|
|
988
|
-
|
|
994
|
+
NAPI_STATUS_RETURN(napi_create_int64(env, updates_->start_, &argv[4]));
|
|
995
|
+
|
|
996
|
+
return CallFunction(env, callback, 5, argv);
|
|
989
997
|
}
|
|
990
998
|
|
|
991
999
|
void Destroy(napi_env env) override {
|
|
@@ -1126,6 +1134,7 @@ NAPI_METHOD(updates_init) {
|
|
|
1126
1134
|
NAPI_STATUS_THROWS(napi_get_named_property(env, argv[1], "data", &dataProperty));
|
|
1127
1135
|
NAPI_STATUS_THROWS(napi_get_value_bool(env, dataProperty, &data));
|
|
1128
1136
|
|
|
1137
|
+
// TODO (fix): Needs to support { column: null }
|
|
1129
1138
|
rocksdb::ColumnFamilyHandle* column;
|
|
1130
1139
|
NAPI_STATUS_THROWS(GetColumnFamily(database, env, argv[1], &column, false));
|
|
1131
1140
|
|
package/index.js
CHANGED
|
@@ -241,7 +241,13 @@ class RocksLevel extends AbstractLevel {
|
|
|
241
241
|
since: options?.since ?? 0,
|
|
242
242
|
keys: options?.keys ?? true,
|
|
243
243
|
values: options?.values ?? true,
|
|
244
|
-
data: options?.data ?? true
|
|
244
|
+
data: options?.data ?? true,
|
|
245
|
+
column: options?.column ?? null
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// HACK: We don't properly check for nully column in binding.
|
|
249
|
+
if (!options.column) {
|
|
250
|
+
delete options.column
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
if (typeof options.since !== 'number') {
|
|
@@ -260,6 +266,10 @@ class RocksLevel extends AbstractLevel {
|
|
|
260
266
|
throw new TypeError("'data' must be nully or a boolean")
|
|
261
267
|
}
|
|
262
268
|
|
|
269
|
+
if (options.column !== undefined && typeof options.column !== 'object') {
|
|
270
|
+
throw new TypeError("'column' must be nully or a object")
|
|
271
|
+
}
|
|
272
|
+
|
|
263
273
|
class Updates {
|
|
264
274
|
constructor (db, options) {
|
|
265
275
|
this.context = binding.updates_init(db[kContext], options)
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|