feat: Implement persistent storage for vats. #436
Merged
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.
This PR implements a persistent storage mechanism for vats, per the design described in issue #431.
The kernel storage has been augmented with a new table that holds data for vats. This involved some fairly extensive refactoring of the kernel storage API, but I think clears up a few things that were previously a bit confused and so I think it's a net improvement in its own right.
The
initVatcommand from theKernelto theVatSupervisornow carries an initialization parameter that theVatSupervisorwill use to initialize its in-memory cache of the vat's persistent state as it existed prior to the vat process being created (of course, for a new vat this will be empty).The responses to the
initVatanddelivervat commands returned to theKernelfrom theVatSupervisornow carry deltas to any persistent data changes that were made during the execution of the crank. The kernel will record any such changes in the relevant vat's vatstore in the database.Important Note: this feature gives us all the machinery necessary to restart a vat and resume its operation after the extension has been reloaded (either due to an explicit extension reload or due to browser restart). However, the kernel startup logic does not yet make use if this, so if you reload the extension you'll just get new vats rather than getting the old vats back again. This is another task that needs to be done, see #437.
Closes #431.