-
Notifications
You must be signed in to change notification settings - Fork 215
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
how can we virtualize Notifiers/Subscriptions? #4513
Comments
As @dtribble pointed out, It may help to break the old Notifier and obligate customers to obtain a new one (i.e. include the Notifier in the "visible upgrade trauma"). We could establish a rule that when your function followPurse(purse) {
let currentNotifierP;
function startOrRestart() {
currentNotifierP = E(purse).getBalanceNotifier();
currentNotifierP.getUpdateSince().then(gotUpdate, gotError);
}
function gotUpdate(({value, updateCount})) {
console.log(`balance: ${value}`);
E(currentNotifierP).getUpdateSince(updateCount).then(gotUpdate, gotError);
}
function gotError() {
startOrRestart();
}
startOrRestart();
} Our current plan calls for all outstanding Promises (i.e. all kernel promise table entries whose The part I don't yet have a plan for is how the durable Purse could hold on to a merely-Virtual Notifier in one version, lose that reference during upgrade (mixing virtual+durable in the state instead of rejecting merely-virtual at If the notifier were a DurableNotifier, which uses virtual promises (#3787) of some sort, that might help. |
One idea @FUDCo and I had today:
This doesn't require any sort of serialization-visible "frangible" linkage from durable to merely-virtual, since the link is hidden in the closed-over collection. Downsides:
|
May be solved by #3787 |
What is the Problem Being Solved?
To get Zoe and all contracts to use virtual objects (#4504, #4511, #4383), we also need a solution for Notifiers and Subscriptions. These are objects with which a publisher can push out updates to some piece of state. Their clients use promises to learn about the updates. When the client wants to be updated (maybe for the first time, maybe triggered by the previous update), they send a message and camp out on the result promise. The Notifier holds on to the resolver function, and invokes it when a new update is published.
Promises do not play nice with virtualized data. It would be awfully convenient for our implementation if we could forbid promises from both virtual and durable objects/collections (#2485)
If we can't put promises in virtual data, then I don't know how we virtualize a Notifier. When the notifier is inactive (pushed out to disk), then when an update is published, the notifier will be deserialized and
makeKind
invoked to build a new Representative. This Representative wants to pull the resolver function out of its.state
, but those can't be serialized. So either we have to keep the resolver function in RAM for all Notifiers (even inactive ones, breaking the virtual-object goal of "consume no RAM for inactive objects"), or we abandon the ability to resolve after being pushed to disk, which breaks Notifiers entirely.#3787 is a sketch for "virtual promises" that might be useful. It would be a special kind of serializable object that wraps a promise ID (a
vpid
), and has a method named.resolve
. It'd probably be created in conjunction with a real Promise, which could be serialized in the usual way.Description of the Design
none yet
Security Considerations
Test Plan
The text was updated successfully, but these errors were encountered: