2017-05-25 12:00:58 +00:00
|
|
|
#ifndef OD_ROUTE_H
|
|
|
|
#define OD_ROUTE_H
|
|
|
|
|
|
|
|
/*
|
2018-03-12 14:03:15 +00:00
|
|
|
* Odyssey.
|
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_route od_route_t;
|
|
|
|
|
|
|
|
struct od_route
|
|
|
|
{
|
2018-03-06 15:23:52 +00:00
|
|
|
od_configroute_t *config;
|
2017-05-25 12:00:58 +00:00
|
|
|
od_routeid_t id;
|
2018-03-02 13:12:32 +00:00
|
|
|
od_serverstat_t cron_stats;
|
|
|
|
od_serverstat_t cron_stats_avg;
|
2017-08-11 15:19:29 +00:00
|
|
|
int stats_mark;
|
2017-05-25 12:00:58 +00:00
|
|
|
od_serverpool_t server_pool;
|
|
|
|
od_clientpool_t client_pool;
|
|
|
|
od_list_t link;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
od_route_init(od_route_t *route)
|
|
|
|
{
|
2018-03-06 15:23:52 +00:00
|
|
|
route->config = NULL;
|
2017-05-25 12:00:58 +00:00
|
|
|
od_routeid_init(&route->id);
|
|
|
|
od_serverpool_init(&route->server_pool);
|
|
|
|
od_clientpool_init(&route->client_pool);
|
2017-08-11 15:19:29 +00:00
|
|
|
route->stats_mark = 0;
|
2018-03-02 13:12:32 +00:00
|
|
|
memset(&route->cron_stats, 0, sizeof(route->cron_stats));
|
|
|
|
memset(&route->cron_stats_avg, 0, sizeof(route->cron_stats_avg));
|
2017-05-25 12:00:58 +00:00
|
|
|
od_list_init(&route->link);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline od_route_t*
|
2017-06-29 14:05:48 +00:00
|
|
|
od_route_allocate(void)
|
|
|
|
{
|
2017-05-25 12:00:58 +00:00
|
|
|
od_route_t *route = malloc(sizeof(*route));
|
|
|
|
if (route == NULL)
|
|
|
|
return NULL;
|
|
|
|
od_route_init(route);
|
|
|
|
return route;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
od_route_free(od_route_t *route)
|
|
|
|
{
|
|
|
|
od_routeid_free(&route->id);
|
|
|
|
od_serverpool_free(&route->server_pool);
|
|
|
|
free(route);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* OD_ROUTE_H */
|