timonkrebs / MemoizR

Declarative Structured Concurrency for C#
Apache License 2.0
106 stars 3 forks source link

Add Causality Trigger Clock for preparation of distributed graphs #39

Open timonkrebs opened 5 months ago

timonkrebs commented 5 months ago

Add a space efficient Causality Trigger Clock CTC that can ensure efficient synchronization of distributed graph.

Inspired from Interval Tree Clocks

The Stamp is always associated with the Sources. Every Node keeps a Stamp for each of its Sources. Only the Signals (Causality) are tracked.

In the case that a signal updates its value its trigger Value will be incremented. This CTC can ensure the synchronization of the Graph is glitch free also in distributed and dynamically changing graphs. It is also resilient to resetting of nodes.

Example: Signal Trigger
Signal 1 4
Signal 2 7
Signal 3 2
flowchart TD
%% this is a comment A -- text --> B{node}
   A(((Signal #1))) -- "{#1: 4}" --> E((Memo #5)) -- {#5: {1:4, 2:7, 3:2}} --> G((Reaction #7))
   B(((Signal #2))) -- "{#2: 7}"--> D((Memo #4)) -- {#4: {2:7, 3:2}} --> E
   C(((Signal #3))) -- {#3: 2}--> D
   D -- {#4: {2:7, 3:2}} --> F((Memo #6))  -- {#6: {2:7, 3:2}}--> G