2023-01-30 21:59:35 +08:00
|
|
|
/*
|
|
|
|
|
**********************************************************************************************
|
|
|
|
|
* File: maat_expr.h
|
|
|
|
|
* Description:
|
|
|
|
|
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
|
|
|
|
* Date: 2022-10-31
|
|
|
|
|
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
|
|
|
|
***********************************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _MAAT_EXPR_H_
|
|
|
|
|
#define _MAAT_EXPR_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "log/log.h"
|
|
|
|
|
#include "cJSON/cJSON.h"
|
|
|
|
|
|
|
|
|
|
struct expr_runtime;
|
|
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
void *expr_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
|
|
|
|
const char *table_name, struct log_handle *logger);
|
2023-01-30 21:59:35 +08:00
|
|
|
void expr_schema_free(void *expr_schema);
|
|
|
|
|
|
|
|
|
|
/* expr runtime API */
|
2023-02-03 17:28:14 +08:00
|
|
|
void *expr_runtime_new(void *expr_schema, int max_thread_num,
|
|
|
|
|
struct maat_garbage_bin *garbage_bin,
|
2023-01-31 20:39:53 +08:00
|
|
|
struct log_handle *logger);
|
2023-01-30 21:59:35 +08:00
|
|
|
void expr_runtime_free(void *expr_runtime);
|
|
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
int expr_runtime_update(void *expr_runtime, void *expr_schema,
|
|
|
|
|
const char *line, int valid_column);
|
2023-02-09 22:13:15 +08:00
|
|
|
int expr_runtime_commit(void *expr_runtime, const char *table_name);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
|
|
|
|
/* expr runtime scan API */
|
|
|
|
|
/**
|
|
|
|
|
* @brief scan string to get hit group_ids
|
|
|
|
|
*
|
|
|
|
|
* @retval the num of hit group_id
|
|
|
|
|
*/
|
2023-02-03 17:28:14 +08:00
|
|
|
int expr_runtime_scan_string(struct expr_runtime *expr_rt, int thread_id,
|
2023-02-07 11:25:31 +08:00
|
|
|
const char *data, size_t data_len,
|
2023-02-03 17:28:14 +08:00
|
|
|
int *group_ids, size_t group_ids_size,
|
2023-02-07 11:25:31 +08:00
|
|
|
int vtable_ids, struct maat_state *state);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
|
|
|
|
void expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id);
|
2023-02-07 11:25:31 +08:00
|
|
|
int expr_runtime_scan_stream(struct expr_runtime *expr_rt, const char *data,
|
|
|
|
|
size_t data_len, int *group_ids, size_t group_ids_size,
|
|
|
|
|
int vtable_id, struct maat_state *state);
|
2023-01-30 21:59:35 +08:00
|
|
|
void expr_runtime_stream_close(struct expr_runtime *expr_rt);
|
|
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
void expr_runtime_scan_hit_inc(struct expr_runtime *expr_rt, int thread_id);
|
|
|
|
|
long long expr_runtime_scan_hit_sum(struct expr_runtime *expr_rt, int n_thread);
|
|
|
|
|
|
2023-01-30 21:59:35 +08:00
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|