hypercore-storage 1.12.1 → 1.14.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/index.js +2 -1
- package/package.json +1 -1
- package/spec/hyperschema/index.js +7 -3
package/index.js
CHANGED
|
@@ -356,6 +356,7 @@ class CorestoreStorage {
|
|
|
356
356
|
this.bootstrap = storage !== null
|
|
357
357
|
this.path = storage !== null ? storage : path.join(db.path, '..')
|
|
358
358
|
this.readOnly = !!opts.readOnly
|
|
359
|
+
this.allowBackup = !!opts.allowBackup
|
|
359
360
|
|
|
360
361
|
// tmp sync fix for simplicty since not super deployed yet
|
|
361
362
|
if (this.bootstrap && !this.readOnly) tmpFixStorage(this.path)
|
|
@@ -462,7 +463,7 @@ class CorestoreStorage {
|
|
|
462
463
|
|
|
463
464
|
await this.db.ready()
|
|
464
465
|
|
|
465
|
-
if (this.bootstrap && !this.readOnly) {
|
|
466
|
+
if (this.bootstrap && !this.readOnly && !this.allowBackup) {
|
|
466
467
|
const corestoreFile = path.join(this.path, 'CORESTORE')
|
|
467
468
|
|
|
468
469
|
if (!(await DeviceFile.resume(corestoreFile, { id: this.id }))) {
|
package/package.json
CHANGED
|
@@ -252,19 +252,21 @@ const encoding9_6 = c.array(c.fixed32)
|
|
|
252
252
|
const encoding9 = {
|
|
253
253
|
preencode (state, m) {
|
|
254
254
|
c.uint.preencode(state, m.version)
|
|
255
|
-
state.end++ // max flag is
|
|
255
|
+
state.end++ // max flag is 8 so always one byte
|
|
256
256
|
encoding4.preencode(state, m.hash)
|
|
257
257
|
c.uint.preencode(state, m.quorum)
|
|
258
258
|
encoding9_4.preencode(state, m.signers)
|
|
259
259
|
|
|
260
260
|
if (m.prologue) encoding8.preencode(state, m.prologue)
|
|
261
261
|
if (m.linked) encoding9_6.preencode(state, m.linked)
|
|
262
|
+
if (m.userData) c.buffer.preencode(state, m.userData)
|
|
262
263
|
},
|
|
263
264
|
encode (state, m) {
|
|
264
265
|
const flags =
|
|
265
266
|
(m.allowPatch ? 1 : 0) |
|
|
266
267
|
(m.prologue ? 2 : 0) |
|
|
267
|
-
(m.linked ? 4 : 0)
|
|
268
|
+
(m.linked ? 4 : 0) |
|
|
269
|
+
(m.userData ? 8 : 0)
|
|
268
270
|
|
|
269
271
|
c.uint.encode(state, m.version)
|
|
270
272
|
c.uint.encode(state, flags)
|
|
@@ -274,6 +276,7 @@ const encoding9 = {
|
|
|
274
276
|
|
|
275
277
|
if (m.prologue) encoding8.encode(state, m.prologue)
|
|
276
278
|
if (m.linked) encoding9_6.encode(state, m.linked)
|
|
279
|
+
if (m.userData) c.buffer.encode(state, m.userData)
|
|
277
280
|
},
|
|
278
281
|
decode (state) {
|
|
279
282
|
const r0 = c.uint.decode(state)
|
|
@@ -286,7 +289,8 @@ const encoding9 = {
|
|
|
286
289
|
allowPatch: (flags & 1) !== 0,
|
|
287
290
|
signers: encoding9_4.decode(state),
|
|
288
291
|
prologue: (flags & 2) !== 0 ? encoding8.decode(state) : null,
|
|
289
|
-
linked: (flags & 4) !== 0 ? encoding9_6.decode(state) : null
|
|
292
|
+
linked: (flags & 4) !== 0 ? encoding9_6.decode(state) : null,
|
|
293
|
+
userData: (flags & 8) !== 0 ? c.buffer.decode(state) : null
|
|
290
294
|
}
|
|
291
295
|
}
|
|
292
296
|
}
|