 
 
 ;; dumb in memory peer for testing TODO move to tests
+
+;; for testing; idempotent, commutative
+#_(def update merge)
 
 (declare network)
 (defrecord Peer [state]



;; start listening for incoming websocket connections
#_(def peer-a (create-peer "127.0.0.1"
                           9090
                           {}
                           {"user@mail.com" {1 {1 42}}}))
#_(-start peer-a)
;; subscribe to remote peer(s) as well
#_(def peer-b (create-peer "127.0.0.1"
                           9091
                           {"user@mail.com" {1 #{"127.0.0.1:9090"}} }
                           {"user@mail.com" {1 {1 42}}}))
#_(-start peer-b)

;; publish and then check for update of meta in subscriptions of other peer

#_(-publish peer-b "user@mail.com" 1 {1 42 2 43})
#_(-publish peer-a "user@mail.com" 1 {1 42 2 43 3 44})
#_(-publish peer-b "user@mail.com" 1 {4 45})


(ns ^:shared geschichte.synch
    "Synching related pub-sub protocols."
    (:use [geschichte.meta :refer [update]]
          [geschichte.protocols])
    (:require [clojure.set :as set]
              [geschichte.platform :refer [put! take-all! client-connect!
                                           start-server!]]))


(defn dispatch
