 
 (defn- handle-set [state p]
   (cs/add-write
-   (write state {:key (:key p)
-                 :value (:value p)
-                 :op :set})
+   (l/write state {:key (:key p)
+                   :value (:value p)
+                   :op :set})
    p))
 
 (defn- handle-cas [state p]

            (and (= :candidate (:type state))
                 (= :append-entries (:type params))
                 (<= (:current-term state) (:term body))))
      (become-follower (assoc state :current-term (:term body))
                       (:leader-id body))
      (if (:leader-id body)
        (assoc state :leader-id (:leader-id body))
        state))))

(defn- apply-commit-index [state]
  (if (> (:commit-index state) (:last-applied state))
    (-> (update state :last-applied inc)
        (update :db #(log/apply-entry state %)))
    state))

(defn- redirect-to-leader [state p]
