mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: stktable: check if a type should be used as-is
stick table types now have an extra bit named 'as_is' that allows us to check if such type should be used as-is or if it may be involved in arithmetic operations such as counters. This can be useful since those types are not common and may require specific handling. e.g.: stktable_data_types[data_type].as_is will be set to 1 if the type cannot be used in arithmetic operations.
This commit is contained in:
parent
b8c19f877a
commit
db0cb54f81
@ -127,6 +127,7 @@ struct stktable_data_type {
|
||||
int arg_type; /* type of optional argument, ARG_T_* */
|
||||
uint is_array:1; /* this is an array of gpc/gpt */
|
||||
uint is_local:1; /* this is local only and never learned */
|
||||
uint as_is:1; /* cannot be processed / used with arithmetic operations */
|
||||
};
|
||||
|
||||
/* stick table keyword type */
|
||||
|
@ -1316,8 +1316,8 @@ int stktable_compatible_sample(struct sample_expr *expr, unsigned long table_typ
|
||||
* at run time.
|
||||
*/
|
||||
struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = {
|
||||
[STKTABLE_DT_SERVER_ID] = { .name = "server_id", .std_type = STD_T_SINT },
|
||||
[STKTABLE_DT_GPT0] = { .name = "gpt0", .std_type = STD_T_UINT },
|
||||
[STKTABLE_DT_SERVER_ID] = { .name = "server_id", .std_type = STD_T_SINT, .as_is = 1 },
|
||||
[STKTABLE_DT_GPT0] = { .name = "gpt0", .std_type = STD_T_UINT, .as_is = 1 },
|
||||
[STKTABLE_DT_GPC0] = { .name = "gpc0", .std_type = STD_T_UINT },
|
||||
[STKTABLE_DT_GPC0_RATE] = { .name = "gpc0_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||
[STKTABLE_DT_CONN_CNT] = { .name = "conn_cnt", .std_type = STD_T_UINT },
|
||||
@ -1335,10 +1335,10 @@ struct stktable_data_type stktable_data_types[STKTABLE_DATA_TYPES] = {
|
||||
[STKTABLE_DT_BYTES_OUT_RATE]= { .name = "bytes_out_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||
[STKTABLE_DT_GPC1] = { .name = "gpc1", .std_type = STD_T_UINT },
|
||||
[STKTABLE_DT_GPC1_RATE] = { .name = "gpc1_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||
[STKTABLE_DT_SERVER_KEY] = { .name = "server_key", .std_type = STD_T_DICT },
|
||||
[STKTABLE_DT_SERVER_KEY] = { .name = "server_key", .std_type = STD_T_DICT, .as_is = 1 },
|
||||
[STKTABLE_DT_HTTP_FAIL_CNT] = { .name = "http_fail_cnt", .std_type = STD_T_UINT },
|
||||
[STKTABLE_DT_HTTP_FAIL_RATE]= { .name = "http_fail_rate", .std_type = STD_T_FRQP, .arg_type = ARG_T_DELAY },
|
||||
[STKTABLE_DT_GPT] = { .name = "gpt", .std_type = STD_T_UINT, .is_array = 1 },
|
||||
[STKTABLE_DT_GPT] = { .name = "gpt", .std_type = STD_T_UINT, .is_array = 1, .as_is = 1 },
|
||||
[STKTABLE_DT_GPC] = { .name = "gpc", .std_type = STD_T_UINT, .is_array = 1 },
|
||||
[STKTABLE_DT_GPC_RATE] = { .name = "gpc_rate", .std_type = STD_T_FRQP, .is_array = 1, .arg_type = ARG_T_DELAY },
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user