Skip to content

Commit

Permalink
rename flushedLength to signedLength (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs authored Dec 13, 2024
1 parent 8905a0e commit dea4c32
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ class Hypercore extends EventEmitter {
return this.opened === false ? 0 : this.state.tree.length
}

get flushedLength () {
get signedLength () {
if (this.opened === false) return 0
if (this.state === this.core.state) return this.core.tree.length
const flushed = this.state.flushedLength()
Expand Down
4 changes: 2 additions & 2 deletions test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ test('storage info, off by default', async function (t) {
test('indexedLength mirrors core length (linearised core compat)', async function (t) {
const core = await create(t)
t.is(core.length, 0)
t.is(core.flushedLength, core.length)
t.is(core.signedLength, core.length)

await core.append(['a', 'b'])
t.is(core.length, 2)
t.is(core.flushedLength, core.length)
t.is(core.signedLength, core.length)

await core.close()
})
Expand Down
8 changes: 4 additions & 4 deletions test/batch.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ test('flush with bg activity persists non conflicting values', async function (t
t.alike(await clone.get(2, { wait: false }), b4a.from('c'))

t.is(b.byteLength, clone.byteLength)
t.is(b.flushedLength, b.length, 'nothing buffered')
t.is(b.signedLength, b.length, 'nothing buffered')

await b.close()
})
Expand Down Expand Up @@ -610,7 +610,7 @@ test('encryption and bigger batches', async function (t) {

// t.is(batch.length, 6)
// t.is(batch.byteLength, 6)
// t.is(batch.flushedLength, 3)
// t.is(batch.signedLength, 3)
// t.alike(await batch.seek(4), [4, 0])

// const clone = await create(t, core.key)
Expand Down Expand Up @@ -703,7 +703,7 @@ test('persistent batch', async function (t) {

t.is(batch.length, 6)
t.is(batch.byteLength, 6)
// t.is(batch.flushedLength, 3)
// t.is(batch.signedLength, 3)
// t.alike(await batch.seek(4), [4, 0])

await core.close()
Expand All @@ -716,7 +716,7 @@ test('persistent batch', async function (t) {

t.is(reopened.length, 6)
t.is(reopened.byteLength, 6)
// t.is(batch.flushedLength, 3)
// t.is(batch.signedLength, 3)
// t.alike(await batch.seek(4), [4, 0])

await reopened.close()
Expand Down

0 comments on commit dea4c32

Please sign in to comment.