forked from onyx-platform/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
status.clj
19 lines (18 loc) · 813 Bytes
/
status.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(ns onyx.peer.status
(:require [taoensso.timbre :refer [debug info error warn trace fatal]]))
(defn merge-statuses
"Combines many statuses into one overall status that conveys the
minimum/worst case of all of the statuses"
[[fst & rst]]
(reduce (fn [c s]
{:ready? (and (:ready? s) (:ready? c))
:drained? (and (:drained? s) (:drained? c))
:replica-version (if-let [rvs (seq (keep :replica-version [c s]))]
(apply min rvs)
-1)
:checkpointing? (or (:checkpointing? s) (:checkpointing? c))
:heartbeat (min (:heartbeat c) (:heartbeat s))
:epoch (min (:epoch c) (:epoch s))
:min-epoch (min (:min-epoch c) (:min-epoch s))})
fst
rst))