mirror of https://github.com/yandex/odyssey.git
odissey: new naming scheme: od_routeid_t
This commit is contained in:
parent
d4b5f83dbe
commit
d53c0eb339
|
@ -11,7 +11,7 @@ typedef struct odroute_t odroute_t;
|
|||
|
||||
struct odroute_t {
|
||||
od_schemeroute_t *scheme;
|
||||
odroute_id_t id;
|
||||
od_routeid_t id;
|
||||
od_serverpool_t server_pool;
|
||||
od_list_t link;
|
||||
};
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
* PostgreSQL connection pooler and request router.
|
||||
*/
|
||||
|
||||
typedef struct odroute_id_t odroute_id_t;
|
||||
typedef struct od_routeid_t od_routeid_t;
|
||||
|
||||
struct odroute_id_t {
|
||||
struct od_routeid_t {
|
||||
char *user;
|
||||
int user_len;
|
||||
char *database;
|
||||
|
@ -17,7 +17,7 @@ struct odroute_id_t {
|
|||
};
|
||||
|
||||
static inline void
|
||||
od_routeid_init(odroute_id_t *id)
|
||||
od_routeid_init(od_routeid_t *id)
|
||||
{
|
||||
id->user = NULL;
|
||||
id->user_len = 0;
|
||||
|
@ -26,7 +26,7 @@ od_routeid_init(odroute_id_t *id)
|
|||
}
|
||||
|
||||
static inline void
|
||||
od_routeid_free(odroute_id_t *id)
|
||||
od_routeid_free(od_routeid_t *id)
|
||||
{
|
||||
if (id->database)
|
||||
free(id->database);
|
||||
|
@ -35,7 +35,7 @@ od_routeid_free(odroute_id_t *id)
|
|||
}
|
||||
|
||||
static inline int
|
||||
od_routeid_copy(odroute_id_t *dest, odroute_id_t *id)
|
||||
od_routeid_copy(od_routeid_t *dest, od_routeid_t *id)
|
||||
{
|
||||
dest->database = malloc(id->database_len);
|
||||
if (dest->database == NULL)
|
||||
|
@ -54,7 +54,7 @@ od_routeid_copy(odroute_id_t *dest, odroute_id_t *id)
|
|||
}
|
||||
|
||||
static inline int
|
||||
od_routeid_compare(odroute_id_t *a, odroute_id_t *b)
|
||||
od_routeid_compare(od_routeid_t *a, od_routeid_t *b)
|
||||
{
|
||||
if (a->database_len == b->database_len &&
|
||||
a->user_len == b->user_len) {
|
||||
|
|
|
@ -47,7 +47,7 @@ void od_routepool_free(odroute_pool_t *pool)
|
|||
|
||||
odroute_t*
|
||||
od_routepool_new(odroute_pool_t *pool, od_schemeroute_t *scheme,
|
||||
odroute_id_t *id)
|
||||
od_routeid_t *id)
|
||||
{
|
||||
odroute_t *route = od_routealloc();
|
||||
if (route == NULL)
|
||||
|
@ -73,7 +73,7 @@ void od_routepool_unlink(odroute_pool_t *pool, odroute_t *route)
|
|||
}
|
||||
|
||||
odroute_t*
|
||||
od_routepool_match(odroute_pool_t *pool, odroute_id_t *key)
|
||||
od_routepool_match(odroute_pool_t *pool, od_routeid_t *key)
|
||||
{
|
||||
odroute_t *route;
|
||||
od_list_t *i;
|
||||
|
|
|
@ -19,12 +19,12 @@ void od_routepool_free(odroute_pool_t*);
|
|||
|
||||
odroute_t*
|
||||
od_routepool_new(odroute_pool_t*, od_schemeroute_t*,
|
||||
odroute_id_t*);
|
||||
od_routeid_t*);
|
||||
|
||||
void od_routepool_unlink(odroute_pool_t*, odroute_t*);
|
||||
|
||||
odroute_t*
|
||||
od_routepool_match(odroute_pool_t*, odroute_id_t*);
|
||||
od_routepool_match(odroute_pool_t*, od_routeid_t*);
|
||||
|
||||
od_server_t*
|
||||
od_routepool_pop(odroute_pool_t*, od_serverstate_t);
|
||||
|
|
|
@ -54,7 +54,7 @@ od_route(odpooler_t *pooler, so_bestartup_t *startup)
|
|||
if (route_scheme == NULL)
|
||||
return NULL;
|
||||
}
|
||||
odroute_id_t id = {
|
||||
od_routeid_t id = {
|
||||
.database = startup->database,
|
||||
.database_len = startup->database_len,
|
||||
.user = startup->user,
|
||||
|
|
Loading…
Reference in New Issue