hypercore 10.5.1 → 10.5.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/lib/bitfield.js CHANGED
@@ -16,6 +16,7 @@ class BitfieldPage {
16
16
  constructor (index, segment) {
17
17
  this.dirty = false
18
18
  this.index = index
19
+ this.offset = index * BYTES_PER_PAGE - segment.offset
19
20
  this.bitfield = null
20
21
  this.segment = segment
21
22
 
package/lib/core.js CHANGED
@@ -241,31 +241,31 @@ module.exports = class Core {
241
241
  async clear (start, end) {
242
242
  await this._mutex.lock()
243
243
 
244
- const entry = {
245
- userData: null,
246
- treeNodes: null,
247
- treeUpgrade: null,
248
- bitfield: {
249
- start,
250
- length: end - start,
251
- drop: true
244
+ try {
245
+ const entry = {
246
+ userData: null,
247
+ treeNodes: null,
248
+ treeUpgrade: null,
249
+ bitfield: {
250
+ start,
251
+ length: end - start,
252
+ drop: true
253
+ }
252
254
  }
253
- }
254
255
 
255
- await this.oplog.append([entry], false)
256
+ await this.oplog.append([entry], false)
256
257
 
257
- this.bitfield.setRange(start, end - start, false)
258
+ this.bitfield.setRange(start, end - start, false)
258
259
 
259
- if (start < this.header.contiguousLength) {
260
- this.header.contiguousLength = start
261
- }
260
+ if (start < this.header.contiguousLength) {
261
+ this.header.contiguousLength = start
262
+ }
262
263
 
263
- start = this.bitfield.lastSet(start) + 1
264
- end = this.bitfield.firstSet(end)
264
+ start = this.bitfield.lastSet(start) + 1
265
+ end = this.bitfield.firstSet(end)
265
266
 
266
- if (end === -1) end = this.tree.length
267
+ if (end === -1) end = this.tree.length
267
268
 
268
- try {
269
269
  const offset = await this.tree.byteOffset(start * 2)
270
270
  const [byteEnd, byteEndLength] = await this.tree.byteRange((end - 1) * 2)
271
271
  const length = (byteEnd + byteEndLength) - offset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypercore",
3
- "version": "10.5.1",
3
+ "version": "10.5.3",
4
4
  "description": "Hypercore is a secure, distributed append-only log",
5
5
  "main": "index.js",
6
6
  "scripts": {