Maat JSON支持虚拟表。
This commit is contained in:
@@ -103,7 +103,7 @@ size_t pickup_hit_region_from_compile(struct bool_expr *compile_hit,
|
|||||||
group_id=(unsigned long long)dynamic_array_read(hitted_id, i);
|
group_id=(unsigned long long)dynamic_array_read(hitted_id, i);
|
||||||
for(j=0; j<compile_hit->item_num; j++)
|
for(j=0; j<compile_hit->item_num; j++)
|
||||||
{
|
{
|
||||||
if(group_id==compile_hit->items[j].item_id)
|
if(group_id==(compile_hit->items[j].item_id&0x00000000ffffffff))
|
||||||
{
|
{
|
||||||
region_pos[k]=i;
|
region_pos[k]=i;
|
||||||
k++;
|
k++;
|
||||||
@@ -204,7 +204,7 @@ int region_compile(_Maat_feather_t*feather, struct _INNER_scan_status_t *_mid, c
|
|||||||
ret=insert_set_id(&(_mid->all_hit_group_array),
|
ret=insert_set_id(&(_mid->all_hit_group_array),
|
||||||
&(_mid->all_hit_group_array_sz),
|
&(_mid->all_hit_group_array_sz),
|
||||||
_mid->all_hit_group_cnt,
|
_mid->all_hit_group_cnt,
|
||||||
group_rule->top_groups[j]);
|
(unsigned long long)region_hit_wraper->virtual_table_id<<32|group_rule->top_groups[j]);
|
||||||
_mid->all_hit_group_cnt+=ret;
|
_mid->all_hit_group_cnt+=ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2177,7 +2177,7 @@ void update_group_rule(struct Maat_table_desc* table,const char* table_line,stru
|
|||||||
table->udpate_err_cnt++;
|
table->udpate_err_cnt++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(strlen(virtual_table_name)>0&&!strcasecmp(virtual_table_name, "null"))
|
if(strlen(virtual_table_name)>0&&strcasecmp(virtual_table_name, "null"))
|
||||||
{
|
{
|
||||||
db_group_rule.virtual_table_id=Maat_table_get_id_by_name(table_mgr, virtual_table_name);
|
db_group_rule.virtual_table_id=Maat_table_get_id_by_name(table_mgr, virtual_table_name);
|
||||||
if(db_group_rule.virtual_table_id<0)
|
if(db_group_rule.virtual_table_id<0)
|
||||||
|
|||||||
@@ -888,7 +888,7 @@ int write_compile_line(cJSON *compile, struct iris_description_t *p_iris, void *
|
|||||||
set_file_rulenum(table_info->table_path,table_info->line_count,logger);
|
set_file_rulenum(table_info->table_path,table_info->line_count,logger);
|
||||||
return compile_id;
|
return compile_id;
|
||||||
}
|
}
|
||||||
int write_group_line(int group_id, int parent_id, int group_not_flag, int parent_type, struct iris_description_t *p_iris, void * logger)
|
int write_group_line(int group_id, int parent_id, int group_not_flag, int parent_type, const char* virtual_table, struct iris_description_t *p_iris, void * logger)
|
||||||
{
|
{
|
||||||
FILE*fp=NULL;
|
FILE*fp=NULL;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
@@ -908,7 +908,7 @@ int write_group_line(int group_id, int parent_id, int group_not_flag, int parent
|
|||||||
"fopen %s error %s.",p_iris->group_table->table_path,strerror(errno));
|
"fopen %s error %s.",p_iris->group_table->table_path,strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fprintf(fp,"%d\t%d\t1\t%d\t%d\n",group_id, parent_id, group_not_flag, parent_type);
|
fprintf(fp,"%d\t%d\t1\t%d\t%d\t%s\n",group_id, parent_id, group_not_flag, parent_type, virtual_table);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
p_iris->group_table->line_count++;
|
p_iris->group_table->line_count++;
|
||||||
ret=set_file_rulenum(p_iris->group_table->table_path,p_iris->group_table->line_count,logger);
|
ret=set_file_rulenum(p_iris->group_table->table_path,p_iris->group_table->line_count,logger);
|
||||||
@@ -943,7 +943,7 @@ int write_group_rule(cJSON *group_json, int parent_id, int parent_type, int trac
|
|||||||
int group_not_flag=0;
|
int group_not_flag=0;
|
||||||
cJSON *region_json=NULL, *item=NULL;
|
cJSON *region_json=NULL, *item=NULL;
|
||||||
cJSON *sub_groups=NULL, *region_rule=NULL;
|
cJSON *sub_groups=NULL, *region_rule=NULL;
|
||||||
const char* group_name=NULL;
|
const char* group_name=NULL, *virtual_table=NULL;
|
||||||
struct group_info_t *group_info=NULL;
|
struct group_info_t *group_info=NULL;
|
||||||
struct group_info_t untitled_group;
|
struct group_info_t untitled_group;
|
||||||
|
|
||||||
@@ -956,6 +956,16 @@ int write_group_rule(cJSON *group_json, int parent_id, int parent_type, int trac
|
|||||||
{
|
{
|
||||||
group_name=item->valuestring;
|
group_name=item->valuestring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item=cJSON_GetObjectItem(group_json, "virtual_table");
|
||||||
|
if(item==NULL||item->type!=cJSON_String)
|
||||||
|
{
|
||||||
|
virtual_table="null";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
virtual_table=item->valuestring;
|
||||||
|
}
|
||||||
item=cJSON_GetObjectItem(group_json,"not_flag");
|
item=cJSON_GetObjectItem(group_json,"not_flag");
|
||||||
if(item==NULL||item->type!=cJSON_Number)
|
if(item==NULL||item->type!=cJSON_Number)
|
||||||
{
|
{
|
||||||
@@ -985,7 +995,7 @@ int write_group_rule(cJSON *group_json, int parent_id, int parent_type, int trac
|
|||||||
MESA_htable_add(p_iris->group_name_map,(const unsigned char*)group_name, strlen(group_name),group_info);
|
MESA_htable_add(p_iris->group_name_map,(const unsigned char*)group_name, strlen(group_name),group_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret=write_group_line(group_info->group_id, parent_id, group_not_flag, parent_type, p_iris, logger);
|
ret=write_group_line(group_info->group_id, parent_id, group_not_flag, parent_type, virtual_table, p_iris, logger);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
{
|
{
|
||||||
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_json,
|
MESA_handle_runtime_log(logger,RLOG_LV_FATAL,maat_json,
|
||||||
|
|||||||
Reference in New Issue
Block a user