Liking cljdoc? Tell your friends :D

jepsen.reconnect

Stateful wrappers for automatically reconnecting network clients.

A wrapper is a map with a connection atom conn and a pair of functions: (open), which opens a new connection, and (close conn), which closes a connection. We use these to provide a with-conn macro that acquires the current connection from a wrapper, evaluates body, and automatically closes/reopens the connection when errors occur.

Connect/close/reconnect lock the wrapper, but multiple threads may acquire the current connection at once.

Stateful wrappers for automatically reconnecting network clients.

A wrapper is a map with a connection atom `conn` and a pair of functions:
`(open)`, which opens a new connection, and `(close conn)`, which closes a
connection. We use these to provide a with-conn macro that acquires the
current connection from a wrapper, evaluates body, and automatically
closes/reopens the connection when errors occur.

Connect/close/reconnect lock the wrapper, but multiple threads may acquire
the current connection at once.
raw docstring

close!clj

(close! wrapper)

Closes a wrapper.

Closes a wrapper.
raw docstring

connclj

(conn wrapper)

Active connection for a wrapper, if one exists.

Active connection for a wrapper, if one exists.
raw docstring

open!clj

(open! wrapper)

Given a wrapper, opens a connection. Noop if conn is already open.

Given a wrapper, opens a connection. Noop if conn is already open.
raw docstring

reopen!clj

(reopen! wrapper)

Reopens a wrapper's connection.

Reopens a wrapper's connection.
raw docstring

with-conncljmacro

(with-conn [c wrapper] & body)

Acquires a read lock, takes a connection from the wrapper, and evaluates body with that connection bound to c. If any Exception is thrown, closes the connection and opens a new one.

Acquires a read lock, takes a connection from the wrapper, and evaluates
body with that connection bound to c. If any Exception is thrown, closes the
connection and opens a new one.
raw docstring

with-lockcljmacro

(with-lock wrapper lock-method & body)

with-read-lockcljmacro

(with-read-lock wrapper & body)

with-write-lockcljmacro

(with-write-lock wrapper & body)

wrapperclj

(wrapper options)

A wrapper is a stateful construct for talking to a database. Options:

:name An optional name for this wrapper (for debugging logs) :open A function which generates a new conn :close A function which closes a conn :log? Whether to log reconnect messages

A wrapper is a stateful construct for talking to a database. Options:

:name     An optional name for this wrapper (for debugging logs)
:open     A function which generates a new conn
:close    A function which closes a conn
:log?     Whether to log reconnect messages
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close