支持内容外键,即某一列指向redis中的一个key,将其变成文件路径。

This commit is contained in:
zhengchao
2018-09-24 18:49:18 +08:00
parent 16ff0886c9
commit e2f4a583ad
11 changed files with 656 additions and 208 deletions

View File

@@ -8,6 +8,7 @@
#include "UniversalBoolMatch.h"
#include "Maat_rule.h"
#include "Maat_rule_internal.h"
#include "Maat_utils.h"
#include "dynamic_array.h"
#include "aligment_int64.h"
#include "config_monitor.h"
@@ -486,6 +487,8 @@ Maat_feather_t Maat_feather(int max_thread_num,const char* table_info_path,void*
feather->connect_timeout.tv_sec=0;
feather->connect_timeout.tv_usec=100*1000; // 100 ms
feather->backgroud_update_enabled=1;
feather->foreign_cont_linger=0;
snprintf(feather->foreign_cont_dir, sizeof(feather->foreign_cont_dir), "%s_files", table_info_path);
pthread_mutex_init(&(feather->backgroud_update_mutex),NULL);
pthread_mutex_init(&(feather->redis_write_lock),NULL);
snprintf(feather->table_info_fn,sizeof(feather->table_info_fn),"%s",table_info_path);
@@ -673,6 +676,16 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo
return -1;
}
break;
case MAAT_OPT_FOREIGN_CONT_DIR:
strncpy(_feather->foreign_cont_dir, (char*)value, sizeof(_feather->foreign_cont_dir));
if(_feather->foreign_cont_dir[size-1]=='/')
{
_feather->foreign_cont_dir[size-1]='\0';
}
break;
case MAAT_OPT_FOREIGN_CONT_LINGER:
_feather->foreign_cont_linger=*(int*)value;
break;
default:
return -1;
}
@@ -904,7 +917,7 @@ int Maat_table_callback_register(Maat_feather_t feather,short table_id,
//plugin table register blocks background update.
pthread_mutex_lock(&(_feather->backgroud_update_mutex));
idx=p_table->cb_info->cb_plug_cnt;
if(idx==MAX_PLUGING_NUM)
if(idx==MAX_PLUGIN_PER_TABLE)
{
pthread_mutex_unlock(&(_feather->backgroud_update_mutex));
return -1;