-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(swing-store): replace getAllState/etc with a debug facet
Previously, `getAllState` and `setAllState` were swing-store helper methods which copy (or set) all the state of a store at once, used exclusively for testing. These tests would either want to inspect the swing-store contents directly, or clone a swing-store for e.g. replay testing. This commit replaces both with a new `debug` facet (a sibling of `kernelStorage` and `hostStorage`), which offers two methods. `debug.dump()` returns a JS Object with the store data in an easy-to-examine format (`dump.kvEntries['key']=value`, `dump.streams[vatID]=[..]`, and `dump.snapshots[vatID] = {endPos, hash, compressedSnapshot }`. For cloning, `debug.serialize()` returns a Buffer that has a raw copy of the SQLite backing store. This can be used to make a new DB by passing it as an option to `initSwingStore`: ```js const serialized = swingstore1.debug.serialize(); const swingstore2 = initSwingStore(null, { serialized }); ``` Note that both `.serialize()` and `{ serialized }` require an in-RAM database, rather than an on-disk one. It also cleans up the streamstore types exports a bit.
- Loading branch information
Showing
16 changed files
with
265 additions
and
287 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.