The pooler Reference Manual

This is the pooler Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:19:04 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 pooler

Generic thread-safe pooling facility for your library.

Author

quasi <>

License

MIT

Long Description

A Trivial, Fast & Thread-Safe Pooling Library for Common Lisp.

We need pools for items which have heavy cost of creation and which we can reuse. A typical use case is connection pools.

Pool item creation (as required) is automatic on fetch-from pool. Pool-item’s are created and destroyed using user supplied funcitons. The pool has a idle timeout after which all the existing pool-item’s are destroyed and new ones created (pool-init). The pool has a threshold number of items which it tries to maintain.

Version

1.0.0

Dependency

sb-concurrency (system).

Source

pooler.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 pooler/pooler.asd

Source

pooler.asd.

Parent Component

pooler (system).

ASDF Systems

pooler.


3.1.2 pooler/package.lisp

Source

pooler.asd.

Parent Component

pooler (system).

Packages

pooler.


3.1.3 pooler/utils.lisp

Dependency

package.lisp (file).

Source

pooler.asd.

Parent Component

pooler (system).

Internals

3.1.4 pooler/pooler.lisp

Dependency

utils.lisp (file).

Source

pooler.asd.

Parent Component

pooler (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 pooler

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: with-pool ((pool-item pool) &body body)
Package

pooler.

Source

pooler.lisp.


5.1.2 Ordinary functions

Function: fetch-from (pool &key tries)

Tries a couple of times to fetch from pool. Grows the pool.

Package

pooler.

Source

pooler.lisp.

Function: grow-pool (pool &optional grow-by)
Package

pooler.

Source

pooler.lisp.

Function: make-pool (&key name capacity threshold item-maker item-destroyer timeout)
Package

pooler.

Source

pooler.lisp.

Function: pool-init (pool)

Cleans up the pool & reinits it with MIN-THRESHOLD number of POOL-ITEM

Package

pooler.

Source

pooler.lisp.

Function: return-to (pool pool-item)

Returns a pool object to the pool

Package

pooler.

Source

pooler.lisp.


5.2 Internals


5.2.1 Macros

Macro: dequeue (queue)
Package

pooler.

Source

utils.lisp.

Macro: enqueue (queue what)
Package

pooler.

Source

utils.lisp.

Macro: queue-empty-p (queue)
Package

pooler.

Source

utils.lisp.

Macro: with-pool-lock ((lock) &body body)
Package

pooler.

Source

utils.lisp.


5.2.2 Ordinary functions

Function: copy-pool (instance)
Package

pooler.

Source

pooler.lisp.

Function: copy-q (instance)
Package

pooler.

Source

utils.lisp.

Function: destroy-pool-item (pool pool-item)

Destroys the POOL-ITEM using the item-destroyer funciton stored in the pool

Package

pooler.

Source

pooler.lisp.

Function: empty-queue? (q)

Are there no elements in the queue?

Package

pooler.

Source

utils.lisp.

Function: enqueue-at-end (q items)

Add a list of items to the end of the queue.

Package

pooler.

Source

utils.lisp.

Function: fetch-from-aux (pool &optional old)

Fetches a pool item from pool.

Package

pooler.

Source

pooler.lisp.

Function: make-empty-queue ()
Package

pooler.

Source

utils.lisp.

Function: make-pool-lock ()
Package

pooler.

Source

utils.lisp.

Function: make-q (&key key last elements)
Package

pooler.

Source

utils.lisp.

Function: make-queue ()
Package

pooler.

Source

utils.lisp.

Function: new-pool-item (pool)

Creates a new POOL-ITEM using the item-maker funciton stored in the pool

Package

pooler.

Source

pooler.lisp.

Reader: pool-capacity (instance)
Writer: (setf pool-capacity) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

capacity.

Reader: pool-current-size (instance)
Writer: (setf pool-current-size) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

current-size.

Function: pool-error (message &key pool-name)

Signals an error of type POOL-ERROR with the provided information

Package

pooler.

Source

pooler.lisp.

Reader: pool-item-destroyer (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

item-destroyer.

Reader: pool-item-maker (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

item-maker.

Reader: pool-last-access (instance)
Writer: (setf pool-last-access) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

last-access.

Reader: pool-lock (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

lock.

Reader: pool-name (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

name.

Function: pool-p (object)
Package

pooler.

Source

pooler.lisp.

Reader: pool-queue (instance)
Writer: (setf pool-queue) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

queue.

Reader: pool-threshold (instance)
Writer: (setf pool-threshold) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

threshold.

Reader: pool-timeout (instance)
Writer: (setf pool-timeout) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

timeout.

Reader: pool-total-created (instance)
Writer: (setf pool-total-created) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

total-created.

Reader: pool-total-pool-inits (instance)
Writer: (setf pool-total-pool-inits) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

total-pool-inits.

Reader: pool-total-uses (instance)
Writer: (setf pool-total-uses) (instance)
Package

pooler.

Source

pooler.lisp.

Target Slot

total-uses.

Reader: q-elements (instance)
Writer: (setf q-elements) (instance)
Package

pooler.

Source

utils.lisp.

Target Slot

elements.

Reader: q-key (instance)
Writer: (setf q-key) (instance)
Package

pooler.

Source

utils.lisp.

Target Slot

key.

Reader: q-last (instance)
Writer: (setf q-last) (instance)
Package

pooler.

Source

utils.lisp.

Target Slot

last.

Function: q-p (object)
Package

pooler.

Source

utils.lisp.

Function: queue-front (q)

Return the element at the front of the queue.

Package

pooler.

Source

utils.lisp.

Function: remove-front (q)

Remove the element from the front of the queue and return it.

Package

pooler.

Source

utils.lisp.


5.2.3 Generic functions

Generic Reader: message (condition)
Generic Writer: (setf message) (condition)
Package

pooler.

Methods
Reader Method: message ((condition pool-warning))
Writer Method: (setf message) ((condition pool-warning))
Source

pooler.lisp.

Target Slot

message.

Reader Method: message ((condition pool-error))
Writer Method: (setf message) ((condition pool-error))
Source

pooler.lisp.

Target Slot

message.

Generic Reader: name (condition)
Generic Writer: (setf name) (condition)
Package

pooler.

Methods
Reader Method: name ((condition pool-error))
Writer Method: (setf name) ((condition pool-error))
Source

pooler.lisp.

Target Slot

name.


5.2.4 Conditions

Condition: pool-empty-error
Package

pooler.

Source

pooler.lisp.

Direct superclasses

pool-error.

Condition: pool-error

Superclass for all errors related to Pooler.

Package

pooler.

Source

pooler.lisp.

Direct superclasses

error.

Direct subclasses
Direct methods
Direct slots
Slot: message
Initform

(quote nil)

Initargs

:message

Readers

message.

Writers

(setf message).

Slot: name
Initform

(quote nil)

Initargs

:name

Readers

name.

Writers

(setf name).

Condition: pool-item-creation-error
Package

pooler.

Source

pooler.lisp.

Direct superclasses

pool-error.

Condition: pool-warning
Package

pooler.

Source

pooler.lisp.

Direct superclasses

warning.

Direct methods
Direct slots
Slot: message
Initform

(quote nil)

Initargs

:message

Readers

message.

Writers

(setf message).


5.2.5 Structures

Structure: pool
Package

pooler.

Source

pooler.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Type

simple-string

Initform

"default pool"

Readers

pool-name.

Writers

This slot is read-only.

Slot: queue
Initform

(pooler::make-queue)

Readers

pool-queue.

Writers

(setf pool-queue).

Slot: lock
Initform

(pooler::make-pool-lock)

Readers

pool-lock.

Writers

This slot is read-only.

Slot: item-maker
Type

function

Initform

(function (lambda nil (quote pooler::sample-item)))

Readers

pool-item-maker.

Writers

This slot is read-only.

Slot: item-destroyer
Type

function

Initform

(function (lambda (pooler::item) (setf pooler::item nil)))

Readers

pool-item-destroyer.

Writers

This slot is read-only.

Slot: capacity
Type

fixnum

Initform

40

Readers

pool-capacity.

Writers

(setf pool-capacity).

Slot: threshold
Type

fixnum

Initform

2

Readers

pool-threshold.

Writers

(setf pool-threshold).

Slot: timeout
Type

fixnum

Initform

300

Readers

pool-timeout.

Writers

(setf pool-timeout).

Slot: last-access
Type

integer

Initform

0

Readers

pool-last-access.

Writers

(setf pool-last-access).

Slot: current-size
Type

fixnum

Initform

0

Readers

pool-current-size.

Writers

(setf pool-current-size).

Slot: total-uses
Type

fixnum

Initform

0

Readers

pool-total-uses.

Writers

(setf pool-total-uses).

Slot: total-created
Type

fixnum

Initform

0

Readers

pool-total-created.

Writers

(setf pool-total-created).

Slot: total-pool-inits
Type

fixnum

Initform

0

Readers

pool-total-pool-inits.

Writers

(setf pool-total-pool-inits).

Structure: q
Package

pooler.

Source

utils.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: key
Initform

(function identity)

Readers

q-key.

Writers

(setf q-key).

Slot: last
Package

common-lisp.

Readers

q-last.

Writers

(setf q-last).

Slot: elements
Readers

q-elements.

Writers

(setf q-elements).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   E   F   G   M   N   P   Q   R   W  
Index Entry  Section

(
(setf message): Private generic functions
(setf message): Private generic functions
(setf message): Private generic functions
(setf name): Private generic functions
(setf name): Private generic functions
(setf pool-capacity): Private ordinary functions
(setf pool-current-size): Private ordinary functions
(setf pool-last-access): Private ordinary functions
(setf pool-queue): Private ordinary functions
(setf pool-threshold): Private ordinary functions
(setf pool-timeout): Private ordinary functions
(setf pool-total-created): Private ordinary functions
(setf pool-total-pool-inits): Private ordinary functions
(setf pool-total-uses): Private ordinary functions
(setf q-elements): Private ordinary functions
(setf q-key): Private ordinary functions
(setf q-last): Private ordinary functions

C
copy-pool: Private ordinary functions
copy-q: Private ordinary functions

D
dequeue: Private macros
destroy-pool-item: Private ordinary functions

E
empty-queue?: Private ordinary functions
enqueue: Private macros
enqueue-at-end: Private ordinary functions

F
fetch-from: Public ordinary functions
fetch-from-aux: Private ordinary functions
Function, (setf pool-capacity): Private ordinary functions
Function, (setf pool-current-size): Private ordinary functions
Function, (setf pool-last-access): Private ordinary functions
Function, (setf pool-queue): Private ordinary functions
Function, (setf pool-threshold): Private ordinary functions
Function, (setf pool-timeout): Private ordinary functions
Function, (setf pool-total-created): Private ordinary functions
Function, (setf pool-total-pool-inits): Private ordinary functions
Function, (setf pool-total-uses): Private ordinary functions
Function, (setf q-elements): Private ordinary functions
Function, (setf q-key): Private ordinary functions
Function, (setf q-last): Private ordinary functions
Function, copy-pool: Private ordinary functions
Function, copy-q: Private ordinary functions
Function, destroy-pool-item: Private ordinary functions
Function, empty-queue?: Private ordinary functions
Function, enqueue-at-end: Private ordinary functions
Function, fetch-from: Public ordinary functions
Function, fetch-from-aux: Private ordinary functions
Function, grow-pool: Public ordinary functions
Function, make-empty-queue: Private ordinary functions
Function, make-pool: Public ordinary functions
Function, make-pool-lock: Private ordinary functions
Function, make-q: Private ordinary functions
Function, make-queue: Private ordinary functions
Function, new-pool-item: Private ordinary functions
Function, pool-capacity: Private ordinary functions
Function, pool-current-size: Private ordinary functions
Function, pool-error: Private ordinary functions
Function, pool-init: Public ordinary functions
Function, pool-item-destroyer: Private ordinary functions
Function, pool-item-maker: Private ordinary functions
Function, pool-last-access: Private ordinary functions
Function, pool-lock: Private ordinary functions
Function, pool-name: Private ordinary functions
Function, pool-p: Private ordinary functions
Function, pool-queue: Private ordinary functions
Function, pool-threshold: Private ordinary functions
Function, pool-timeout: Private ordinary functions
Function, pool-total-created: Private ordinary functions
Function, pool-total-pool-inits: Private ordinary functions
Function, pool-total-uses: Private ordinary functions
Function, q-elements: Private ordinary functions
Function, q-key: Private ordinary functions
Function, q-last: Private ordinary functions
Function, q-p: Private ordinary functions
Function, queue-front: Private ordinary functions
Function, remove-front: Private ordinary functions
Function, return-to: Public ordinary functions

G
Generic Function, (setf message): Private generic functions
Generic Function, (setf name): Private generic functions
Generic Function, message: Private generic functions
Generic Function, name: Private generic functions
grow-pool: Public ordinary functions

M
Macro, dequeue: Private macros
Macro, enqueue: Private macros
Macro, queue-empty-p: Private macros
Macro, with-pool: Public macros
Macro, with-pool-lock: Private macros
make-empty-queue: Private ordinary functions
make-pool: Public ordinary functions
make-pool-lock: Private ordinary functions
make-q: Private ordinary functions
make-queue: Private ordinary functions
message: Private generic functions
message: Private generic functions
message: Private generic functions
Method, (setf message): Private generic functions
Method, (setf message): Private generic functions
Method, (setf name): Private generic functions
Method, message: Private generic functions
Method, message: Private generic functions
Method, name: Private generic functions

N
name: Private generic functions
name: Private generic functions
new-pool-item: Private ordinary functions

P
pool-capacity: Private ordinary functions
pool-current-size: Private ordinary functions
pool-error: Private ordinary functions
pool-init: Public ordinary functions
pool-item-destroyer: Private ordinary functions
pool-item-maker: Private ordinary functions
pool-last-access: Private ordinary functions
pool-lock: Private ordinary functions
pool-name: Private ordinary functions
pool-p: Private ordinary functions
pool-queue: Private ordinary functions
pool-threshold: Private ordinary functions
pool-timeout: Private ordinary functions
pool-total-created: Private ordinary functions
pool-total-pool-inits: Private ordinary functions
pool-total-uses: Private ordinary functions

Q
q-elements: Private ordinary functions
q-key: Private ordinary functions
q-last: Private ordinary functions
q-p: Private ordinary functions
queue-empty-p: Private macros
queue-front: Private ordinary functions

R
remove-front: Private ordinary functions
return-to: Public ordinary functions

W
with-pool: Public macros
with-pool-lock: Private macros


A.3 Variables