Repository navigation
Reimplement purge on top of rocksdb storage - #881
Merged
Merged
Conversation
purge() was left behind by the move to rocksdb storage: it called _closeAllSessions and core.purge, neither of which exist anymore, so it always threw, and its test was disabled. Core.purge() now closes every session, closes the core and deletes it with the storage's deleteCore. Storage that the core would close on its own (autoClose) is kept open until the delete is done, then closed. The tests are rewritten for rocksdb storage and enabled again. Removing all of a core's data also needs hypercore-storage's deleteCore to clear the default session's data, which it currently leaves behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chm-diederichs
approved these changes
Oct 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
purge()broke in the move to rocksdb storage (#527): it calls_closeAllSessionsandcore.purge, which no longer exist, so it always throws. Its test was disabled.Core.purge()closes all sessions and the core, then calls the storage'sdeleteCore. For a core that closes its own storage (autoClose), the storage stays open until the delete is done.Note: hypercore-storage's
deleteCorecurrently leaves the default session's data behind (blocks, tree, bitfield, user data), so purged data stays on disk until that's fixed too. Fixed in holepunchto/hypercore-storage#133.🤖