Liking cljdoc? Tell your friends :D

lb.drain

Connection draining for graceful backend removal. Allows backends to be drained by stopping new connections while allowing existing connections to complete.

Connection draining for graceful backend removal.
Allows backends to be drained by stopping new connections while
allowing existing connections to complete.
raw docstring

drain-backend!clj

(drain-backend! proxy-name
                target-group
                target
                &
                {:keys [timeout-ms on-complete] :or {timeout-ms 30000}})

Start draining a backend target.

proxy-name: Name of the proxy containing the target target-group: TargetGroup record containing the target target: Target to drain - "ip:port" string, {:ip :port} map, or WeightedTarget opts: :timeout-ms - Drain timeout (default 30000ms) :on-complete - Callback fn called with status when drain completes

Returns DrainState or throws if target not found/already draining.

Start draining a backend target.

proxy-name: Name of the proxy containing the target
target-group: TargetGroup record containing the target
target: Target to drain - "ip:port" string, {:ip :port} map, or WeightedTarget
opts:
  :timeout-ms - Drain timeout (default 30000ms)
  :on-complete - Callback fn called with status when drain completes

Returns DrainState or throws if target not found/already draining.
sourceraw docstring

drain-stateclj

source

draining?clj

(draining? target)

Check if a target is currently draining.

Check if a target is currently draining.
sourceraw docstring

format-drain-statusclj

(format-drain-status status)

Format drain status for display.

Format drain status for display.
sourceraw docstring

get-all-drainingclj

(get-all-draining)

Get all currently draining backends.

Returns seq of drain status maps.

Get all currently draining backends.

Returns seq of drain status maps.
sourceraw docstring

get-connections-for-targetclj

(get-connections-for-target conntrack-map target-id)

Get the number of active connections to a specific target. Uses conntrack/stats-by-target to count connections.

Get the number of active connections to a specific target.
Uses conntrack/stats-by-target to count connections.
sourceraw docstring

get-drain-statusclj

(get-drain-status target)

Get current drain status for a backend.

Returns map with :target-id :status :elapsed-ms :current-connections or nil if not draining.

Get current drain status for a backend.

Returns map with :target-id :status :elapsed-ms :current-connections
or nil if not draining.
sourceraw docstring

init!clj

(init! conntrack-map
       update-weights-fn
       &
       {:keys [check-interval-ms] :or {check-interval-ms 1000}})

Initialize the drain module with required resources. conntrack-map: BPF conntrack map for connection counting update-weights-fn: Function (fn [proxy-name new-target-group]) to update BPF maps opts: :check-interval-ms - How often to check drain status (default 1000ms)

Initialize the drain module with required resources.
conntrack-map: BPF conntrack map for connection counting
update-weights-fn: Function (fn [proxy-name new-target-group]) to update BPF maps
opts:
  :check-interval-ms - How often to check drain status (default 1000ms)
sourceraw docstring

normalize-targetclj

(normalize-target target)

Normalize target to target-id string. Accepts: "ip:port" string, {:ip :port} map, or WeightedTarget record.

Normalize target to target-id string.
Accepts: "ip:port" string, {:ip :port} map, or WeightedTarget record.
sourceraw docstring

parse-target-idclj

(parse-target-id id)

Parse a target ID string into {:ip :port}. Returns IP as u32 and port as int.

Parse a target ID string into {:ip :port}.
Returns IP as u32 and port as int.
sourceraw docstring

(print-drain-status)

Print all draining backends.

Print all draining backends.
sourceraw docstring

shutdown!clj

(shutdown!)

Shutdown the drain module.

Shutdown the drain module.
sourceraw docstring

stop-drain-watcher!clj

(stop-drain-watcher!)

Stop the drain watcher.

Stop the drain watcher.
sourceraw docstring

target-idclj

(target-id ip port)

Create a target ID string from IP and port. IP can be a string or u32 value.

Create a target ID string from IP and port.
IP can be a string or u32 value.
sourceraw docstring

undrain-backend!clj

(undrain-backend! proxy-name target-group target)

Cancel draining and restore traffic to a backend.

proxy-name: Name of the proxy target-group: TargetGroup record containing the target target: Target to undrain

Returns true if undrain succeeded, false if target wasn't draining.

Cancel draining and restore traffic to a backend.

proxy-name: Name of the proxy
target-group: TargetGroup record containing the target
target: Target to undrain

Returns true if undrain succeeded, false if target wasn't draining.
sourceraw docstring

wait-for-drain!clj

(wait-for-drain! target)

Block until drain completes or times out.

Returns :completed, :timeout, or :cancelled.

Block until drain completes or times out.

Returns :completed, :timeout, or :cancelled.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close