compile_id,group_id,item_id support uint64_t
This commit is contained in:
@@ -28,7 +28,7 @@ struct maat_cmd_line
|
||||
{
|
||||
const char *table_name;
|
||||
const char *table_line;
|
||||
int rule_id; // for MAAT_OP_DEL, only rule_id and table_name are necessary.
|
||||
uint64_t rule_id; // for MAAT_OP_DEL, only rule_id and table_name are necessary.
|
||||
int expire_after; //expired after $timeout$ seconds, set to 0 for never timeout.
|
||||
};
|
||||
|
||||
@@ -41,6 +41,8 @@ struct maat_cmd_line
|
||||
*/
|
||||
int maat_cmd_set_line(struct maat *maat_instance, const struct maat_cmd_line *line_rule);
|
||||
|
||||
long long maat_cmd_incrby(struct maat *maat_instance, const char *key, int increment);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -53,7 +53,7 @@ int compile_table_set_rule_ex_data_schema(struct compile_schema *compile_schema,
|
||||
maat_rule_ex_dup_func_t *dup_func,
|
||||
long argl, void *argp,
|
||||
struct log_handle *logger);
|
||||
void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, int compile_id, size_t idx);
|
||||
void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, uint64_t compile_id, size_t idx);
|
||||
void compile_table_rule_ex_data_iterate(struct compile_schema *compile_schema, int idx);
|
||||
|
||||
size_t compile_table_rule_ex_data_schema_count(struct compile_schema *compile_schema);
|
||||
@@ -68,7 +68,7 @@ int compile_runtime_update(void *compile_runtime, void *compile_schema,
|
||||
const char *line, int valid_column);
|
||||
int compile_runtime_commit(void *compile_runtime, const char *table_name);
|
||||
|
||||
int compile_runtime_match(struct compile_runtime *compile_rt, int *compile_ids,
|
||||
int compile_runtime_match(struct compile_runtime *compile_rt, uint64_t *compile_ids,
|
||||
size_t compile_ids_size, struct maat_state *state);
|
||||
|
||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
|
||||
@@ -92,8 +92,7 @@ struct maat_compile_state *maat_compile_state_new(int thread_id);
|
||||
void maat_compile_state_free(struct maat_compile_state *compile_state);
|
||||
|
||||
int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
|
||||
int *hit_item_ids, size_t hit_item_cnt,
|
||||
int *group_ids, int hit_group_index, size_t group_ids_size,
|
||||
uint64_t *hit_item_ids, size_t hit_item_cnt,
|
||||
size_t *n_hit_group_id, struct maat_state *state);
|
||||
|
||||
int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state);
|
||||
|
||||
@@ -45,12 +45,10 @@ int expr_runtime_commit(void *expr_runtime, const char *table_name);
|
||||
* @retval the num of hit group_id
|
||||
*/
|
||||
int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id, const char *data,
|
||||
size_t data_len, int *group_ids, int hit_group_index,
|
||||
size_t group_ids_size, int vtable_ids, struct maat_state *state);
|
||||
size_t data_len, int vtable_ids, struct maat_state *state);
|
||||
|
||||
void expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id);
|
||||
int expr_runtime_stream_scan(struct expr_runtime *expr_rt, const char *data, size_t data_len,
|
||||
int *group_ids, int hit_group_index, size_t group_ids_size,
|
||||
int expr_runtime_stream_scan(struct expr_runtime *expr_rt, const char *data, size_t data_len,
|
||||
int vtable_id, struct maat_state *state);
|
||||
void expr_runtime_stream_close(struct expr_runtime *expr_rt);
|
||||
|
||||
|
||||
@@ -46,8 +46,7 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name);
|
||||
*
|
||||
* @retval the num of hit group_id
|
||||
*/
|
||||
int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, uint64_t flag,
|
||||
int *group_ids, int hit_group_index,size_t group_ids_size,
|
||||
int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, uint64_t flag,
|
||||
int vtable_id, struct maat_state *state);
|
||||
|
||||
void flag_runtime_scan_hit_inc(struct flag_runtime *flag_rt, int thread_id);
|
||||
|
||||
@@ -16,6 +16,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "cJSON/cJSON.h"
|
||||
#include "maat_kv.h"
|
||||
|
||||
@@ -38,13 +40,13 @@ void group2group_runtime_free(void *g2g_runtime);
|
||||
void maat_group_ref_inc(struct maat_group *group);
|
||||
void maat_group_ref_dec(struct maat_group *group);
|
||||
|
||||
struct maat_group *group2group_runtime_add_group(void *g2g_runtime, int group_id);
|
||||
struct maat_group *group2group_runtime_add_group(void *g2g_runtime, uint64_t group_id);
|
||||
void group2group_runtime_remove_group(void *g2g_runtime, struct maat_group *group);
|
||||
struct maat_group *group2group_runtime_find_group(void *g2g_runtime, int group_id);
|
||||
struct maat_group *group2group_runtime_find_group(void *g2g_runtime, uint64_t group_id);
|
||||
|
||||
int group2group_runtime_build_top_groups(void *g2g_runtime);
|
||||
int group2group_runtime_get_top_groups(void *g2g_runtime, int *group_ids,
|
||||
size_t n_group_ids, int *top_group_ids);
|
||||
int group2group_runtime_get_top_groups(void *g2g_runtime, uint64_t *group_ids,
|
||||
size_t n_group_ids, uint64_t *top_group_ids);
|
||||
|
||||
int group2group_runtime_update(void *g2g_runtime, void *g2g_schema,
|
||||
const char *line, int valid_column);
|
||||
|
||||
@@ -47,8 +47,7 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name);
|
||||
* @retval the num of hit group_id
|
||||
*/
|
||||
int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id,
|
||||
uint64_t integer, int *group_ids, int hit_group_index,
|
||||
size_t group_ids_size, int vtable_id, struct maat_state *state);
|
||||
uint64_t integer, int vtable_id, struct maat_state *state);
|
||||
|
||||
void interval_runtime_scan_hit_inc(struct interval_runtime *interval_rt, int thread_id);
|
||||
long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread);
|
||||
|
||||
@@ -41,8 +41,7 @@ struct ex_data_runtime *ip_runtime_get_ex_data_rt(struct ip_runtime *ip_rt);
|
||||
|
||||
/* ip runtime scan API */
|
||||
int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
|
||||
uint8_t *ip_addr, int *group_ids, int hit_group_index,
|
||||
size_t group_id_size, int vtable_id, struct maat_state *state);
|
||||
uint8_t *ip_addr, int vtable_id, struct maat_state *state);
|
||||
|
||||
void ip_runtime_scan_hit_inc(struct ip_runtime *ip_rt, int thread_id);
|
||||
long long ip_runtime_scan_hit_sum(struct ip_runtime *ip_rt, int n_thread);
|
||||
|
||||
@@ -64,6 +64,8 @@ size_t plugin_runtime_cached_row_count(void *plugin_runtime);
|
||||
|
||||
const char *plugin_runtime_cached_row_get(void *plugin_runtime, size_t index);
|
||||
|
||||
void *plugin_runtime_get_ex_data(void *plugin_runtime, void *plugin_schema, const char *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,7 @@ enum tag_match {
|
||||
};
|
||||
|
||||
struct maat_rule_head {
|
||||
int config_id;
|
||||
uint64_t config_id;
|
||||
char resevered;
|
||||
int serv_def_len;
|
||||
};
|
||||
@@ -69,8 +69,8 @@ struct maat_rule_head {
|
||||
#define ITEM_RULE_MAGIC 0x4d3c2b1a
|
||||
struct maat_item_inner {
|
||||
long long magic_num;
|
||||
int item_id;
|
||||
int group_id;
|
||||
uint64_t item_id;
|
||||
uint64_t group_id;
|
||||
int district_id;
|
||||
int expr_id_cnt;
|
||||
int expr_id_lb; //low boundary
|
||||
@@ -78,8 +78,8 @@ struct maat_item_inner {
|
||||
};
|
||||
|
||||
struct maat_item {
|
||||
int item_id;
|
||||
int group_id;
|
||||
uint64_t item_id;
|
||||
uint64_t group_id;
|
||||
UT_hash_handle hh;
|
||||
void *user_data;
|
||||
};
|
||||
@@ -87,7 +87,7 @@ struct maat_item {
|
||||
#define COMPILE_RULE_MAGIC 0x1a2b3c4d
|
||||
struct compile_rule {
|
||||
long long magic_num;
|
||||
int compile_id;
|
||||
uint64_t compile_id;
|
||||
struct maat_rule_head head;// fix len of Maat_rule_t
|
||||
char *service_defined;
|
||||
int declared_clause_num;
|
||||
@@ -98,8 +98,8 @@ struct compile_rule {
|
||||
};
|
||||
|
||||
struct group2group_rule {
|
||||
int group_id;
|
||||
int super_group_id;
|
||||
uint64_t group_id;
|
||||
uint64_t super_group_id;
|
||||
};
|
||||
|
||||
struct maat_runtime {
|
||||
@@ -254,11 +254,11 @@ size_t parse_accept_tag(const char *value, struct rule_tag **result, struct log_
|
||||
|
||||
int compare_accept_tag(const char *value, const struct rule_tag *accept_tags, size_t n_accept_tag);
|
||||
|
||||
struct maat_item *maat_item_new(int item_id, int group_id, void *user_data);
|
||||
struct maat_item *maat_item_new(uint64_t item_id, uint64_t group_id, void *user_data);
|
||||
|
||||
void maat_item_free(struct maat_item *item, void (* item_user_data_free)(void *));
|
||||
|
||||
struct maat_item_inner *maat_item_inner_new(int group_id, int item_id, int district_id);
|
||||
struct maat_item_inner *maat_item_inner_new(uint64_t group_id, uint64_t item_id, int district_id);
|
||||
|
||||
void maat_item_inner_free(void *item_inner);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void ipv6_ntoh(unsigned int *v6_addr);
|
||||
int get_column_pos(const char *line, int column_seq, size_t *offset, size_t *len);
|
||||
|
||||
/* the column value must be integer */
|
||||
int get_column_value(const char *line, int column_seq);
|
||||
long long get_column_value(const char *line, int column_seq);
|
||||
|
||||
int load_file_to_memory(const char *file_name, unsigned char **pp_out, size_t *out_sz);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user