holepunchto / holepunchto/hyperbee2
Undo behavoiur
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 12
- Forks
- 5
- Avg merge
- 3h 23m
- Merged PRs (30d)
- 27
Description
Calling .undo() does not update the head in the Hypercore, it returns a new Hyperbee that points to an old batch. However, it is writable. And writing on top of the new Hyperbee instance will append a batch to the Hypercore. This all makes sense at an implementation level but can lead to some potentially confusing behaviour for consumers of this library.
If, as I expect is normally the case, a user of this library simply opens a corestore path to use as a Hyperbee, then calling .undo() does not persist any rollback. However, calling undo() followed by flushing a WriteBatch will persist the rollback.
This either needs clearly documenting, or the undo (as exposed in the public API) should write a new batch without extra operations to persist the change so it is still applied next time the corestore path is opened.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the public .undo() API, the returned Hyperbee instance, and how a WriteBatch is flushed against the Hypercore and corestore path. Resolve whether undo should persist immediately or be documented as requiring a subsequent batch flush; done means the chosen behavior is explicit and remains consistent after reopening the corestore path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100