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_group.h

85 lines
2.8 KiB
C
Raw Normal View History

2023-01-06 18:54:59 +08:00
/*
**********************************************************************************************
* File: maat_group.h
* Description:
* Authors: Liu wentan <liuwentan@geedgenetworks.com>
* Date: 2022-10-31
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#ifndef _MAAT_GROUP_H_
#define _MAAT_GROUP_H_
#ifdef __cpluscplus
extern "C"
{
#endif
2023-01-30 21:59:35 +08:00
#include "cJSON/cJSON.h"
#include "uthash/uthash.h"
#include "igraph/igraph.h"
#include "maat_kv.h"
2023-01-06 18:54:59 +08:00
struct maat_group {
igraph_integer_t vertex_id;
int group_id;
int ref_by_compile_cnt;
int ref_by_superior_group_cnt;
int ref_by_subordinate_group_cnt;
size_t top_group_cnt;
int *top_group_ids;
2023-01-30 21:59:35 +08:00
2023-01-06 18:54:59 +08:00
UT_hash_handle hh_group_id;
UT_hash_handle hh_vertex_id;
};
2023-01-30 21:59:35 +08:00
/* maat group topology API */
2023-01-06 18:54:59 +08:00
struct maat_group_topology;
/**
* @retval if not found, return NULL
*/
2023-01-31 20:39:53 +08:00
//struct maat_group *maat_group_topology_add_group(struct maat_group_topology *group_topo, int group_id);
//struct maat_group *maat_group_topology_find_group(struct maat_group_topology *group_topo, int group_id);
//void maat_group_topology_remove_group(struct maat_group_topology *group_topo, struct maat_group *group);
//int maat_group_topology_add_group_to_group(struct maat_group_topology *group_topo, int group_id, int superior_group_id);
//int maat_group_topology_remove_group_from_group(struct maat_group_topology *group_topo, int group_id, int superior_group_id);
2023-01-06 18:54:59 +08:00
/* build top groups */
2023-01-31 20:39:53 +08:00
//int maat_group_topology_build_top_groups(struct maat_group_topology *group_topo);
2023-01-06 18:54:59 +08:00
2023-01-30 21:59:35 +08:00
/* group2group schema API */
void *group2group_schema_new(cJSON *json, const char *table_name, struct log_handle *logger);
void group2group_schema_free(void *g2g_schema);
/* group2group runtime API */
2023-01-31 20:39:53 +08:00
void *group2group_runtime_new(void *ip_plus_schema, int max_thread_num, struct maat_garbage_bin *garbage_bin,
struct log_handle *logger);
2023-01-30 21:59:35 +08:00
void group2group_runtime_free(void *g2g_runtime);
2023-01-31 20:39:53 +08:00
struct maat_group *group2group_runtime_add_group(void *g2g_runtime, int group_id);
void group2group_runtime_remove_group(void *g2g_runtime, struct maat_group *group);
struct maat_group *group2group_runtime_find_group(void *g2g_runtime, int group_id);
int group2group_runtime_add_group_to_group(void *g2g_runtime, int group_id, int superior_group_id);
int group2group_runtime_remove_group_from_group(void *g2g_runtime, int group_id, int superior_group_id);
int group2group_runtime_build_top_groups(void *g2g_runtime);
2023-01-30 21:59:35 +08:00
int group2group_runtime_update(void *g2g_runtime, void *g2g_schema, const char *line, int valid_column);
int group2group_runtime_commit(void *g2g_runtime);
2023-01-31 20:39:53 +08:00
int group2group_runtime_get_top_groups(void *g2g_runtime, int *group_ids, size_t n_group_ids,
2023-01-30 21:59:35 +08:00
int *top_group_ids);
2023-01-06 18:54:59 +08:00
#ifdef __cpluscplus
}
#endif
#endif