-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(daemon): Synchronize host evaluate method
Synchronizes the host's `evaluate()` method by delegating all incarnations to the daemon's `incarnateEval()`. Also synchronizes `incarnateLookup()`, and removes `provideLookupFormula()` from the mailbox, which was only a thin wrapper anyway. The path taken introduces new incarnation semantics and design constraints on the daemon and its dependents. #2089 introduced the notion of "incarnating" values. The `incarnateX() methods are responsible for creating formula JSON objects and calling `provideValueForNumberedFormula` to reify their values for the first time. Synchronizing dependencies between `incarnateX` methods is feasible by means of a lock, but difficulties arise when formulas are incarnated outside the daemon, such as in the host. Coordinating a lock between two different modules will increase the risks of datalocks at runtime. To avoid this, the implementation delegates all incarnations necessary for `evaluate()` to its dependent `incarnateEval()`. In essence, it is the consumer's responsibility to specify all necessary incarnations to the relevant incarnation method, which is then responsible for carrying them out. Yet, the story is complicated by pet names being mostly abstracted away from the daemon. For example, pet names must be associated with their respective formula identifiers the moment that those identifiers are observable to the consumer. As part of this process, the pet store must write the name to formula id mapping to disk. To handle sych asynchronous side effects, the implementation introduces a notion of "hooks" to `incarnateEval()`, with the intention of spreading this to other incarnation methods as necessary. These hooks receive as an argument all formula identifiers created by the incarnation, and are executed under the formula graph synchronization lock. This will surface IO errors to the consumer, and help us uphold the principle of "death before confusion".
- Loading branch information
Showing
4 changed files
with
124 additions
and
49 deletions.
There are no files selected for viewing
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
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
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
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