diff --git a/AlgebraicDataflowArchitectureModel/models/Twitter.model b/AlgebraicDataflowArchitectureModel/models/Twitter.model new file mode 100644 index 0000000..98d391b --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/Twitter.model @@ -0,0 +1,53 @@ +channel a_Tweet { + out a_user_timeline(l:List, a_tweet(t:Str)) == cons(t, l) + out a_user_timeline(l, e) == l +} + +channel a_Follow { + out a_follows(f:List, a_follow(u:Int)) == cons(u, f) + out a_follows(f, e) == f +} + +channel a_Home { + in a_user_timeline(la1, update_a(f2, la2, lb2, lc2)) == la2 + in b_user_timeline(lb1, update_a(f2, la2, lb2, lc2)) == lb2 + in c_user_timeline(lc1, update_a(f2, la2, lb2, lc2)) == lc2 + in a_follows(f, update_a(f2, la2, lb2, lc2)) == f2 + out a_home_timeline(t:List, update_a(f2, la2, lb2, lc2)) == merge(la2, if(contains(f2,2), merge(lb2, if(contains(f2,3), lc2, nil)), if(contains(f2,3), lc2, nil))) +} + +channel b_Tweet { + out b_user_timeline(l:List, b_tweet(t:Str)) == cons(t, l) + out b_user_timeline(l, e) == l +} + +channel b_Follow { + out b_follows(f:List, b_follow(u:Int)) == cons(u, f) + out b_follows(f, e) == f +} + +channel b_Home { + in a_user_timeline(la1, update_b(f2, la2, lb2, lc2)) == la2 + in b_user_timeline(lb1, update_b(f2, la2, lb2, lc2)) == lb2 + in c_user_timeline(lc1, update_b(f2, la2, lb2, lc2)) == lc2 + in b_follows(f, update_b(f2, la2, lb2, lc2)) == f2 + out b_home_timeline(t:List, update_b(f2, la2, lb2, lc2)) == merge(lb2, if(contains(f2,1), merge(la2, if(contains(f2,3), lc2, nil)), if(contains(f2,3), lc2, nil))) +} + +channel c_Tweet { + out c_user_timeline(l:List, c_tweet(t:Str)) == cons(t, l) + out c_user_timeline(l, e) == l +} + +channel c_Follow { + out c_follows(f:List, c_follow(u:Int)) == cons(u, f) + out c_follows(f, e) == f +} + +channel c_Home { + in a_user_timeline(la1, update_c(f2, la2, lb2, lc2)) == la2 + in b_user_timeline(lb1, update_c(f2, la2, lb2, lc2)) == lb2 + in c_user_timeline(lc1, update_c(f2, la2, lb2, lc2)) == lc2 + in c_follows(f, update_c(f2, la2, lb2, lc2)) == f2 + out c_home_timeline(t:List, update_c(f2, la2, lb2, lc2)) == merge(lc2, if(contains(f2,1), merge(la2, if(contains(f2,2), lb2, nil)), if(contains(f2,2), lb2, nil))) +}