2017-05-25 12:00:58 +00:00
|
|
|
#ifndef OD_CLIENT_POOL_H
|
|
|
|
#define OD_CLIENT_POOL_H
|
|
|
|
|
|
|
|
/*
|
2017-07-05 12:42:49 +00:00
|
|
|
* Odissey.
|
2017-05-25 12:00:58 +00:00
|
|
|
*
|
2017-07-05 12:42:49 +00:00
|
|
|
* Advanced PostgreSQL connection pooler.
|
2017-05-25 12:00:58 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct od_clientpool od_clientpool_t;
|
|
|
|
|
2017-08-17 15:38:10 +00:00
|
|
|
typedef int (*od_clientpool_cb_t)(od_client_t*, void*);
|
|
|
|
|
2017-05-25 12:00:58 +00:00
|
|
|
struct od_clientpool
|
|
|
|
{
|
|
|
|
od_list_t active;
|
|
|
|
od_list_t queue;
|
|
|
|
od_list_t pending;
|
|
|
|
int count_active;
|
|
|
|
int count_queue;
|
|
|
|
int count_pending;
|
|
|
|
};
|
|
|
|
|
|
|
|
void od_clientpool_init(od_clientpool_t*);
|
|
|
|
void od_clientpool_set(od_clientpool_t*, od_client_t*,
|
|
|
|
od_clientstate_t);
|
|
|
|
od_client_t*
|
|
|
|
od_clientpool_next(od_clientpool_t*, od_clientstate_t);
|
|
|
|
|
2017-08-17 15:38:10 +00:00
|
|
|
od_client_t*
|
|
|
|
od_clientpool_foreach(od_clientpool_t*,
|
|
|
|
od_clientstate_t,
|
|
|
|
od_clientpool_cb_t,
|
|
|
|
void*);
|
|
|
|
|
2017-05-25 12:00:58 +00:00
|
|
|
static inline int
|
|
|
|
od_clientpool_total(od_clientpool_t *pool) {
|
|
|
|
return pool->count_active + pool->count_queue +
|
|
|
|
pool->count_pending;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* OD_CLIENT_POOL_H */
|