Skip to content

Reimplement purge on top of rocksdb storage - #881

Merged
chm-diederichs merged 4 commits into
mainfrom
fix/purge
Oct 14, 2026
Merged

chm-diederichs merged 4 commits into
mainfrom
fix/purge

Conversation

@Drache93

@Drache93 Drache93 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

purge() broke in the move to rocksdb storage (#527): it calls _closeAllSessions and core.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's deleteCore. For a core that closes its own storage (autoClose), the storage stays open until the delete is done.
  • Purge tests rewritten for rocksdb storage and re-enabled.

Note: hypercore-storage's deleteCore currently 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.

🤖

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
chm-diederichs merged commit d6e31c1 into main Oct 14, 2026
5 checks passed
@chm-diederichs
chm-diederichs deleted the fix/purge branch October 14, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants