Module

Perspectives.DependencyTracking.Dependency

#ApiEffectRunner

type ApiEffectRunner = Unit -> MP Unit

Execute an EffectRunner to re-create an effect. This should be done whenever one or more assumptions underlying the computation of the query that delivers the results to the ApiEffect, has changed.

#SupportedEffect

type SupportedEffect = { assumptions :: Array Assumption, runner :: ApiEffectRunner }

A SupportedEffect combines an EffectRunner and an array of Assumptions on which it relies. We use the Assumptions to unregister an entry from the AssumptionRegister, when the ApiEffect is retracted.

#ActiveSupportedEffects

type ActiveSupportedEffects = GLStrMap SupportedEffect

A SupportedEffect is in the ActiveSupportedEffects after it has been requested through the API and for as long as it is not retracted. As soon as an Assumption changes, the active SupportedEffects that rely on it, are re-executed. A SupportedEffect is stored under the CorrelationIdentifier that identifies the ApiEffect.

#activeSupportedEffects

activeSupportedEffects :: ActiveSupportedEffects

A global store of SupportedEffect-s This index cannot be part of the PerspectivesState. The compiler loops on it.

#registerSupportedEffect

registerSupportedEffect :: forall a b. CorrelationIdentifier -> ApiEffect -> (a ~~> b) -> a -> MP Unit

Register the ApiEffect and the TrackedObjectsGetter with the CorrelationIdentifier and run it once. Running means: compute the result of the TrackedObjectsGetter, add the computed Assumptions to the SupportedEffect and push the resulting values into the ApiEffect. As a result:

  1. we have cached a new SupportedEffect in the ActiveSupportedEffects.
  2. we have registered the dependency of this SupportedEffect in the AssumptionRegister in the PerspectivesState.

Modules