变更选项名称MAAT_OPT_LOAD_SPECIFIC_VERSION -> MAAT_OPT_LOAD_VERSION_FROM

This commit is contained in:
zhengchao
2018-06-07 15:45:47 +08:00
parent 613be3c03f
commit 8ab53fae3b
4 changed files with 31 additions and 11 deletions

View File

@@ -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_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_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_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; //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); int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const void* value,int size);

View File

@@ -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: case MAAT_OPT_CUMULATIVE_UPDATE_OFF:
_feather->cumulative_update_off=1; _feather->cumulative_update_off=1;
break; break;
case MAAT_OPT_LOAD_SPECIFIC_VERSION: case MAAT_OPT_LOAD_VERSION_FROM:
_feather->load_from_specific_version=*((long long*)value); _feather->load_from_specific_version=*((long long*)value);
break; break;
default: default:

View File

@@ -30,7 +30,7 @@
#include "stream_fuzzy_hash.h" #include "stream_fuzzy_hash.h"
#include "gram_index_engine.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", 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",""}; "unicode_ascii_esc","unicode_ascii_aligned","unicode_ncr_dec","unicode_ncr_hex","url_encode_gb2312","url_encode_utf8",""};

View File

@@ -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); Maat_stream_scan_string_end(&sp);
return ret; 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; int table_id=0,ret=0;
table_id=Maat_table_register(feather,table_name); 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 else
{ {
ret=Maat_table_callback_register(feather, table_id, ret=Maat_table_callback_register(feather, table_id,
Maat_read_entry_start_cb, start,
Maat_read_entry_cb, update,
Maat_read_entry_finish_cb, finish,
feather); u_para);
if(ret<0) if(ret<0)
{ {
printf("Maat callback register table %s error.\n",table_name); printf("Maat callback register table %s error.\n",table_name);
@@ -602,6 +605,19 @@ void test_set_cmd_line(Maat_feather_t feather)
return; 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) 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; struct Maat_cmd_t* cmd=NULL;
@@ -831,7 +847,6 @@ void test_command(Maat_feather_t feather)
{ {
printf("Test Maat command expire success.\n"); printf("Test Maat command expire success.\n");
} }
Maat_clean_status(&mid);
} }
#define FILE_CHUNK_SIZE 4096 #define FILE_CHUNK_SIZE 4096
void test_sfh_digest(const char* filename) void test_sfh_digest(const char* filename)
@@ -1013,7 +1028,12 @@ int main(int argc,char* argv[])
printf("Deferred Load ON, Waiting...\n"); printf("Deferred Load ON, Waiting...\n");
sleep(1); 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); test_string_full_scan(feather, "HTTP_URL", &mid);
//not clean status here, to test_ipv4_scan make hit compile rule. //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); Maat_clean_status(&mid);
test_offset_str_scan(feather,"IMAGE_FP"); test_offset_str_scan(feather,"IMAGE_FP");
if(1==using_redis) if(1==using_redis)
{ {
test_command(feather); test_command(feather);