2023-02-07 11:25:31 +08:00
|
|
|
/*
|
|
|
|
|
**********************************************************************************************
|
|
|
|
|
* File: maat_interval.h
|
|
|
|
|
* Description:
|
|
|
|
|
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
|
|
|
|
* Date: 2022-10-31
|
|
|
|
|
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
|
|
|
|
***********************************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _MAAT_INTERVAL_H_
|
|
|
|
|
#define _MAAT_INTERVAL_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include "log/log.h"
|
|
|
|
|
#include "cJSON/cJSON.h"
|
|
|
|
|
|
|
|
|
|
struct interval_runtime;
|
|
|
|
|
|
|
|
|
|
void *interval_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
|
|
|
|
const char *table_name, struct log_handle *logger);
|
|
|
|
|
void interval_schema_free(void *interval_schema);
|
|
|
|
|
|
|
|
|
|
/* interval runtime API */
|
|
|
|
|
void *interval_runtime_new(void *interval_schema, int max_thread_num,
|
|
|
|
|
struct maat_garbage_bin *garbage_bin,
|
|
|
|
|
struct log_handle *logger);
|
|
|
|
|
void interval_runtime_free(void *interval_runtime);
|
|
|
|
|
|
|
|
|
|
int interval_runtime_update(void *interval_runtime, void *interval_schema,
|
|
|
|
|
const char *line, int valid_column);
|
2023-02-09 22:13:15 +08:00
|
|
|
int interval_runtime_commit(void *interval_runtime, const char *table_name);
|
2023-02-07 11:25:31 +08:00
|
|
|
|
|
|
|
|
/* interval runtime scan API */
|
|
|
|
|
/**
|
|
|
|
|
* @brief scan intval to get hit group_ids
|
|
|
|
|
*
|
|
|
|
|
* @retval the num of hit group_id
|
|
|
|
|
*/
|
|
|
|
|
int interval_runtime_scan_intval(struct interval_runtime *interval_rt, int thread_id,
|
|
|
|
|
uint64_t integer, int *group_ids, size_t group_ids_size,
|
|
|
|
|
int vtable_id, struct maat_state *state);
|
|
|
|
|
|
|
|
|
|
void interval_runtime_scan_hit_inc(struct interval_runtime *interval_rt, int thread_id);
|
|
|
|
|
long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread);
|
|
|
|
|
|
|
|
|
|
#ifdef __cpluscplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|