autobee 2.10.0 → 2.11.0
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/encoding/legacy.js +4 -3
- package/encoding/spec/autobee/index.js +35 -29
- package/encoding/spec/autobee/schema.json +14 -0
- package/index.js +140 -11
- package/lib/boot.js +8 -8
- package/lib/constants.js +2 -0
- package/lib/encoding.js +3 -1
- package/lib/fast-forward.js +36 -15
- package/lib/migrations.js +10 -6
- package/lib/writers.js +13 -6
- package/package.json +5 -4
package/encoding/legacy.js
CHANGED
|
@@ -215,7 +215,6 @@ const OplogMessageV1 = {
|
|
|
215
215
|
throw new Error('Encoding not supported')
|
|
216
216
|
},
|
|
217
217
|
decode(state) {
|
|
218
|
-
c.uint.decode(state) // version
|
|
219
218
|
const maxSupportedVersion = c.uint.decode(state)
|
|
220
219
|
|
|
221
220
|
const flags = c.uint.decode(state)
|
|
@@ -246,7 +245,6 @@ const OplogMessageV0 = {
|
|
|
246
245
|
throw new Error('Encoding not supported')
|
|
247
246
|
},
|
|
248
247
|
decode(state) {
|
|
249
|
-
c.uint.decode(state) // version
|
|
250
248
|
const flags = c.uint.decode(state)
|
|
251
249
|
|
|
252
250
|
const isCheckpointer = (flags & 1) !== 0
|
|
@@ -276,6 +274,7 @@ const SystemWriterV0 = {
|
|
|
276
274
|
throw new Error('Encoding not supported')
|
|
277
275
|
},
|
|
278
276
|
decode(state) {
|
|
277
|
+
state.start-- // Undo the hack to nest this in a versioned struct w/o a version
|
|
279
278
|
const flags = c.uint.decode(state)
|
|
280
279
|
|
|
281
280
|
return {
|
|
@@ -328,7 +327,9 @@ function oplogLegacyMap(m) {
|
|
|
328
327
|
witness: null,
|
|
329
328
|
approvals: null,
|
|
330
329
|
optimistic: m.optimistic,
|
|
331
|
-
value: m.value
|
|
330
|
+
value: m.value,
|
|
331
|
+
weightHint: 0,
|
|
332
|
+
drift: 0
|
|
332
333
|
}
|
|
333
334
|
}
|
|
334
335
|
|
|
@@ -108,13 +108,12 @@ const encoding4 = {
|
|
|
108
108
|
if (m.recoveries) c.uint.encode(state, m.recoveries)
|
|
109
109
|
},
|
|
110
110
|
decode(state) {
|
|
111
|
-
const v = c.uint.decode(state)
|
|
112
111
|
const r0 = c.fixed32.decode(state)
|
|
113
112
|
const r1 = c.uint.decode(state)
|
|
114
113
|
const flags = c.uint.decode(state)
|
|
115
114
|
|
|
116
115
|
return {
|
|
117
|
-
version:
|
|
116
|
+
version: 0,
|
|
118
117
|
key: r0,
|
|
119
118
|
systemLength: r1,
|
|
120
119
|
indexersUpdated: (flags & 1) !== 0,
|
|
@@ -159,18 +158,18 @@ const encoding5 = {
|
|
|
159
158
|
}
|
|
160
159
|
},
|
|
161
160
|
decode(state) {
|
|
162
|
-
const start = state.start
|
|
163
161
|
const v = c.uint.decode(state)
|
|
164
|
-
state.start = start
|
|
165
162
|
switch (v) {
|
|
166
163
|
case 0: {
|
|
167
164
|
const decoded = encoding3.decode(state)
|
|
165
|
+
decoded.version = v
|
|
168
166
|
return decoded
|
|
169
167
|
}
|
|
170
168
|
case 1:
|
|
171
169
|
case 2:
|
|
172
170
|
case 3: {
|
|
173
171
|
const decoded = encoding4.decode(state)
|
|
172
|
+
decoded.version = v
|
|
174
173
|
return decoded
|
|
175
174
|
}
|
|
176
175
|
default:
|
|
@@ -377,12 +376,11 @@ const encoding14 = {
|
|
|
377
376
|
if (m.trace) encoding14_4.encode(state, m.trace)
|
|
378
377
|
},
|
|
379
378
|
decode(state) {
|
|
380
|
-
const v = c.uint.decode(state)
|
|
381
379
|
const r0 = encoding9.decode(state)
|
|
382
380
|
const flags = c.uint.decode(state)
|
|
383
381
|
|
|
384
382
|
return {
|
|
385
|
-
version:
|
|
383
|
+
version: 0,
|
|
386
384
|
node: r0,
|
|
387
385
|
checkpoint: (flags & 1) !== 0 ? encoding14_1.decode(state) : null,
|
|
388
386
|
digest: (flags & 2) !== 0 ? encoding14_2.decode(state) : null,
|
|
@@ -412,7 +410,6 @@ const encoding15 = {
|
|
|
412
410
|
encoding1.encode(state, m.views)
|
|
413
411
|
},
|
|
414
412
|
decode(state) {
|
|
415
|
-
const v = c.uint.decode(state)
|
|
416
413
|
const r0 = c.uint.decode(state)
|
|
417
414
|
const r1 = encoding15_1.decode(state)
|
|
418
415
|
const r2 = encoding1.decode(state)
|
|
@@ -420,7 +417,7 @@ const encoding15 = {
|
|
|
420
417
|
const r4 = encoding1.decode(state)
|
|
421
418
|
|
|
422
419
|
return {
|
|
423
|
-
version:
|
|
420
|
+
version: 0,
|
|
424
421
|
members: r0,
|
|
425
422
|
pendingIndexers: r1,
|
|
426
423
|
indexers: r2,
|
|
@@ -460,7 +457,6 @@ const encoding16 = {
|
|
|
460
457
|
if (m.entropy) c.fixed32.encode(state, m.entropy)
|
|
461
458
|
},
|
|
462
459
|
decode(state) {
|
|
463
|
-
const v = c.uint.decode(state)
|
|
464
460
|
const r0 = c.uint.decode(state)
|
|
465
461
|
const r1 = encoding16_1.decode(state)
|
|
466
462
|
const r2 = encoding1.decode(state)
|
|
@@ -470,7 +466,7 @@ const encoding16 = {
|
|
|
470
466
|
const flags = c.uint.decode(state)
|
|
471
467
|
|
|
472
468
|
return {
|
|
473
|
-
version:
|
|
469
|
+
version: 0,
|
|
474
470
|
members: r0,
|
|
475
471
|
pendingIndexers: r1,
|
|
476
472
|
indexers: r2,
|
|
@@ -514,7 +510,6 @@ const encoding18 = {
|
|
|
514
510
|
if (m.hash) c.fixed8.encode(state, m.hash)
|
|
515
511
|
},
|
|
516
512
|
decode(state) {
|
|
517
|
-
const v = c.uint.decode(state)
|
|
518
513
|
const r0 = c.uint.decode(state)
|
|
519
514
|
const r1 = c.uint.decode(state)
|
|
520
515
|
const r2 = encoding22.decode(state)
|
|
@@ -522,7 +517,7 @@ const encoding18 = {
|
|
|
522
517
|
const flags = c.uint.decode(state)
|
|
523
518
|
|
|
524
519
|
return {
|
|
525
|
-
version:
|
|
520
|
+
version: 0,
|
|
526
521
|
timestamp: r0,
|
|
527
522
|
flushes: r1,
|
|
528
523
|
view: r2,
|
|
@@ -573,22 +568,23 @@ const encoding19 = {
|
|
|
573
568
|
}
|
|
574
569
|
},
|
|
575
570
|
decode(state) {
|
|
576
|
-
const start = state.start
|
|
577
571
|
const v = c.uint.decode(state)
|
|
578
|
-
state.start = start
|
|
579
572
|
switch (v) {
|
|
580
573
|
case 0:
|
|
581
574
|
case 1: {
|
|
582
575
|
const decoded = encoding15.decode(state)
|
|
576
|
+
decoded.version = v
|
|
583
577
|
const map = external0.infoLegacyMap
|
|
584
578
|
return map(decoded)
|
|
585
579
|
}
|
|
586
580
|
case 2: {
|
|
587
581
|
const decoded = encoding16.decode(state)
|
|
582
|
+
decoded.version = v
|
|
588
583
|
return decoded
|
|
589
584
|
}
|
|
590
585
|
case 3: {
|
|
591
586
|
const decoded = encoding18.decode(state)
|
|
587
|
+
decoded.version = v
|
|
592
588
|
return decoded
|
|
593
589
|
}
|
|
594
590
|
default:
|
|
@@ -625,11 +621,10 @@ const encoding20 = {
|
|
|
625
621
|
if (m.timestamp) c.int.encode(state, m.timestamp)
|
|
626
622
|
},
|
|
627
623
|
decode(state) {
|
|
628
|
-
const v = c.uint.decode(state)
|
|
629
624
|
const flags = c.uint.decode(state)
|
|
630
625
|
|
|
631
626
|
return {
|
|
632
|
-
version:
|
|
627
|
+
version: 0,
|
|
633
628
|
isRemoved: (flags & 1) !== 0,
|
|
634
629
|
isOplog: (flags & 2) !== 0,
|
|
635
630
|
weight: c.uint.decode(state),
|
|
@@ -686,24 +681,25 @@ const encoding21 = {
|
|
|
686
681
|
}
|
|
687
682
|
},
|
|
688
683
|
decode(state) {
|
|
689
|
-
const start = state.start
|
|
690
684
|
const v = c.uint.decode(state)
|
|
691
|
-
state.start = start
|
|
692
685
|
switch (v) {
|
|
693
686
|
case 0:
|
|
694
687
|
case 1:
|
|
695
688
|
case 2:
|
|
696
689
|
case 3: {
|
|
697
690
|
const decoded = encoding17.decode(state)
|
|
691
|
+
decoded.version = v
|
|
698
692
|
const map = external0.memberLegacyMap
|
|
699
693
|
return map(decoded)
|
|
700
694
|
}
|
|
701
695
|
case 4: {
|
|
702
696
|
const decoded = encoding20.decode(state)
|
|
697
|
+
decoded.version = v
|
|
703
698
|
return decoded
|
|
704
699
|
}
|
|
705
700
|
case 5: {
|
|
706
701
|
const decoded = encoding34.decode(state)
|
|
702
|
+
decoded.version = v
|
|
707
703
|
return decoded
|
|
708
704
|
}
|
|
709
705
|
default:
|
|
@@ -953,13 +949,12 @@ const encoding29 = {
|
|
|
953
949
|
if (m.trusted) encoding29_8.encode(state, m.trusted)
|
|
954
950
|
},
|
|
955
951
|
decode(state) {
|
|
956
|
-
const v = c.uint.decode(state)
|
|
957
952
|
const r0 = c.uint.decode(state)
|
|
958
953
|
const r1 = encoding29_1.decode(state)
|
|
959
954
|
const flags = c.uint.decode(state)
|
|
960
955
|
|
|
961
956
|
return {
|
|
962
|
-
version:
|
|
957
|
+
version: 0,
|
|
963
958
|
timestamp: r0,
|
|
964
959
|
links: r1,
|
|
965
960
|
batch: (flags & 1) !== 0 ? encoding24.decode(state) : null,
|
|
@@ -1022,29 +1017,32 @@ const encoding30 = {
|
|
|
1022
1017
|
}
|
|
1023
1018
|
},
|
|
1024
1019
|
decode(state) {
|
|
1025
|
-
const start = state.start
|
|
1026
1020
|
const v = c.uint.decode(state)
|
|
1027
|
-
state.start = start
|
|
1028
1021
|
switch (v) {
|
|
1029
1022
|
case 0: {
|
|
1030
1023
|
const decoded = encoding12.decode(state)
|
|
1024
|
+
decoded.version = v
|
|
1031
1025
|
return decoded
|
|
1032
1026
|
}
|
|
1033
1027
|
case 1: {
|
|
1034
1028
|
const decoded = encoding13.decode(state)
|
|
1029
|
+
decoded.version = v
|
|
1035
1030
|
return decoded
|
|
1036
1031
|
}
|
|
1037
1032
|
case 2: {
|
|
1038
1033
|
const decoded = encoding14.decode(state)
|
|
1034
|
+
decoded.version = v
|
|
1039
1035
|
return decoded
|
|
1040
1036
|
}
|
|
1041
1037
|
case 3: {
|
|
1042
1038
|
const decoded = encoding29.decode(state)
|
|
1039
|
+
decoded.version = v
|
|
1043
1040
|
const map = external0.oplogLegacyMap
|
|
1044
1041
|
return map(decoded)
|
|
1045
1042
|
}
|
|
1046
1043
|
case 4: {
|
|
1047
1044
|
const decoded = encoding37.decode(state)
|
|
1045
|
+
decoded.version = v
|
|
1048
1046
|
return decoded
|
|
1049
1047
|
}
|
|
1050
1048
|
default:
|
|
@@ -1154,11 +1152,10 @@ const encoding34 = {
|
|
|
1154
1152
|
c.uint.encode(state, m.timestamp)
|
|
1155
1153
|
},
|
|
1156
1154
|
decode(state) {
|
|
1157
|
-
const v = c.uint.decode(state)
|
|
1158
1155
|
const flags = c.uint.decode(state)
|
|
1159
1156
|
|
|
1160
1157
|
return {
|
|
1161
|
-
version:
|
|
1158
|
+
version: 0,
|
|
1162
1159
|
isRemoved: (flags & 1) !== 0,
|
|
1163
1160
|
isOplog: (flags & 2) !== 0,
|
|
1164
1161
|
isGenesis: (flags & 4) !== 0,
|
|
@@ -1226,7 +1223,9 @@ const encoding37 = {
|
|
|
1226
1223
|
(m.approvals ? 16 : 0) |
|
|
1227
1224
|
(m.optimistic ? 32 : 0) |
|
|
1228
1225
|
(m.value ? 64 : 0) |
|
|
1229
|
-
(m.hash ? 128 : 0)
|
|
1226
|
+
(m.hash ? 128 : 0) |
|
|
1227
|
+
(m.weightHint ? 256 : 0) |
|
|
1228
|
+
(m.drift ? 512 : 0)
|
|
1230
1229
|
|
|
1231
1230
|
c.uint.preencode(state, m.timestamp)
|
|
1232
1231
|
encoding37_1.preencode(state, m.links)
|
|
@@ -1239,6 +1238,8 @@ const encoding37 = {
|
|
|
1239
1238
|
if (m.approvals) encoding37_6.preencode(state, m.approvals)
|
|
1240
1239
|
if (m.value) c.buffer.preencode(state, m.value)
|
|
1241
1240
|
if (m.hash) c.fixed8.preencode(state, m.hash)
|
|
1241
|
+
if (m.weightHint) c.uint.preencode(state, m.weightHint)
|
|
1242
|
+
if (m.drift) c.uint.preencode(state, m.drift)
|
|
1242
1243
|
},
|
|
1243
1244
|
encode(state, m) {
|
|
1244
1245
|
const flags =
|
|
@@ -1249,7 +1250,9 @@ const encoding37 = {
|
|
|
1249
1250
|
(m.approvals ? 16 : 0) |
|
|
1250
1251
|
(m.optimistic ? 32 : 0) |
|
|
1251
1252
|
(m.value ? 64 : 0) |
|
|
1252
|
-
(m.hash ? 128 : 0)
|
|
1253
|
+
(m.hash ? 128 : 0) |
|
|
1254
|
+
(m.weightHint ? 256 : 0) |
|
|
1255
|
+
(m.drift ? 512 : 0)
|
|
1253
1256
|
|
|
1254
1257
|
c.uint.encode(state, m.timestamp)
|
|
1255
1258
|
encoding37_1.encode(state, m.links)
|
|
@@ -1262,15 +1265,16 @@ const encoding37 = {
|
|
|
1262
1265
|
if (m.approvals) encoding37_6.encode(state, m.approvals)
|
|
1263
1266
|
if (m.value) c.buffer.encode(state, m.value)
|
|
1264
1267
|
if (m.hash) c.fixed8.encode(state, m.hash)
|
|
1268
|
+
if (m.weightHint) c.uint.encode(state, m.weightHint)
|
|
1269
|
+
if (m.drift) c.uint.encode(state, m.drift)
|
|
1265
1270
|
},
|
|
1266
1271
|
decode(state) {
|
|
1267
|
-
const v = c.uint.decode(state)
|
|
1268
1272
|
const r0 = c.uint.decode(state)
|
|
1269
1273
|
const r1 = encoding37_1.decode(state)
|
|
1270
1274
|
const flags = c.uint.decode(state)
|
|
1271
1275
|
|
|
1272
1276
|
return {
|
|
1273
|
-
version:
|
|
1277
|
+
version: 0,
|
|
1274
1278
|
timestamp: r0,
|
|
1275
1279
|
links: r1,
|
|
1276
1280
|
batch: (flags & 1) !== 0 ? encoding24.decode(state) : null,
|
|
@@ -1280,7 +1284,9 @@ const encoding37 = {
|
|
|
1280
1284
|
approvals: (flags & 16) !== 0 ? encoding37_6.decode(state) : null,
|
|
1281
1285
|
optimistic: (flags & 32) !== 0,
|
|
1282
1286
|
value: (flags & 64) !== 0 ? c.buffer.decode(state) : null,
|
|
1283
|
-
hash: (flags & 128) !== 0 ? c.fixed8.decode(state) : null
|
|
1287
|
+
hash: (flags & 128) !== 0 ? c.fixed8.decode(state) : null,
|
|
1288
|
+
weightHint: (flags & 256) !== 0 ? c.uint.decode(state) : 0,
|
|
1289
|
+
drift: (flags & 512) !== 0 ? c.uint.decode(state) : 0
|
|
1284
1290
|
}
|
|
1285
1291
|
}
|
|
1286
1292
|
}
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
{
|
|
94
94
|
"name": "boot-record",
|
|
95
95
|
"namespace": "autobase-compat",
|
|
96
|
+
"framed": false,
|
|
96
97
|
"versions": [
|
|
97
98
|
{
|
|
98
99
|
"type": "@autobase-compat/boot-record-v0",
|
|
@@ -445,6 +446,7 @@
|
|
|
445
446
|
{
|
|
446
447
|
"name": "system-info",
|
|
447
448
|
"namespace": "autobee",
|
|
449
|
+
"framed": false,
|
|
448
450
|
"versions": [
|
|
449
451
|
{
|
|
450
452
|
"type": "@autobase-compat/info-v1",
|
|
@@ -528,6 +530,7 @@
|
|
|
528
530
|
{
|
|
529
531
|
"name": "system-writer",
|
|
530
532
|
"namespace": "autobee",
|
|
533
|
+
"framed": false,
|
|
531
534
|
"versions": [
|
|
532
535
|
{
|
|
533
536
|
"type": "@autobase-compat/member",
|
|
@@ -778,6 +781,7 @@
|
|
|
778
781
|
{
|
|
779
782
|
"name": "oplog",
|
|
780
783
|
"namespace": "autobee",
|
|
784
|
+
"framed": false,
|
|
781
785
|
"versions": [
|
|
782
786
|
{
|
|
783
787
|
"type": "@autobase-compat/oplog-message-v0",
|
|
@@ -1028,6 +1032,16 @@
|
|
|
1028
1032
|
"name": "hash",
|
|
1029
1033
|
"type": "fixed8",
|
|
1030
1034
|
"version": 1
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
"name": "weightHint",
|
|
1038
|
+
"type": "uint",
|
|
1039
|
+
"version": 1
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
"name": "drift",
|
|
1043
|
+
"type": "uint",
|
|
1044
|
+
"version": 1
|
|
1031
1045
|
}
|
|
1032
1046
|
]
|
|
1033
1047
|
}
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const safetyCatch = require('safety-catch')
|
|
|
5
5
|
const Hyperbee = require('hyperbee2')
|
|
6
6
|
const ID = require('hypercore-id-encoding')
|
|
7
7
|
const rrp = require('resolve-reject-promise')
|
|
8
|
+
const Signal = require('signal-promise')
|
|
8
9
|
const { AutobeeEncryption, WriterEncryption, ViewEncryption } = require('autobee-encryption')
|
|
9
10
|
const AutobeeWakeup = require('autobee-wakeup')
|
|
10
11
|
const Hypercore = require('hypercore')
|
|
@@ -12,6 +13,7 @@ const crypto = require('hypercore-crypto')
|
|
|
12
13
|
const c = require('compact-encoding')
|
|
13
14
|
const asserts = require('./lib/asserts.js')
|
|
14
15
|
const boot = require('./lib/boot.js')
|
|
16
|
+
const { DEFAULT_MANIFEST_VERSION } = require('./lib/constants.js')
|
|
15
17
|
const { resolveWeight, currentWeight } = require('./lib/witness.js')
|
|
16
18
|
const encoding = require('./lib/encoding.js')
|
|
17
19
|
const FastForward = require('./lib/fast-forward.js')
|
|
@@ -26,6 +28,7 @@ const migrations = require('./lib/migrations.js')
|
|
|
26
28
|
|
|
27
29
|
const EMPTY_HEAD = { length: 0, key: null }
|
|
28
30
|
const DEFAULT_ACK_THRESHOLD = 32
|
|
31
|
+
const BOOT_NETWORK_TIMEOUT = 5000
|
|
29
32
|
const INTERRUPT = new Error('Apply interrupted')
|
|
30
33
|
|
|
31
34
|
module.exports = class Autobee extends ReadyResource {
|
|
@@ -116,6 +119,9 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
116
119
|
this.fastForwardTo = null
|
|
117
120
|
this._ffCandidates = new Map()
|
|
118
121
|
this._ffSearching = null
|
|
122
|
+
this._bumpSignal = new Signal()
|
|
123
|
+
this._networkBooted = false
|
|
124
|
+
this._networkBooting = false
|
|
119
125
|
|
|
120
126
|
this._workingBee = bee
|
|
121
127
|
this._workingView = new ApplyView(this._workingBee, this)
|
|
@@ -129,7 +135,6 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
129
135
|
this._localViewStart = 0
|
|
130
136
|
this._localViewLength = 0
|
|
131
137
|
|
|
132
|
-
this._appending = []
|
|
133
138
|
this._draining = null
|
|
134
139
|
this._updating = null
|
|
135
140
|
|
|
@@ -144,6 +149,7 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
144
149
|
this._now = handlers.now || Date.now // overridable for clock-drift tests
|
|
145
150
|
this._preapply = handlers.preapply || null
|
|
146
151
|
this._preApplied = false
|
|
152
|
+
this._reindexed = false
|
|
147
153
|
this._warmup = handlers.warmup || null
|
|
148
154
|
this._hasApply = !!handlers.apply
|
|
149
155
|
this._hasUpdate = !!handlers.update
|
|
@@ -181,6 +187,10 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
181
187
|
return this.writers ? this.writers.localWriter.isIndexer : false
|
|
182
188
|
}
|
|
183
189
|
|
|
190
|
+
get appending() {
|
|
191
|
+
return this.writers ? this.writers.localWriter.appending : false
|
|
192
|
+
}
|
|
193
|
+
|
|
184
194
|
get writable() {
|
|
185
195
|
return this.writers ? this.writers.writable : false
|
|
186
196
|
}
|
|
@@ -202,7 +212,8 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
202
212
|
await 1
|
|
203
213
|
const result = await this._prebooting
|
|
204
214
|
return {
|
|
205
|
-
name: 'autobee/' + result.local.id + '/' + name,
|
|
215
|
+
name: 'autobee/' + result.local.id + '/view/' + name,
|
|
216
|
+
manifestVersion: DEFAULT_MANIFEST_VERSION,
|
|
206
217
|
encryption: name === 'system' ? this.getSystemEncryption() : this.getViewEncryption(),
|
|
207
218
|
inflightRange: [256, 512]
|
|
208
219
|
}
|
|
@@ -377,6 +388,7 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
377
388
|
|
|
378
389
|
async _close() {
|
|
379
390
|
this._interrupting = true
|
|
391
|
+
this._bumpSignal.notify()
|
|
380
392
|
|
|
381
393
|
// the local core holds the exclusive lock but the local writer closes it
|
|
382
394
|
// early in the teardown, so hand the lock to a detached session that
|
|
@@ -580,6 +592,11 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
580
592
|
this._localFlushes = this.system.flushes
|
|
581
593
|
}
|
|
582
594
|
|
|
595
|
+
async _isReindexing() {
|
|
596
|
+
if (this._networkBooted || !this._ffEnabled || this._migrating) return false
|
|
597
|
+
return !(await this._isReindexed())
|
|
598
|
+
}
|
|
599
|
+
|
|
583
600
|
async _bootOnline() {
|
|
584
601
|
if (!this._bootOnlineGuard.enter()) return
|
|
585
602
|
|
|
@@ -604,6 +621,7 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
604
621
|
}
|
|
605
622
|
|
|
606
623
|
bumpSoon() {
|
|
624
|
+
this._bumpSignal.notify()
|
|
607
625
|
this._bump(false).catch(safetyCatch)
|
|
608
626
|
}
|
|
609
627
|
|
|
@@ -665,6 +683,58 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
665
683
|
this.emit('error', err)
|
|
666
684
|
}
|
|
667
685
|
|
|
686
|
+
async compactMaybe() {
|
|
687
|
+
if (!this.writers.writable) return 0
|
|
688
|
+
|
|
689
|
+
if (await this._isReindexed()) return 0
|
|
690
|
+
|
|
691
|
+
const view = await this._reindexBee(this._workingBee)
|
|
692
|
+
if (view > 0) this.bee.move(this._workingBee.head())
|
|
693
|
+
|
|
694
|
+
const system = await this._reindexBee(this.system.bee)
|
|
695
|
+
|
|
696
|
+
if (view + system > 0) this._reindexed = true
|
|
697
|
+
|
|
698
|
+
return view + system
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
async _isReindexed() {
|
|
702
|
+
const head = this.system.bee.head()
|
|
703
|
+
if (head === null) return true
|
|
704
|
+
if (await this._shouldReindex(head.key)) return false
|
|
705
|
+
|
|
706
|
+
const view = this.system.view
|
|
707
|
+
if (!view || !view.key) return true
|
|
708
|
+
return !(await this._shouldReindex(view.key))
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
async _reindexBee(bee) {
|
|
712
|
+
const head = bee.head()
|
|
713
|
+
const local = bee.context.local
|
|
714
|
+
if (head === null) return 0
|
|
715
|
+
if ((await this._shouldReindex(local.key)) && local.length > 0) return 0
|
|
716
|
+
if (!(await this._shouldReindex(head.key))) return 0
|
|
717
|
+
|
|
718
|
+
return bee.reindex(async (change) => !(await this._shouldReindex(change.head.key)))
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
async _shouldReindex(key, { unknown = false, length = 0, timeout = 0 } = {}) {
|
|
722
|
+
const core = this.store.get({ key, active: false })
|
|
723
|
+
|
|
724
|
+
try {
|
|
725
|
+
await core.ready()
|
|
726
|
+
|
|
727
|
+
if (core.manifest === null && length > 0) {
|
|
728
|
+
await core.get(length - 1, { raw: true, timeout }).catch(safetyCatch)
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
if (core.manifest === null) return unknown
|
|
732
|
+
return core.manifest.version > 1 && core.manifest.version < DEFAULT_MANIFEST_VERSION
|
|
733
|
+
} finally {
|
|
734
|
+
await core.close()
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
668
738
|
// one-shot user gate: nothing applies until the host has resolved whatever
|
|
669
739
|
// state apply depends on (e.g. legacy views recorded by a migration)
|
|
670
740
|
async _runPreApply() {
|
|
@@ -685,6 +755,7 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
685
755
|
const { head = null, legacy = null } = this.bootFrom
|
|
686
756
|
|
|
687
757
|
this.bootFrom = null
|
|
758
|
+
this._networkBooted = true
|
|
688
759
|
|
|
689
760
|
if (legacy) {
|
|
690
761
|
await this._bootFromSystem(legacy)
|
|
@@ -692,8 +763,14 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
692
763
|
this._wakeup.hint({ key: head.key, length: head.length || 0 })
|
|
693
764
|
await this._bootFromHead(head)
|
|
694
765
|
}
|
|
766
|
+
} else if (await this._isReindexing()) {
|
|
767
|
+
this._networkBooted = true
|
|
768
|
+
await this._bootFromNetwork()
|
|
695
769
|
}
|
|
696
770
|
|
|
771
|
+
// preferably get a peer's compacted view during bootFrom
|
|
772
|
+
if (this.fastForwardTo === null) await this.compactMaybe()
|
|
773
|
+
|
|
697
774
|
const changes = this._hasUpdate ? new UpdateChanges(this) : null
|
|
698
775
|
if (changes) changes.track()
|
|
699
776
|
|
|
@@ -862,6 +939,7 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
862
939
|
const heads = await this._readCandidateHeads(hints, FastForward.DEFAULT_TIMEOUT)
|
|
863
940
|
|
|
864
941
|
const ff = await FastForward.fromHeads(this, heads, {
|
|
942
|
+
skipGap: this._networkBooting,
|
|
865
943
|
timeout: FastForward.DEFAULT_TIMEOUT
|
|
866
944
|
})
|
|
867
945
|
|
|
@@ -1205,17 +1283,21 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1205
1283
|
}
|
|
1206
1284
|
|
|
1207
1285
|
async _appendAck() {
|
|
1208
|
-
if (!this._acking) return false
|
|
1286
|
+
if (!this._acking && !this._reindexed) return false
|
|
1209
1287
|
if (!this.writers.writable) return false
|
|
1210
1288
|
|
|
1211
1289
|
if (this.writers.localWriter.pending !== null) return false
|
|
1212
|
-
|
|
1213
|
-
if (
|
|
1290
|
+
|
|
1291
|
+
if (!this._reindexed) {
|
|
1292
|
+
if ((await this._flushesBehind()) < this._ackThreshold) return false
|
|
1293
|
+
if (await this._allHeadsTrusted()) return false
|
|
1294
|
+
}
|
|
1214
1295
|
|
|
1215
1296
|
const links = this.system.getLinks(this.local.key)
|
|
1216
|
-
const
|
|
1297
|
+
const now = this._now()
|
|
1298
|
+
const t = Math.max(now, this.system.timestamp)
|
|
1217
1299
|
|
|
1218
|
-
this.writers.appendLocal(null, t, { start: 0, end: 0 }, links, false, null)
|
|
1300
|
+
this.writers.appendLocal(null, t, { start: 0, end: 0 }, links, false, null, null, null, t - now)
|
|
1219
1301
|
return true
|
|
1220
1302
|
}
|
|
1221
1303
|
|
|
@@ -1367,6 +1449,14 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1367
1449
|
|
|
1368
1450
|
const changed = await this.system.flush(batch, this._workingBee)
|
|
1369
1451
|
|
|
1452
|
+
if (this._reindexed && (await this._isReindexed())) {
|
|
1453
|
+
this._reindexed = false
|
|
1454
|
+
await this.local.setUserData(
|
|
1455
|
+
'autobee/head',
|
|
1456
|
+
encoding.encodeBootRecord(this.system.bootRecord())
|
|
1457
|
+
)
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1370
1460
|
if (this.system.promotions.changed) this._prefetchApprovals().catch(safetyCatch)
|
|
1371
1461
|
|
|
1372
1462
|
if (local) {
|
|
@@ -1441,8 +1531,10 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1441
1531
|
const links = this.system.getLinks(this.local.key)
|
|
1442
1532
|
const hash = this.system.hash
|
|
1443
1533
|
|
|
1444
|
-
// never stamp before anything we link
|
|
1445
|
-
const
|
|
1534
|
+
// never stamp before anything we link, but record how far our clock lagged
|
|
1535
|
+
const now = this._now()
|
|
1536
|
+
const t = Math.max(now, this.system.timestamp)
|
|
1537
|
+
const drift = t - now
|
|
1446
1538
|
const batch = []
|
|
1447
1539
|
|
|
1448
1540
|
const rec = await this.system.get(this.local.key)
|
|
@@ -1468,7 +1560,8 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1468
1560
|
optimistic,
|
|
1469
1561
|
i === 0 ? witness : null,
|
|
1470
1562
|
i === 0 ? approvals : null,
|
|
1471
|
-
i === 0 ? hash : null
|
|
1563
|
+
i === 0 ? hash : null,
|
|
1564
|
+
drift
|
|
1472
1565
|
)
|
|
1473
1566
|
batch.push(node)
|
|
1474
1567
|
}
|
|
@@ -1544,6 +1637,41 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1544
1637
|
}
|
|
1545
1638
|
}
|
|
1546
1639
|
|
|
1640
|
+
async _bootFromNetwork() {
|
|
1641
|
+
this._networkBooting = true
|
|
1642
|
+
|
|
1643
|
+
try {
|
|
1644
|
+
await this._waitForNetworkBoot()
|
|
1645
|
+
} finally {
|
|
1646
|
+
this._networkBooting = false
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
async _waitForNetworkBoot() {
|
|
1651
|
+
const deadline = Date.now() + BOOT_NETWORK_TIMEOUT
|
|
1652
|
+
|
|
1653
|
+
this._requestWakeup()
|
|
1654
|
+
|
|
1655
|
+
while (!this._interrupting && !this.closing && this.fastForwardTo === null) {
|
|
1656
|
+
const hints = await this._applyWakeupHints()
|
|
1657
|
+
if (hints.length) this._queueFastForward(hints)
|
|
1658
|
+
|
|
1659
|
+
const remaining = deadline - Date.now()
|
|
1660
|
+
if (remaining <= 0 || this.fastForwardTo !== null) return
|
|
1661
|
+
|
|
1662
|
+
if (this._ffSearching !== null) {
|
|
1663
|
+
await Promise.race([this._ffSearching, this._bumpSignal.wait(remaining)])
|
|
1664
|
+
this._bumpSignal.notify()
|
|
1665
|
+
if (this._ffSearching === null) return
|
|
1666
|
+
continue
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
if (hints.length) return
|
|
1670
|
+
|
|
1671
|
+
await this._bumpSignal.wait(remaining)
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1547
1675
|
async _runFastForward(ff, { force = false } = {}) {
|
|
1548
1676
|
if (this.fastForwardTo !== null || this.fastForwarding !== null) {
|
|
1549
1677
|
await ff.close()
|
|
@@ -1560,7 +1688,8 @@ module.exports = class Autobee extends ReadyResource {
|
|
|
1560
1688
|
|
|
1561
1689
|
if (!result) return false
|
|
1562
1690
|
|
|
1563
|
-
|
|
1691
|
+
// apply ran while we searched, only drop it if it no longer moves us forward
|
|
1692
|
+
if (!force && flushes <= this.system.flushes) return false
|
|
1564
1693
|
|
|
1565
1694
|
this.fastForwardTo = result
|
|
1566
1695
|
this.ff = rrp()
|
package/lib/boot.js
CHANGED
|
@@ -93,16 +93,16 @@ module.exports = async function boot(
|
|
|
93
93
|
await result.bootstrap.setUserData('referrer', result.key)
|
|
94
94
|
await result.bootstrap.setUserData('autobee/local', result.local.key)
|
|
95
95
|
await result.local.setUserData('referrer', result.key)
|
|
96
|
+
}
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
result.migration = await migrateWithFallback(corestore, result.local, result.bootstrap)
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
100
|
+
if (result.migration) {
|
|
101
|
+
await result.local.setUserData(
|
|
102
|
+
'autobee/head',
|
|
103
|
+
encoding.encodeBootRecord(result.migration.system)
|
|
104
|
+
)
|
|
105
|
+
await result.local.setUserData('autobee/encryption', result.migration.encryptionKey)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const [systemHead, encryptionKeyBuffer, prevDrainBuffer] = await Promise.all([
|
package/lib/constants.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const LEGACY_OPLOG_VERSION = 2
|
|
2
2
|
const OPLOG_VERSION = 4
|
|
3
|
+
const DEFAULT_MANIFEST_VERSION = 3
|
|
3
4
|
const LEGACY_AUTOBASE_VERSION = 2
|
|
4
5
|
const AUTOBEE_VERSION = 3
|
|
5
6
|
const DEFAULT_OP_TIMEOUT = 5000
|
|
6
7
|
|
|
7
8
|
module.exports = {
|
|
9
|
+
DEFAULT_MANIFEST_VERSION,
|
|
8
10
|
LEGACY_OPLOG_VERSION,
|
|
9
11
|
OPLOG_VERSION,
|
|
10
12
|
LEGACY_AUTOBASE_VERSION,
|
package/lib/encoding.js
CHANGED
package/lib/fast-forward.js
CHANGED
|
@@ -7,7 +7,7 @@ const migrations = require('./migrations.js')
|
|
|
7
7
|
const { LEGACY_AUTOBASE_VERSION, LEGACY_OPLOG_VERSION } = require('./constants.js')
|
|
8
8
|
|
|
9
9
|
const DEFAULT_OP_TIMEOUT = 5_000
|
|
10
|
-
const MIN_FF_GAP =
|
|
10
|
+
const MIN_FF_GAP = 16
|
|
11
11
|
|
|
12
12
|
class FastForward {
|
|
13
13
|
constructor(auto, head, { timeout = DEFAULT_OP_TIMEOUT, conservative = false } = {}) {
|
|
@@ -38,9 +38,8 @@ class FastForward {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
static DEFAULT_TIMEOUT = DEFAULT_OP_TIMEOUT
|
|
41
|
-
static MIN_GAP = MIN_FF_GAP
|
|
42
41
|
|
|
43
|
-
static async fromHead(auto, head, trusted, { force = false, timeout = 0 } = {}) {
|
|
42
|
+
static async fromHead(auto, head, trusted, { force = false, skipGap = false, timeout = 0 } = {}) {
|
|
44
43
|
const conservative = !force && auto._conservativeFF
|
|
45
44
|
|
|
46
45
|
const oplog = await FastForward.flushHead(auto, head, { timeout })
|
|
@@ -52,7 +51,7 @@ class FastForward {
|
|
|
52
51
|
// legacy nodes from non-indexers have no system info to fast-forward from
|
|
53
52
|
if (!oplog.op.views || !verified.op.views) return null
|
|
54
53
|
|
|
55
|
-
if (!force && verified.op.views.flushes - auto.system.flushes < MIN_FF_GAP) {
|
|
54
|
+
if (!force && !skipGap && verified.op.views.flushes - auto.system.flushes < MIN_FF_GAP) {
|
|
56
55
|
return null
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -62,7 +61,7 @@ class FastForward {
|
|
|
62
61
|
})
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
static async fromHeads(auto, heads, { force = false, timeout = 0 } = {}) {
|
|
64
|
+
static async fromHeads(auto, heads, { force = false, skipGap = false, timeout = 0 } = {}) {
|
|
66
65
|
const reference = auto._workingView.view
|
|
67
66
|
|
|
68
67
|
const promises = []
|
|
@@ -72,14 +71,12 @@ class FastForward {
|
|
|
72
71
|
promises.push(FastForward.flushHead(auto, head, { timeout }))
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
const ops = await Promise.all(promises)
|
|
74
|
+
const ops = await FastForward.reindexedCandidates(auto, await Promise.all(promises), {
|
|
75
|
+
timeout: timeout || DEFAULT_OP_TIMEOUT
|
|
76
|
+
})
|
|
76
77
|
if (auto.fastForwarding || auto.fastForwardTo) return null
|
|
77
78
|
|
|
78
|
-
const trust = await Promise.all(
|
|
79
|
-
ops.map((res) => {
|
|
80
|
-
return res === null ? false : auto.trusted.isTrusted(res.key, reference)
|
|
81
|
-
})
|
|
82
|
-
)
|
|
79
|
+
const trust = await Promise.all(ops.map((res) => auto.trusted.isTrusted(res.key, reference)))
|
|
83
80
|
if (auto.fastForwarding || auto.fastForwardTo) return null
|
|
84
81
|
|
|
85
82
|
const candidates = []
|
|
@@ -89,8 +86,7 @@ class FastForward {
|
|
|
89
86
|
|
|
90
87
|
for (let i = 0; i < ops.length; i++) {
|
|
91
88
|
const res = ops[i]
|
|
92
|
-
if (
|
|
93
|
-
if (!force && res.op.views.flushes - auto.system.flushes < MIN_FF_GAP) continue
|
|
89
|
+
if (!force && !skipGap && res.op.views.flushes - auto.system.flushes < MIN_FF_GAP) continue
|
|
94
90
|
|
|
95
91
|
if (!trust[i]) {
|
|
96
92
|
candidates.push(res)
|
|
@@ -104,7 +100,7 @@ class FastForward {
|
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
if (bestTrusted !== null) {
|
|
107
|
-
return FastForward.fromHead(auto, bestTrusted, null, { force, timeout })
|
|
103
|
+
return FastForward.fromHead(auto, bestTrusted, null, { force, skipGap, timeout })
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
candidates.sort((a, b) => b.op.views.flushes - a.op.views.flushes)
|
|
@@ -114,13 +110,38 @@ class FastForward {
|
|
|
114
110
|
if (trusted === null) continue
|
|
115
111
|
if (auto.fastForwarding || auto.fastForwardTo) return null
|
|
116
112
|
|
|
117
|
-
const ff = await FastForward.fromHead(auto, res, trusted, { force, timeout })
|
|
113
|
+
const ff = await FastForward.fromHead(auto, res, trusted, { force, skipGap, timeout })
|
|
118
114
|
if (ff !== null) return ff
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
return null
|
|
122
118
|
}
|
|
123
119
|
|
|
120
|
+
static async reindexedCandidates(auto, ops, { timeout }) {
|
|
121
|
+
const withViews = ops.filter((res) => res !== null && res.op.views)
|
|
122
|
+
const reindexed = await Promise.all(
|
|
123
|
+
withViews.map((res) => FastForward.isReindexed(auto, res, timeout))
|
|
124
|
+
)
|
|
125
|
+
return withViews.filter((res, i) => reindexed[i])
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
static async isReindexed(auto, res, timeout) {
|
|
129
|
+
const { system, view } = res.op.views
|
|
130
|
+
const checks = [system, view]
|
|
131
|
+
.filter((v) => !!v)
|
|
132
|
+
.map((range) => {
|
|
133
|
+
const { key, length } = batchToHead(range)
|
|
134
|
+
if (length === 0) return false
|
|
135
|
+
return auto._shouldReindex(key, { unknown: true, length, timeout })
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
for (const shouldReindex of await Promise.all(checks)) {
|
|
139
|
+
if (shouldReindex) return false
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return true
|
|
143
|
+
}
|
|
144
|
+
|
|
124
145
|
static async flushHead(auto, head, opts) {
|
|
125
146
|
const core = auto.openCore(head.key)
|
|
126
147
|
|
package/lib/migrations.js
CHANGED
|
@@ -173,14 +173,18 @@ function decodeLegacySystemInfo(buffer) {
|
|
|
173
173
|
const state = { start: 0, end: buffer.length, buffer }
|
|
174
174
|
const version = c.uint.decode(state)
|
|
175
175
|
|
|
176
|
-
state.start--
|
|
177
|
-
|
|
178
176
|
switch (version) {
|
|
179
177
|
case 0:
|
|
180
|
-
case 1:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return
|
|
178
|
+
case 1: {
|
|
179
|
+
const decoded = SystemInfoV1.decode(state)
|
|
180
|
+
decoded.version = version
|
|
181
|
+
return decoded
|
|
182
|
+
}
|
|
183
|
+
case 2: {
|
|
184
|
+
const decoded = SystemInfoV2.decode(state)
|
|
185
|
+
decoded.version = version
|
|
186
|
+
return decoded
|
|
187
|
+
}
|
|
184
188
|
default:
|
|
185
189
|
bail('Expected legacy system info')
|
|
186
190
|
}
|
package/lib/writers.js
CHANGED
|
@@ -92,7 +92,7 @@ class ActiveWriters {
|
|
|
92
92
|
return this.localWriter.getLatest()
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
appendLocal(value, timestamp, batch, links, optimistic, witness, approvals
|
|
95
|
+
appendLocal(value, timestamp, batch, links, optimistic, witness, approvals, hash, drift) {
|
|
96
96
|
return this.localWriter.append(
|
|
97
97
|
value,
|
|
98
98
|
timestamp,
|
|
@@ -101,7 +101,8 @@ class ActiveWriters {
|
|
|
101
101
|
optimistic,
|
|
102
102
|
witness,
|
|
103
103
|
approvals,
|
|
104
|
-
hash
|
|
104
|
+
hash,
|
|
105
|
+
drift
|
|
105
106
|
)
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -725,7 +726,7 @@ class Writer {
|
|
|
725
726
|
return this.pending !== null
|
|
726
727
|
}
|
|
727
728
|
|
|
728
|
-
append(value, timestamp, batch, links, optimistic, witness, approvals
|
|
729
|
+
append(value, timestamp, batch, links, optimistic, witness, approvals, hash, drift) {
|
|
729
730
|
if (this.pending === null) this.pending = []
|
|
730
731
|
|
|
731
732
|
const oplog = {
|
|
@@ -739,7 +740,9 @@ class Writer {
|
|
|
739
740
|
approvals,
|
|
740
741
|
optimistic: optimistic && !this.writers.writable,
|
|
741
742
|
value,
|
|
742
|
-
hash
|
|
743
|
+
hash,
|
|
744
|
+
weightHint: 0,
|
|
745
|
+
drift
|
|
743
746
|
}
|
|
744
747
|
|
|
745
748
|
const node = createNode(this.core, this.appendLength++, -1, oplog)
|
|
@@ -773,7 +776,9 @@ class Writer {
|
|
|
773
776
|
|
|
774
777
|
const buffers = []
|
|
775
778
|
for (let i = 0; i < this.processed; i++) {
|
|
776
|
-
|
|
779
|
+
const node = this.pending[i]
|
|
780
|
+
node.weightHint = node.weight > 0 ? node.weight : 0
|
|
781
|
+
buffers.push(encoding.encodeOplog(node))
|
|
777
782
|
}
|
|
778
783
|
|
|
779
784
|
try {
|
|
@@ -817,7 +822,9 @@ function createNode(core, length, weight, oplog) {
|
|
|
817
822
|
approvals: oplog.approvals || null,
|
|
818
823
|
optimistic: oplog.optimistic,
|
|
819
824
|
value: oplog.value,
|
|
820
|
-
hash: oplog.hash || null
|
|
825
|
+
hash: oplog.hash || null,
|
|
826
|
+
weightHint: oplog.weightHint || 0,
|
|
827
|
+
drift: oplog.drift || 0
|
|
821
828
|
}
|
|
822
829
|
}
|
|
823
830
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autobee",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Bee based autobase",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Holepunch Inc.",
|
|
@@ -27,15 +27,16 @@
|
|
|
27
27
|
"autobee-wakeup": "^1.1.3",
|
|
28
28
|
"b4a": "^1.8.0",
|
|
29
29
|
"compact-encoding": "^3.3.0",
|
|
30
|
-
"hyperbee2": "^2.
|
|
31
|
-
"hypercore": "^11.
|
|
30
|
+
"hyperbee2": "^2.17.0",
|
|
31
|
+
"hypercore": "^11.37.0",
|
|
32
32
|
"hypercore-id-encoding": "^1.3.0",
|
|
33
|
-
"hyperschema": "^1.
|
|
33
|
+
"hyperschema": "^1.26.2",
|
|
34
34
|
"read-write-mutexify": "^2.1.0",
|
|
35
35
|
"ready-guard": "^1.0.0",
|
|
36
36
|
"ready-resource": "^1.2.0",
|
|
37
37
|
"resolve-reject-promise": "^1.1.0",
|
|
38
38
|
"safety-catch": "^1.0.3",
|
|
39
|
+
"signal-promise": "^1.0.3",
|
|
39
40
|
"sodium-native": "^5.1.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|