asyncFlow: add meta operation to query the state of replay from within the flow #10103
Labels
asyncFlow
related to membrane-based replay and upgrade of async functions
enhancement
New feature or request
What is the Problem Being Solved?
An upgrade may need to change the logic of a flow for existing but not yet completed invocations. For that, the guest function needs some way to detect where it has to follow replay, and where it can branch off. This requires "meta operations" about the flow (split from #9304)
Description of the Design
In #9384 we describe the need to record which incarnation of the flow the log entry corresponds. This issue describes a way expose this information to the guest function.
Async flow currently reserves the
this
context of the function for its own use (forced toundefined
value). The idea is to provide meta operations regarding the flow available onthis
. We possibly wantthis
to be a guest object part of the membrane (in case some interactions should be recorded for replay), but since asking about where in the replay we are is fundamentally a non replayable interaction, we also need a mechanism to escape the membrane when needed. One possibility would be to have a power created along the flow definition that allows "unwrapping" the flow meta operations guest object, in order to have the ability to interact directly with the host side outside the membrane. This guest object might be a wrapper created by the endowments mechanism (#9304) which combines interactions with both the membrane and the powers outside the membrane.Security Considerations
Avoid exposing too much power to guest functions
Maintain replayability of guest flows where expected
Scaling Considerations
After the flow is complete, no internal references left to the flow
Test Plan
Test of guest logic conditional on upgrade
Upgrade Considerations
See above
The text was updated successfully, but these errors were encountered: