add flagMatcher and IntevalMatcher
This commit is contained in:
56
src/inc_internal/maat_flag.h
Normal file
56
src/inc_internal/maat_flag.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: maat_flag.h
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _MAAT_FLAG_H_
|
||||
#define _MAAT_FLAG_H_
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "log/log.h"
|
||||
#include "cJSON/cJSON.h"
|
||||
|
||||
struct flag_runtime;
|
||||
|
||||
void *flag_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
||||
const char *table_name, struct log_handle *logger);
|
||||
void flag_schema_free(void *flag_schema);
|
||||
|
||||
/* flag runtime API */
|
||||
void *flag_runtime_new(void *flag_schema, int max_thread_num,
|
||||
struct maat_garbage_bin *garbage_bin,
|
||||
struct log_handle *logger);
|
||||
void flag_runtime_free(void *flag_runtime);
|
||||
|
||||
int flag_runtime_update(void *flag_runtime, void *flag_schema,
|
||||
const char *line, int valid_column);
|
||||
int flag_runtime_commit(void *flag_runtime);
|
||||
|
||||
/* flag runtime scan API */
|
||||
/**
|
||||
* @brief scan flag to get hit group_ids
|
||||
*
|
||||
* @retval the num of hit group_id
|
||||
*/
|
||||
int flag_runtime_scan_flag(struct flag_runtime *flag_rt, int thread_id,
|
||||
const char *data, size_t data_len,
|
||||
int *group_ids, size_t group_ids_size,
|
||||
int vtable_id, struct maat_state *state);
|
||||
|
||||
void flag_runtime_scan_hit_inc(struct flag_runtime *flag_rt, int thread_id);
|
||||
long long flag_runtime_scan_hit_sum(struct flag_runtime *flag_rt, int n_thread);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
56
src/inc_internal/maat_intval.h
Normal file
56
src/inc_internal/maat_intval.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: maat_intval.h
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _MAAT_INTVAL_H_
|
||||
#define _MAAT_INTVAL_H_
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "log/log.h"
|
||||
#include "cJSON/cJSON.h"
|
||||
|
||||
struct intval_runtime;
|
||||
|
||||
void *intval_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
||||
const char *table_name, struct log_handle *logger);
|
||||
void _schema_free(void *intval_schema);
|
||||
|
||||
/* intval runtime API */
|
||||
void *intval_runtime_new(void *intval_schema, int max_thread_num,
|
||||
struct maat_garbage_bin *garbage_bin,
|
||||
struct log_handle *logger);
|
||||
void intval_runtime_free(void *intval_runtime);
|
||||
|
||||
int intval_runtime_update(void *intval_runtime, void *intval_schema,
|
||||
const char *line, int valid_column);
|
||||
int intval_runtime_commit(void *intval_runtime);
|
||||
|
||||
/* intval runtime scan API */
|
||||
/**
|
||||
* @brief scan intval to get hit group_ids
|
||||
*
|
||||
* @retval the num of hit group_id
|
||||
*/
|
||||
int intval_runtime_scan_intval(struct intval_runtime *intval_rt, int thread_id,
|
||||
const char *data, size_t data_len,
|
||||
int *group_ids, size_t group_ids_size,
|
||||
int vtable_id, struct maat_state *state);
|
||||
|
||||
void intval_runtime_scan_hit_inc(struct intval_runtime *intval_rt, int thread_id);
|
||||
long long intval_runtime_scan_hit_sum(struct intval_runtime *intval_rt, int n_thread);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -121,12 +121,6 @@ struct maat_runtime {
|
||||
uint32_t rule_num;
|
||||
|
||||
struct maat_garbage_bin *ref_garbage_bin;
|
||||
|
||||
struct maat_kv_store *district_map;
|
||||
struct maat_kv_store *tmp_district_map;
|
||||
|
||||
unsigned int district_num;
|
||||
|
||||
struct log_handle *logger;
|
||||
};
|
||||
|
||||
@@ -259,6 +253,7 @@ struct maat_state {
|
||||
struct maat_compile_state *compile_state;
|
||||
};
|
||||
|
||||
|
||||
size_t parse_accept_tag(const char *value, struct rule_tag **result, struct log_handle *logger);
|
||||
|
||||
int compare_accept_tag(const char *value, const struct rule_tag *accept_tags, size_t n_accept_tag);
|
||||
|
||||
@@ -21,7 +21,8 @@ extern "C"
|
||||
|
||||
enum table_type {
|
||||
TABLE_TYPE_INVALID = -1,
|
||||
TABLE_TYPE_EXPR = 0,
|
||||
TABLE_TYPE_FLAG = 0,
|
||||
TABLE_TYPE_EXPR,
|
||||
TABLE_TYPE_EXPR_PLUS,
|
||||
TABLE_TYPE_IP_PLUS,
|
||||
TABLE_TYPE_INTERVAL,
|
||||
@@ -65,7 +66,7 @@ int table_manager_accept_tags_match(struct table_manager *tbl_mgr, const char *t
|
||||
|
||||
int table_manager_set_scan_district(struct table_manager *tbl_mgr, const char *district_str,
|
||||
size_t district_str_len, int *district_id);
|
||||
|
||||
int table_manager_get_district_id(struct table_manager *tbl_mgr, const char *district);
|
||||
void *table_manager_get_schema(struct table_manager *tbl_mgr, int table_id);
|
||||
void *table_manager_get_runtime(struct table_manager *tbl_mgr, int table_id);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ void *virtual_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
||||
|
||||
void virtual_schema_free(void *virtual_schema);
|
||||
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user