History for InjectableBrains
??changed:
-
SWARM objects are state-machines that need PlansAndPhases to drive them. They must be able to completely transform their state based on their current process phase. To achieve this, we use the idea of "injectable
brains." There are three main participants in the brain injection process:
- BrainRecipients
- BrainDonors
- BrainExchange
BrainRecipients know their BrainExchange, which knows the available BrainDonors. When retrieved from a Rack, BrainRecipients ask their BrainExchange for a brain based on their current state. The exchange may have the appropriate brain cached, or it may have to go to the BrainDonors to assemble a fresh brain.
The assembled brain is injected into an attribute ('_v_brains', perhaps?) and then is used by a custom getattr hook on the brain recipient. The brains are a mapping object (possibly a MultiMapping) which are used to provide attributes for the otherwise empty-headed object.