Uploaded image for project: 'Fluid Infusion'
  1. Fluid Infusion
  2. FLUID-5865

Model relay rules should respond to priority directives

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Data Binder, Framework
    • Labels:
      None

      Description

      When the model relay system was designed, it was considered adequate that relay rules would flood the skeleton in a purely data-driven way, and that to arbitrate between them would just lead to confusion - and a lack of well-definedness in the final stabilised skeleton state.

      However, after FLUID-5361 and more experience, it's clear that this is actually exactly what is required, and it is in fact essential in order to ensure that the skeleton can settle to the user-defined state. The disorderliness of dataflow systems when there are multiple valid arcs along which updates can flow is well-known (for example, in user environments such as Quartz Composer, where relative dataflow order cannot be controlled), and since our priority system is now so mature and so well-understood, it is a reasonable economy to extend it to relay rules as well as all the other artefacts to which it applies (model listeners, distributions, context awareness rules, etc.)

      Here is the motivating use case. A user component showing a graph has a "viewport", which for the sake of simplicity we will only consider the x-axis component of. This has various model coordinates associated with it, with various constraints:

          model: {
              dataRange: {
                  step: // interval between data points in ms
                  start: // start of available data in ms
              visWindow: {
                  start: // start of visible window in ms
                  end: // end of visible window in ms
                  step: // interval between drawn points in ms
               },
               midPoint: // the midpoint of visWindow in ms
               screenChaundles: // count of data points that will fit into the visible window
               range: // The number of data points available
               position: // scrollbar position - has range from 0 to range - screenChaundles 
          }
      

      We have the following constraints:

      midpoint = (visWindow.start + visWindow.end) / 2;
      range = (dataRange.end - dataRange.start) / dataRange.step;
      position = (visWindow.start - dataRange.start) / dataRange.step;
      visWindow.step = dataRange.step;
      visWindow.end = visWindow.start + visWindow.step * screenChaundles;
      

      Now - as a UI action, when the user zooms in or out of the window, we need to maintain the constraint that the value of "midPoint" (or more ambitiously, any chosen real coordinate, for example, the one that the mouse x position identifies) should remain fixed during the zoom. Now, the zoom is actually "honoured" by making a change to the value of one of the "step" entries. But how is the system to determine which of the constraints which get invalidated by this is to be restored first? Choosing the final, visWindow, constraint, will not only produce the wrong result (for example, by causing the window start or end position to be maintained rather than the midpoint) but will also sufficiently pollute the pool of state that the desired configuration could never be recovered.

      This implies that we need to be able to signal that, for example, the system is to react to a change in "step" in the first instance with a definitely chosen rule rather than picking a constraint in which the value appears at random. In this case, the "midpoint" rule would result in a custom propagation based on inverting some of the above constraints:

      visWindow.start = midpoint - dataRange.step * screenChaundles / 2;
      

      After we have successfully updated one determining element in the cooperating set, flooding propagation from this site will inevitably lead to the right result. Without the power to specify that this rule must take priority over all those in which "step" appears when processing an update, we can't ensure that the user receives the correct final model state.

        Attachments

          Activity

            People

            Assignee:
            antranig Antranig Basman
            Reporter:
            antranig Antranig Basman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: