-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rocksdb: commit overwrites full state #587
Conversation
31cdf36
to
d418634
Compare
depends on holepunchto/hypercore-storage#26 |
lib/bit-interlude.js
Outdated
let remove = 1 | ||
|
||
if (lower.start < lower.end) this.ranges.splice(i++, remove--, lower) | ||
this.ranges.splice(i++, remove, { start, end, value }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ++ is sus to me, we use i again below but normally you'd i-- it as you are removing from the array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one of them removes from the array, but they all add to it, so it ends up being:
arr = [0]
arr.splice(i++, 1, 1)
arr.splice(i++, 0, 2)
arr.splice(i, 0, 3)
// arr === [1, 2, 3]
lib/bit-interlude.js
Outdated
const last = (page.index + 1) * (buf.byteLength << 3) | ||
const offset = page.index * buf.byteLength << 3 | ||
const last = (pageIndex + 1) * (buf.byteLength << 3) | ||
const offset = pageIndex * buf.byteLength << 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add parens around the buf.. << 3 part
lib/core.js
Outdated
const promises = [] | ||
if (this.verifier === null) { | ||
throw INVALID_OPERATION('Cannot commit without manifest') // easier to assert than upsert | ||
} else if (this.tree.length < length && !signature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove else, just two ifs
No description provided.