odissey: add route ttl

This commit is contained in:
Dmitry Simonenko 2016-11-15 15:07:58 +03:00
parent 15907724f5
commit 3725f2d3c2
5 changed files with 11 additions and 0 deletions

View File

@ -53,6 +53,7 @@ static odkeyword_t od_config_keywords[] =
od_keyword("database", OD_LDATABASE),
od_keyword("user", OD_LUSER),
od_keyword("password", OD_LPASSWORD),
od_keyword("ttl", OD_LTTL),
od_keyword("pool_min", OD_LPOOL_MIN),
od_keyword("pool_max", OD_LPOOL_MAX),
{ NULL, 0, 0 }
@ -323,6 +324,12 @@ od_configparse_route(odconfig_t *config, odtoken_t *name)
return -1;
route->password = tk->v.string;
continue;
/* ttl */
case OD_LTTL:
if (od_confignext(config, OD_LNUMBER, &tk) == -1)
return -1;
route->ttl = tk->v.num;
continue;
case OD_LEOF:
od_configerror(config, tk, "unexpected end of config file");
return -1;

View File

@ -30,6 +30,7 @@ enum {
OD_LDATABASE,
OD_LUSER,
OD_LPASSWORD,
OD_LTTL,
OD_LPOOL_MIN,
OD_LPOOL_MAX,
};

View File

@ -228,6 +228,7 @@ void od_schemeprint(odscheme_t *scheme, odlog_t *log)
od_log(log, " user '%s'", route->user);
if (route->password)
od_log(log, " password '****'");
od_log(log, " ttl %d", route->ttl);
od_log(log, " pool_min %d", route->pool_min);
od_log(log, " pool_max %d", route->pool_max);
}

View File

@ -41,6 +41,7 @@ struct odscheme_route_t {
char *database;
char *user;
char *password;
int ttl;
int client_max;
int pool_min;
int pool_max;

View File

@ -46,6 +46,7 @@ odissey {
# pool_min 0
# pool_max 100
# client_max 100
# ttl 120
# }
}
}