This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-maat/src/inc_internal/maat_rule.h

92 lines
2.0 KiB
C
Raw Normal View History

2022-11-17 05:05:35 +08:00
/*
**********************************************************************************************
* File: maat_rule.h
* Description: maat rule entry
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
* Date: 2022-10-31
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#ifndef _MAAT_RULE_H_
#define _MAAT_RULE_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
#include <sys/time.h>
#include <pthread.h>
struct maat_runtime {
/* maat_runtime can be created and destroy dynamic, so need version info */
2022-11-25 16:32:29 +08:00
long long version;
2022-11-17 05:05:35 +08:00
time_t last_update_time;
2022-11-25 16:32:29 +08:00
struct table_runtime_manager *table_rt_mgr;
2022-11-17 05:05:35 +08:00
size_t max_table_num;
2022-11-25 16:32:29 +08:00
size_t max_thread_num;
2022-11-17 05:05:35 +08:00
uint32_t rule_num;
};
2022-11-25 16:32:29 +08:00
enum data_source {
DATA_SOURCE_NONE = 0,
DATA_SOURCE_IRIS_FILE
2022-11-17 05:05:35 +08:00
};
2022-11-25 16:32:29 +08:00
struct source_iris_ctx {
2022-11-17 05:05:35 +08:00
char inc_dir[NAME_MAX];
char full_dir[NAME_MAX];
};
struct maat {
2022-11-25 16:32:29 +08:00
char instance_name[NAME_MAX];
2022-11-17 05:05:35 +08:00
struct maat_runtime *maat_rt;
2022-11-25 16:32:29 +08:00
struct maat_runtime *creating_maat_rt;
struct table_schema_manager *table_schema_mgr;
2022-11-17 05:05:35 +08:00
2022-11-25 16:32:29 +08:00
enum data_source input_mode;
2022-11-17 05:05:35 +08:00
union {
2022-11-25 16:32:29 +08:00
struct source_iris_ctx iris_ctx;
2022-11-17 05:05:35 +08:00
};
2022-11-25 16:32:29 +08:00
int deferred_load;
2022-11-17 05:05:35 +08:00
int is_running;
pthread_mutex_t background_update_mutex;
int nr_worker_thread;
2022-11-25 16:32:29 +08:00
long long maat_version;
long long last_full_version;
2022-11-17 05:05:35 +08:00
pthread_t cfg_mon_thread;
2022-11-25 16:32:29 +08:00
int rule_effect_interval_ms;
int rule_update_checking_interval_ms;
int gc_timeout_ms; //garbage collection timeout_ms;
struct maat_garbage_bin *garbage_bin;
2022-11-17 05:05:35 +08:00
};
2022-11-25 16:32:29 +08:00
void maat_start_cb(long long new_version, int update_type, void *u_para);
int maat_update_cb(const char *table_name, const char *line, void *u_para);
void maat_finish_cb(void *u_para);
2022-11-17 05:05:35 +08:00
void *rule_monitor_loop(void *arg);
2022-11-25 16:32:29 +08:00
void maat_read_full_config(struct maat *maat_instance);
2022-11-17 05:05:35 +08:00
#ifdef __cpluscplus
}
#endif
#endif