            (< (:min-epoch status) epoch))))
 
 (defn coordinator-iteration 
-  [{:keys [messenger last-heartbeat-time  allocation-ch shutdown-ch peer-config barrier job] :as state}
+  [{:keys [messenger last-heartbeat-time allocation-ch shutdown-ch barrier job] :as state}
    coordinator-max-sleep-ns
    barrier-period-ns
    heartbeat-ns]

          (assoc state :curr-replica new-replica))))

(defn complete-job 
  [{:keys [peer-config log job-id messenger checkpoint] :as state}]
  (let [{:keys [onyx/tenancy-id]} peer-config
        replica-version (m/replica-version messenger)
        epoch (m/epoch messenger)]
    (let [coordinates {:tenancy-id tenancy-id :job-id job-id :replica-version replica-version :epoch epoch} 
          next-write-version (write-coordinate (:write-version checkpoint) log tenancy-id job-id coordinates)]

                                         :checkpoint? checkpoint?}})
          (assoc :messenger messenger)))))

(defn shutdown [{:keys [messenger] :as state}]
  (assoc state :messenger (component/stop messenger)))

(defn initialise-state [{:keys [log job-id tenancy-id] :as state}]
  (let [write-version (assume-checkpoint-coordinate log tenancy-id job-id)] 
    (-> state 
        (assoc-in [:checkpoint :write-version] write-version)
        (assoc :last-heartbeat-time (System/nanoTime)))))
