State synchronization providers for cluster mode.
This namespace provides IStateProvider implementations for:
Each provider implements the protocol from lb.cluster.protocol.
State synchronization providers for cluster mode. This namespace provides IStateProvider implementations for: - Health status synchronization - Circuit breaker state synchronization - Drain coordination Each provider implements the protocol from lb.cluster.protocol.
(broadcast-circuit-change! target-id cb-state)Broadcast a circuit breaker state change.
Broadcast a circuit breaker state change.
(broadcast-circuit-open! target-id cb-state)Immediately broadcast circuit breaker opening to prevent thundering herd.
Immediately broadcast circuit breaker opening to prevent thundering herd.
(broadcast-drain-complete! target-id)Broadcast drain completion to the cluster.
Broadcast drain completion to the cluster.
(broadcast-drain-start! target-id proxy-name)Broadcast drain start to the cluster.
Broadcast drain start to the cluster.
(broadcast-health-change! target-id health-state)Broadcast a health status change to the cluster.
Broadcast a health status change to the cluster.
(create-circuit-breaker-provider get-cb-states-fn apply-cb-fn)Create a circuit breaker state provider.
Args:
Returns an IStateProvider implementation.
Conflict Resolution:
Create a circuit breaker state provider.
Args:
- get-cb-states-fn: (fn [] {target-id -> {:state :closed/:open/:half-open
:error-rate float
:last-transition ms}})
- apply-cb-fn: (fn [target-id remote-state] ...) to apply remote CB state
Returns an IStateProvider implementation.
Conflict Resolution:
- OPEN always wins (conservative, prevents thundering herd)
- HALF-OPEN beats CLOSED (testing phase should propagate)
- CLOSED only applies if remote is definitely newer(create-drain-provider get-drain-states-fn apply-drain-fn)Create a drain coordination state provider.
Args:
Returns an IStateProvider implementation.
Conflict Resolution:
Create a drain coordination state provider.
Args:
- get-drain-states-fn: (fn [] {target-id -> {:status :draining/:drained/:active
:start-time ms
:proxy-name str}})
- apply-drain-fn: (fn [target-id remote-state] ...) to apply remote drain
Returns an IStateProvider implementation.
Conflict Resolution:
- :draining wins over :active (active drain takes precedence)
- :drained only if all nodes agree(create-health-provider get-health-states-fn apply-health-fn)Create a health state provider.
Args:
Returns an IStateProvider implementation.
Create a health state provider.
Args:
- get-health-states-fn: (fn [] {target-id -> {:status :healthy/:unhealthy/:unknown
:last-check-time ms
:consecutive-successes n
:consecutive-failures n}})
- apply-health-fn: (fn [target-id remote-state] ...) to apply remote health
Returns an IStateProvider implementation.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |