@harperfast/harper 5.0.2 → 5.0.3
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/bin/cliOperations.js +6 -4
- package/bin/copyDb.ts +208 -0
- package/bin/restart.js +8 -7
- package/bin/run.js +2 -1
- package/dist/bin/cliOperations.js +6 -4
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/copyDb.d.ts +1 -0
- package/dist/bin/copyDb.js +197 -0
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/restart.js +8 -7
- package/dist/bin/restart.js.map +1 -1
- package/dist/bin/run.js +3 -1
- package/dist/bin/run.js.map +1 -1
- package/dist/resources/DatabaseTransaction.js +17 -2
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/RecordEncoder.d.ts +1 -1
- package/dist/resources/RecordEncoder.js +2 -2
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +1 -1
- package/dist/resources/RocksIndexStore.d.ts +14 -7
- package/dist/resources/RocksIndexStore.js +19 -12
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/Table.js +43 -28
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/databases.js +18 -14
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +2 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +14 -12
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/security/certificateVerification/ocspVerification.js +1 -1
- package/dist/security/certificateVerification/ocspVerification.js.map +1 -1
- package/dist/security/keys.js +7 -7
- package/dist/security/keys.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +0 -4
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/utility/hdbTerms.d.ts +1 -0
- package/dist/utility/hdbTerms.js +1 -0
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/install/installer.js +11 -8
- package/dist/utility/install/installer.js.map +1 -1
- package/package.json +1 -1
- package/resources/DatabaseTransaction.ts +19 -2
- package/resources/RecordEncoder.ts +2 -2
- package/resources/ResourceInterface.ts +1 -1
- package/resources/RocksIndexStore.ts +20 -15
- package/resources/Table.ts +38 -24
- package/resources/databases.ts +29 -14
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +44 -23
- package/security/certificateVerification/ocspVerification.ts +1 -1
- package/security/keys.js +7 -7
- package/server/itc/serverHandlers.js +0 -4
- package/studio/web/assets/{index-f5-e8ocl.js → index-CxTavHFE.js} +5 -5
- package/studio/web/assets/{index-f5-e8ocl.js.map → index-CxTavHFE.js.map} +1 -1
- package/studio/web/assets/{index.lazy-CCd1vMot.js → index.lazy-CfiR1tvq.js} +2 -2
- package/studio/web/assets/{index.lazy-CCd1vMot.js.map → index.lazy-CfiR1tvq.js.map} +1 -1
- package/studio/web/assets/{profile-gjpePJuu.js → profile-C-uokAal.js} +2 -2
- package/studio/web/assets/{profile-gjpePJuu.js.map → profile-C-uokAal.js.map} +1 -1
- package/studio/web/assets/{status-CmoVx0A5.js → status-D6xeT4ss.js} +2 -2
- package/studio/web/assets/{status-CmoVx0A5.js.map → status-D6xeT4ss.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/utility/hdbTerms.ts +1 -0
- package/utility/install/installer.js +14 -10
package/dist/resources/Table.js
CHANGED
|
@@ -1320,27 +1320,41 @@ function makeTable(options) {
|
|
|
1320
1320
|
*/
|
|
1321
1321
|
static evict(id, existingRecord, existingVersion) {
|
|
1322
1322
|
let entry;
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1323
|
+
let transaction = txnForContext({ transaction: new DatabaseTransaction_ts_1.DatabaseTransaction() }).getReadTxn();
|
|
1324
|
+
let options = { transaction };
|
|
1325
|
+
try {
|
|
1326
|
+
if (hasSourceGet || audit) {
|
|
1327
|
+
if (!existingRecord)
|
|
1328
|
+
return;
|
|
1329
|
+
entry = primaryStore.getEntry(id, options);
|
|
1330
|
+
if (!entry || !existingRecord)
|
|
1331
|
+
return;
|
|
1332
|
+
if (entry.version !== existingVersion)
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
if (hasSourceGet) {
|
|
1336
|
+
// if there is a resolution in-progress, abandon the eviction
|
|
1337
|
+
if (primaryStore.hasLock(id, entry.version))
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
// evictions never go in the audit log, so we can not record a deletion entry for the eviction
|
|
1341
|
+
// as there is no corresponding audit entry and it would never get cleaned up. So we must simply
|
|
1342
|
+
// removed the entry entirely, but first cleanup indices
|
|
1343
|
+
if (primaryStore.ifVersion) {
|
|
1344
|
+
// lmdb
|
|
1345
|
+
primaryStore.ifVersion?.(id, existingVersion, () => {
|
|
1346
|
+
updateIndices(id, existingRecord, null);
|
|
1347
|
+
});
|
|
1348
|
+
return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
|
|
1349
|
+
}
|
|
1350
|
+
else {
|
|
1351
|
+
updateIndices(id, existingRecord, null, options);
|
|
1352
|
+
return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), options);
|
|
1353
|
+
}
|
|
1331
1354
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
if (primaryStore.hasLock(id, entry.version))
|
|
1335
|
-
return;
|
|
1355
|
+
finally {
|
|
1356
|
+
return transaction.commit();
|
|
1336
1357
|
}
|
|
1337
|
-
primaryStore.ifVersion?.(id, existingVersion, () => {
|
|
1338
|
-
updateIndices(id, existingRecord, null);
|
|
1339
|
-
});
|
|
1340
|
-
// evictions never go in the audit log, so we can not record a deletion entry for the eviction
|
|
1341
|
-
// as there is no corresponding audit entry and it would never get cleaned up. So we must simply
|
|
1342
|
-
// removed the entry entirely
|
|
1343
|
-
return (0, RecordEncoder_ts_1.removeEntry)(primaryStore, entry ?? primaryStore.getEntry(id), existingVersion);
|
|
1344
1358
|
}
|
|
1345
1359
|
/**
|
|
1346
1360
|
* This is intended to acquire a lock on a record from the whole cluster.
|
|
@@ -1798,10 +1812,10 @@ function makeTable(options) {
|
|
|
1798
1812
|
context.lastModified = existingEntry.version;
|
|
1799
1813
|
TableResource._updateResource(this, existingEntry);
|
|
1800
1814
|
}
|
|
1801
|
-
if (precedesExistingVersion(txnTime, existingEntry, options?.nodeId)
|
|
1802
|
-
return;
|
|
1803
|
-
|
|
1804
|
-
|
|
1815
|
+
if (precedesExistingVersion(txnTime, existingEntry, options?.nodeId) < 0) {
|
|
1816
|
+
return;
|
|
1817
|
+
} // a newer record exists locally
|
|
1818
|
+
updateIndices(id, existingRecord, null, transaction && { transaction });
|
|
1805
1819
|
if (audit || trackDeletes) {
|
|
1806
1820
|
updateRecord(id, null, existingEntry, txnTime, 0, audit, {
|
|
1807
1821
|
user: context?.user,
|
|
@@ -3311,6 +3325,7 @@ function makeTable(options) {
|
|
|
3311
3325
|
// determine what index values need to be removed and added
|
|
3312
3326
|
let valuesToAdd = (0, commonUtility_js_1.getIndexedValues)(value, indexNulls);
|
|
3313
3327
|
let valuesToRemove = (0, commonUtility_js_1.getIndexedValues)(existingValue, indexNulls);
|
|
3328
|
+
let isLMDB = !!index.prefetch;
|
|
3314
3329
|
if (valuesToRemove?.length > 0) {
|
|
3315
3330
|
// put this in a conditional so we can do a faster version for new records
|
|
3316
3331
|
// determine the changes/diff from new values and old values
|
|
@@ -3328,19 +3343,19 @@ function makeTable(options) {
|
|
|
3328
3343
|
})
|
|
3329
3344
|
: [];
|
|
3330
3345
|
valuesToRemove = Array.from(setToRemove);
|
|
3331
|
-
if ((valuesToRemove.length > 0 || valuesToAdd.length > 0) && LMDB_PREFETCH_WRITES) {
|
|
3346
|
+
if (isLMDB && (valuesToRemove.length > 0 || valuesToAdd.length > 0) && LMDB_PREFETCH_WRITES) {
|
|
3332
3347
|
// prefetch any values that have been removed or added
|
|
3333
3348
|
const valuesToPrefetch = valuesToRemove.concat(valuesToAdd).map((v) => ({ key: v, value: id }));
|
|
3334
|
-
index.prefetch
|
|
3349
|
+
index.prefetch(valuesToPrefetch, noop);
|
|
3335
3350
|
}
|
|
3336
3351
|
//if the update cleared out the attribute value we need to delete it from the index
|
|
3337
3352
|
for (let i = 0, l = valuesToRemove.length; i < l; i++) {
|
|
3338
3353
|
index.remove(valuesToRemove[i], id, options);
|
|
3339
3354
|
}
|
|
3340
3355
|
}
|
|
3341
|
-
else if (valuesToAdd?.length > 0 && LMDB_PREFETCH_WRITES) {
|
|
3356
|
+
else if (isLMDB && valuesToAdd?.length > 0 && LMDB_PREFETCH_WRITES) {
|
|
3342
3357
|
// no old values, just new
|
|
3343
|
-
index.prefetch
|
|
3358
|
+
index.prefetch(valuesToAdd.map((v) => ({ key: v, value: id })), noop);
|
|
3344
3359
|
}
|
|
3345
3360
|
if (valuesToAdd) {
|
|
3346
3361
|
for (let i = 0, l = valuesToAdd.length; i < l; i++) {
|
|
@@ -3949,7 +3964,7 @@ function makeTable(options) {
|
|
|
3949
3964
|
// don't do anything if the version has changed
|
|
3950
3965
|
return;
|
|
3951
3966
|
}
|
|
3952
|
-
updateIndices(id, existingRecord, updatedRecord);
|
|
3967
|
+
updateIndices(id, existingRecord, updatedRecord, transaction && { transaction });
|
|
3953
3968
|
if (updatedRecord) {
|
|
3954
3969
|
if (existingEntry) {
|
|
3955
3970
|
context.previousResidency = TableResource.getResidencyRecord(existingEntry.residencyId);
|