-
Notifications
You must be signed in to change notification settings - Fork 221
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
fix(swing-store): move getAllState/setAllState onto a debug object #6722
Conversation
5a7a09b
to
6745af8
Compare
6745af8
to
9c39307
Compare
64695b3
to
d9b1fd4
Compare
`getAllState` and `setAllState` are swing-store helper functions which copy (or set) all the state of a store at once, used exclusively for testing. Previously, they were exported by swing-store, and applied to a `kernelStorage` object, but that depended upon a `streamStore.dumpStreams` method that we'd rather not expose to normal users. This commit adds a new `debug` object, next to `kernelStorage` and `hostStorage`, which holds `getAllState`, `setAllState`, and `dumpStreams`. The `kernelStorage.streamStore` object no longer has a `dumpStreams` method. This also updates all the swingset unit tests which were using the helper functions.
d9b1fd4
to
62fef7c
Compare
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.
This looks good, though merging with the swing-store changes already in flight might be a pain, which raises a question of whether snapStore-then-debug-hooks or debug-hooks-then-snapStore will be the lesser merge effort. I'm going to withhold approving until we answer that question, so that unexpected automation doesn't do something prematurely, but the changes here themselves seem just fine.
Related to all that, I'm wondering are we going to want or need something analogous to dumpStreams
for the snapStore?
I'll rewrite this on top of #6781 before proceeding. @FUDCo pointed out that what we really want is a programmatic form of |
Actually, for our purposes, we probably don't even need the dumped data to be a string. SQLite has a "serialize" API, which const buffer = db.serialize();
db.close();
db = new Database(buffer); which we might then have swingstore expose as That would be sufficient for the "clone a swingstore" requirements of the unit tests that use this. |
getAllState
andsetAllState
are swing-store helper functions which copy (or set) all the state of a store at once, used exclusively for testing.Previously, they were exported by swing-store, and applied to a
kernelStorage
object, but that depended upon astreamStore.dumpStreams
method that we'd rather not expose to normal users.This commit adds a new
debug
object, next tokernelStorage
andhostStorage
, which holdsgetAllState
,setAllState
, anddumpStreams
. ThekernelStorage.streamStore
object no longer has adumpStreams
method.This also updates all the swingset unit tests which were using the helper functions.