This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Turn local JavaScript State into KVStore Protocol Messages Outside Realm #57
Closed
Conversation
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
Instead of a state entirely held in JS objects, move to get/set/has/delete on a kvstore held outside. May still need some "ephemeral" JS state for vat managers etc.
…stringified order
Transcript is loaded correctly (I think), but there seems to be a superficial difference in the dumps
warner
approved these changes
May 29, 2019
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.
looks good.. landing now (rebasing to current trunk first)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR turns the kernel state (including device state and vat state "owned" by the kernel, and not including vat objects in general) into messages that can be sent outside of the SwingSet.
Kernel state is currently all in local, non-persistent JavaScript objects. This PR creates a KVStore abstraction that allows access to the kernel state to be attenuated and passed to sub-portions of the code, such as Vat managers and devices. A KVStore has
get
,set
,has
,keys
,values
, and a few other methods, and provides a clear interface to accessing the state that should be able to withstand the actual implementation changing underneath.vatState
andkernelState
have been separated into the KVStore, which is passed in, and a Keeper, which is the only way to be able to access the KVStore. The keeper should not have any other access or state within it, and should be able to be wrapped around the KVstore at various points (especially attenuation points, e.g. getting a vat sub-kvstore and wrapping a vatKeeper around it) without it being a problem.Right now, the
gets
andsets
etc that happen within the inner Realm turn into stringified messages that are sent out, through controller.js. These stringified messages can eventually be sent elsewhere, but for now, the receiving end is JS state.Currently, we still use writing JSON to disk as our persistence, but we should be able to do significantly better and get rid of that entirely.
Tests
Because this is not a new feature, these changes need to be tested against the current tests -
npm test