Skip to content

Commit

Permalink
Merge branch 'main' into header
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Jun 26, 2024
2 parents 34df154 + 77a74a5 commit c694621
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,9 @@ class ReadBatch {
return node
}

async getBitfieldPage (index, error) {
async getBitfieldPage (index) {
const key = encodeDataIndex(this.storage.dataPointer, DATA.BITFIELD, index)
const node = await this._get(key, null)

if (node === null && error === true) {
throw new Error('Page not found: ' + index)
}

return node
return this._get(key, null)
}

async _has (key) {
Expand Down Expand Up @@ -413,20 +407,20 @@ class HypercoreStorage {
return p
}

getBitfieldPage (index, error) {
getBitfieldPage (index) {
const b = this.createReadBatch()
const p = b.getBitfieldPage(index, error)
const p = b.getBitfieldPage(index)
b.tryFlush()
return p
}

async peakLastTreeNode (opts = {}) {
async peakLastTreeNode () {
const last = await this.db.peek(encodeIndexRange(this.dataPointer, DATA.TREE, { reverse: true }))
if (last === null) return null
return c.decode(m.TreeNode, last.value)
}

async peakLastBitfieldPage (opts = {}) {
async peakLastBitfieldPage () {
const last = await this.db.peek(encodeIndexRange(this.dataPointer, DATA.BITFIELD, { reverse: true }))
if (last === null) return null
return mapStreamBitfieldPage(last)
Expand Down

0 comments on commit c694621

Please sign in to comment.