#ifndef __DORIS_SERVER_RECEIVE_H__ #define __DORIS_SERVER_RECEIVE_H__ #include #include #include #include #define MONITOR_STATUS_VERSION_ERR 3 enum DORIS_SERVER_FS_FILED { DRS_FSSTAT_RECV_FULL_VER=0, DRS_FSSTAT_RECV_INC_VER, DRS_FSSTAT_RECV_ERR_VER, DRS_FSSTAT_RECV_START_FILES, DRS_FSSTAT_RECV_CMPLT_FILES, DRS_FSSTAT_CLIENT_INVALID_REQ, DRS_FSSTAT_CLIENT_META_REQ, DRS_FSSTAT_SEND_META_RES, DRS_FSSTAT_SEND_META_NONEW, DRS_FSSTAT_CLIENT_FILE_REQ, DRS_FSSTAT_SEND_FILE_RES, DRS_FSSTAT_SEND_FILE_BYTES, DRS_FSSTAT_SEND_FILE_RES_404, DRS_FSSTAT_FIELD_NUM, }; enum DORIS_SERVER_FS_STATUS { DRS_FSSTAT_MEMORY_USED=0, DRS_FSSTAT_CUR_FULL_VERSION, DRS_FSSTAT_CUR_INC_VERSION, DRS_FSSTAT_CONFIG_TOTAL_NUM, DRS_FSSTAT_STATUS_NUM, }; struct cont_frag_node { size_t start; size_t end; size_t totalsize; size_t cur_fraglen; char *content; TAILQ_ENTRY(cont_frag_node) frag_node; }; struct table_list_node { char tablename[64]; size_t filesize; size_t cur_totallen; TAILQ_HEAD(__table_cont_node, cont_frag_node) frag_head; TAILQ_ENTRY(table_list_node) table_node; }; struct version_list_node { int64_t version; char *metacont; int32_t metalen; int32_t cfg_type; //1-full, 2-inc cJSON *metajson, *arrayjson; cJSON *table_meta; TAILQ_HEAD(__table_list_node, table_list_node) table_head; TAILQ_ENTRY(version_list_node) version_node; }; struct version_list_handle { TAILQ_HEAD(__version_list_node, version_list_node) version_head; int64_t latest_version; int32_t references; }; struct version_list_handle *config_version_handle_new(void); struct doris_srv_statistics { long long field[DRS_FSSTAT_FIELD_NUM]; long long status[DRS_FSSTAT_STATUS_NUM]; }; struct worker_statistic_info { struct event timer_statistic; struct doris_srv_statistics statistic, statistic_last; }; struct confile_save { struct event_base *evbase; int64_t version; int32_t source_from; int32_t type; int64_t version_cfgnum; char inc_index_path[256]; //inc目录下的增量全量 char tmp_index_path[256]; //inc目录下的增量全量 char full_index_path[256]; //full目录下的全量 char cfg_file_path[256]; FILE *fp_cfg_file; FILE *fp_idx_file; struct worker_statistic_info statistic; struct version_list_node *cur_vernode; struct table_list_node *cur_table; struct cont_frag_node *cur_frag; }; struct common_timer_event { struct event timer_event; struct confile_save *save; void *data; }; void doris_worker_statistic_timer_cb(int fd, short kind, void *userp); void* thread_doris_client_recv_cfg(void *arg); void* thread_index_file_recv_cfg(void *arg); #endif