@nxtedition/rocksdb 7.0.33 → 7.0.34
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 +7 -3
- 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,8 +241,7 @@ 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
|
|
245
|
-
column: options?.column ?? null
|
|
244
|
+
data: options?.data ?? true
|
|
246
245
|
}
|
|
247
246
|
|
|
248
247
|
if (typeof options.since !== 'number') {
|
|
@@ -261,10 +260,15 @@ class RocksLevel extends AbstractLevel {
|
|
|
261
260
|
throw new TypeError("'data' must be nully or a boolean")
|
|
262
261
|
}
|
|
263
262
|
|
|
264
|
-
if (typeof options.column !== 'object') {
|
|
263
|
+
if (options.column !== undefined && typeof options.column !== 'object') {
|
|
265
264
|
throw new TypeError("'column' must be nully or a object")
|
|
266
265
|
}
|
|
267
266
|
|
|
267
|
+
// HACK: We don't properly check for nully column in binding.
|
|
268
|
+
if (!options.column) {
|
|
269
|
+
delete options.column
|
|
270
|
+
}
|
|
271
|
+
|
|
268
272
|
class Updates {
|
|
269
273
|
constructor (db, options) {
|
|
270
274
|
this.context = binding.updates_init(db[kContext], options)
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|