diff --git a/inc/Maat_rule.h b/inc/Maat_rule.h index e52496d..0d9288f 100644 --- a/inc/Maat_rule.h +++ b/inc/Maat_rule.h @@ -153,7 +153,7 @@ enum MAAT_INIT_OPT MAAT_OPT_CMD_AUTO_NUMBERING, //VALUE is a interger *, 1 or 0, SIZE=sizeof(int). DEFAULT: 1. MAAT_OPT_DEFERRED_LOAD, //VALUE is NULL,SIZE is 0. Default: Deffered initialization OFF. MAAT_OPT_CUMULATIVE_UPDATE_OFF, //VALUE is NULL,SIZE is 0. Default: CUMMULATIVE UPDATE ON. - MAAT_OPT_LOAD_SPECIFIC_VERSION //VALUE is a long long, SIZE=sizeof(long long). Default: Load the Latest. Only valid in redis mode, and maybe failed for too old. + MAAT_OPT_LOAD_VERSION_FROM //VALUE is a long long, SIZE=sizeof(long long). Default: Load the Latest. Only valid in redis mode, and maybe failed for too old. }; //return -1 if failed, return 0 on success; int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const void* value,int size); diff --git a/src/entry/Maat_api.cpp b/src/entry/Maat_api.cpp index dec831f..9bbdc42 100644 --- a/src/entry/Maat_api.cpp +++ b/src/entry/Maat_api.cpp @@ -622,7 +622,7 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo case MAAT_OPT_CUMULATIVE_UPDATE_OFF: _feather->cumulative_update_off=1; break; - case MAAT_OPT_LOAD_SPECIFIC_VERSION: + case MAAT_OPT_LOAD_VERSION_FROM: _feather->load_from_specific_version=*((long long*)value); break; default: diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 09d1c05..0f0b11c 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -30,7 +30,7 @@ #include "stream_fuzzy_hash.h" #include "gram_index_engine.h" -int MAAT_FRAME_VERSION_2_2_20180529=1; +int MAAT_FRAME_VERSION_2_2_20180607=1; const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", "unicode_ascii_esc","unicode_ascii_aligned","unicode_ncr_dec","unicode_ncr_hex","url_encode_gb2312","url_encode_utf8",""}; diff --git a/test/maat_test.cpp b/test/maat_test.cpp index e455d8a..36e3341 100644 --- a/test/maat_test.cpp +++ b/test/maat_test.cpp @@ -303,7 +303,10 @@ int test_digest_scan(Maat_feather_t feather,const char* table_name,const char* f Maat_stream_scan_string_end(&sp); return ret; } -int test_plugin_table(Maat_feather_t feather,const char* table_name,void* logger) +int test_plugin_table(Maat_feather_t feather,const char* table_name, + Maat_start_callback_t *start,Maat_update_callback_t *update,Maat_finish_callback_t *finish, + void *u_para, + void* logger) { int table_id=0,ret=0; table_id=Maat_table_register(feather,table_name); @@ -314,10 +317,10 @@ int test_plugin_table(Maat_feather_t feather,const char* table_name,void* logger else { ret=Maat_table_callback_register(feather, table_id, - Maat_read_entry_start_cb, - Maat_read_entry_cb, - Maat_read_entry_finish_cb, - feather); + start, + update, + finish, + u_para); if(ret<0) { printf("Maat callback register table %s error.\n",table_name); @@ -602,6 +605,19 @@ void test_set_cmd_line(Maat_feather_t feather) return; } +void history_matter_cb(int table_id,const char* table_line,void* u_para) +{ +} +void test_load_specific_version(Maat_feather_t feather, const char* redis_ip, unsigned short redis_port, int redis_db,void*logger) +{ + int ret=0; + long long version=0; + const char *table_name="HISTORY_MATTER_CB"; + test_plugin_table(feather,table_name,NULL,history_matter_cb,NULL,NULL,logger); + ret=Maat_read_state(feather,MAAT_STATE_VERSION, &version, sizeof(version)); + assert(ret==0); + printf("Maat Version %lld.\n",version); +} int test_add_expr_command(Maat_feather_t feather,const char* region_table,int config_id, int timeout,int label_id, const char* keywords) { struct Maat_cmd_t* cmd=NULL; @@ -831,7 +847,6 @@ void test_command(Maat_feather_t feather) { printf("Test Maat command expire success.\n"); } - Maat_clean_status(&mid); } #define FILE_CHUNK_SIZE 4096 void test_sfh_digest(const char* filename) @@ -1013,7 +1028,12 @@ int main(int argc,char* argv[]) printf("Deferred Load ON, Waiting...\n"); sleep(1); } - test_plugin_table(feather, "QD_ENTRY_INFO",logger); + test_plugin_table(feather, "QD_ENTRY_INFO", + Maat_read_entry_start_cb, + Maat_read_entry_cb, + Maat_read_entry_finish_cb, + feather, + logger); test_string_full_scan(feather, "HTTP_URL", &mid); //not clean status here, to test_ipv4_scan make hit compile rule. @@ -1053,7 +1073,7 @@ int main(int argc,char* argv[]) Maat_clean_status(&mid); test_offset_str_scan(feather,"IMAGE_FP"); - + if(1==using_redis) { test_command(feather);