#ifndef	__DORIS_SERVER_SCANDIR_H__
#define	__DORIS_SERVER_SCANDIR_H__

#include "doris_client.h"

#define	CM_MAX_TABLE_NUM	256
#define	MAX_CONFIG_FN_LEN	256
#define	MAX_CONFIG_LINE		(1024*16)
#define	MAX_USERREGION_LEN  4096

#define ONCE_BUF_SIZE 1048576

enum DORIS_UPDATE_TYPE
{
	CFG_UPDATE_TYPE_NONE=0,
	CFG_UPDATE_TYPE_FULL=1,
	CFG_UPDATE_TYPE_INC=2,
	CFG_UPDATE_TYPE_ERR=-1,
};

struct index_version_array
{
	int32_t file_inx;
	int64_t version;
};

struct index_path_array
{
	char path[MAX_CONFIG_FN_LEN];
	int64_t version;
};

struct cfg_table_info
{
	char table_name[MAX_CONFIG_FN_LEN];
	char cfg_path[MAX_CONFIG_FN_LEN];
	int cfg_num;
	size_t filesize;
	char user_region[MAX_USERREGION_LEN];
};

struct doris_idxfile_scanner
{
	int64_t cur_version;
	char oncebuf[ONCE_BUF_SIZE];
};

struct doris_idxfile_scanner *doris_index_file_scanner(int64_t start_version);
enum DORIS_UPDATE_TYPE doris_index_file_traverse(struct doris_idxfile_scanner *scanner, const char*idx_dir,
	struct doris_callbacks *doris_cbs, const char* dec_key, void* logger);

#endif

