Liking cljdoc? Tell your friends :D

oc.lib.db.pool

RethinkDB database connection pool.

RethinkDB database connection pool.
raw docstring

close-connclj

(close-conn conn)
source

fixed-poolclj

(fixed-pool open)
(fixed-pool open opts)
(fixed-pool open close opts)

A fixed pool of thingies. (open) is called to generate a thingy. (close thingy) is called when a thingy is invalidated. When thingies are invalidated, the pool will immediately try to open a new one; if open throws or returns nil, the pool will sleep for regenerate-interval seconds before retrying (open). :regenerate-interval How long to wait between retrying (open). :size Number of thingies in the pool. :block-start Should (fixed-pool) wait until the pool is full before returning? Note that fixed-pool is correct only if every successful (claim) is followed by exactly one of either (invalidate) or (release). If calls are unbalanced; e.g. resources are not released, doubly released, or released and invalidated, starvation or unbounded blocking could occur. (with-pool) provides this guarantee.

A fixed pool of thingies. (open) is called to generate a thingy. (close
thingy) is called when a thingy is invalidated. When thingies are invalidated,
the pool will immediately try to open a new one; if open throws or returns
nil, the pool will sleep for regenerate-interval seconds before retrying
(open).
:regenerate-interval    How long to wait between retrying (open).
:size                   Number of thingies in the pool.
:block-start            Should (fixed-pool) wait until the pool is full
                        before returning?
Note that fixed-pool is correct only if every successful (claim) is followed
by exactly one of either (invalidate) or (release). If calls are unbalanced;
e.g. resources are not released, doubly released, or released *and*
invalidated, starvation or unbounded blocking could occur. (with-pool)
provides this guarantee.
sourceraw docstring

FixedQueuePoolclj

source

init-connclj

(init-conn db-options)

Create a new RethinkDB connection based on global configuration

Create a new RethinkDB connection based on global configuration
sourceraw docstring

Poolcljprotocol

claimclj

(claim pool)
(claim pool timeout)

Take a thingy from the pool. Timeout of getting a thingy from the pool in seconds (not of using a thingy from the pool); if unspecified, 0. Returns nil if no thingy available.

Take a thingy from the pool. Timeout of getting a thingy from the pool in seconds (not of using a thingy
from the pool); if unspecified, 0. Returns nil if no thingy available.

growclj

(grow pool)

Adds an element to the pool.

Adds an element to the pool.

invalidateclj

(invalidate pool thingy)

Tell the pool a thingy is no longer valid.

Tell the pool a thingy is no longer valid.

releaseclj

(release pool thingy)

Returns a thingy to the pool.

Returns a thingy to the pool.
source

rebuild-pool!clj

(rebuild-pool! pool)

Rebuild the entire pool. This is not atomic so other threads taking connections at the same time may get stale ones. Those are invalidated as soon as they cause an exception.

Rebuild the entire pool. This is not atomic so other threads
taking connections at the same time may get stale ones.
Those are invalidated as soon as they cause an exception.
sourceraw docstring

shutdown-pool!clj

(shutdown-pool! pool)

Close all things in the pool and clear it's queue

Close all things in the pool and clear it's queue
sourceraw docstring

with-poolcljmacro

(with-pool [thingy pool timeout] & body)

Evaluates body in a try expression with a symbol 'thingy claimed from the given pool, with specified claim timeout. Releases thingy at the end of the body, or if an exception is thrown, invalidates them and rethrows. Example: ; With client, taken from connection-pool, waiting 5 seconds to claim, send ; client a message. (with-pool [client connection-pool 5] (send client a-message))

Evaluates body in a try expression with a symbol 'thingy claimed from the
given pool, with specified claim timeout. Releases thingy at the end of the
body, or if an exception is thrown, invalidates them and rethrows. Example:
; With client, taken from connection-pool, waiting 5 seconds to claim, send
; client a message.
(with-pool [client connection-pool 5]
  (send client a-message))
sourceraw docstring

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

× close