-
Notifications
You must be signed in to change notification settings - Fork 30
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
Improve batch docs #126
Improve batch docs #126
Conversation
README.md
Outdated
@@ -168,6 +168,14 @@ Make a new atomic batch that is either fully processed or not processed at all. | |||
|
|||
If you have several inserts and deletions then a batch can be much faster. | |||
|
|||
Batch is snapshotted at creation. Outside writes are not taken into account when reading. |
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.
Not highly true:
const batch = await db.batch()
t.is(batch.version, 1)
await db.put('/a')
t.is(batch.version, 2)
console.log(await batch.get('/a')) // => { seq, key, value }
So state is not snapshotted?
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.
A put (obvs) updates the snap.
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.
It's a db.put
external write outside of batch, is that intended to update the snap of the batch?
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.
Ah db my bad. I'd prefer to leave this be for now. Its due to update being called. This needs some (breaking) refactor to remove all update calls
Thanks @HDegroote the initial explanation: 08a3fca
I didn't even know that we had a lock method lol