plugin table support integer&pointer key type
This commit is contained in:
@@ -25,7 +25,6 @@ struct ex_data_runtime {
|
||||
size_t cache_size;
|
||||
|
||||
struct rcu_hash_table *htable;
|
||||
struct ex_data_schema *ref_ex_schema;
|
||||
struct maat_garbage_bin *ref_garbage_bin;
|
||||
int table_id;
|
||||
|
||||
@@ -158,16 +157,6 @@ void ex_data_schema_free(struct ex_data_schema *ex_schema)
|
||||
|
||||
}
|
||||
|
||||
void ex_data_runtime_set_schema(struct ex_data_runtime *ex_data_rt,
|
||||
struct ex_data_schema *schema)
|
||||
{
|
||||
if (NULL == ex_data_rt) {
|
||||
return;
|
||||
}
|
||||
|
||||
ex_data_rt->ref_ex_schema = schema;
|
||||
}
|
||||
|
||||
void ex_data_runtime_set_ex_container_schema(struct ex_data_runtime *ex_data_rt,
|
||||
struct ex_container_schema *container_schema)
|
||||
{
|
||||
@@ -188,14 +177,15 @@ ex_data_runtime_get_ex_container_schema(struct ex_data_runtime *ex_data_rt)
|
||||
return (struct ex_container_schema *)rcu_hash_get_user_ctx(ex_data_rt->htable);
|
||||
}
|
||||
|
||||
void *ex_data_runtime_row2ex_data(struct ex_data_runtime *ex_data_rt, const char *row,
|
||||
const char *key, size_t key_len)
|
||||
void *ex_data_runtime_row2ex_data(struct ex_data_runtime *ex_data_rt,
|
||||
struct ex_data_schema *ex_schema,
|
||||
const char *row, const char *key,
|
||||
size_t key_len)
|
||||
{
|
||||
void *ex_data = NULL;
|
||||
struct ex_data_schema *ex_schema = ex_data_rt->ref_ex_schema;
|
||||
|
||||
ex_schema->new_func(ex_data_rt->table_id, key, row, &ex_data,
|
||||
ex_schema->argl, ex_schema->argp);
|
||||
|
||||
return ex_data;
|
||||
}
|
||||
|
||||
@@ -252,7 +242,8 @@ int ex_data_runtime_del_ex_container(struct ex_data_runtime *ex_data_rt,
|
||||
return rcu_hash_del(ex_data_rt->htable, key, key_len);
|
||||
}
|
||||
|
||||
void *ex_data_runtime_get_ex_data_by_key(struct ex_data_runtime *ex_data_rt,
|
||||
void *ex_data_runtime_get_ex_data_by_key(struct ex_data_runtime *ex_data_rt,
|
||||
struct ex_data_schema *ex_schema,
|
||||
const char *key, size_t key_len)
|
||||
{
|
||||
struct ex_container *ex_container = NULL;
|
||||
@@ -264,21 +255,18 @@ void *ex_data_runtime_get_ex_data_by_key(struct ex_data_runtime *ex_data_rt,
|
||||
}
|
||||
|
||||
void *dup_ex_data = NULL;
|
||||
ex_data_rt->ref_ex_schema->dup_func(ex_data_rt->table_id, &dup_ex_data,
|
||||
&(ex_container->ex_data),
|
||||
ex_data_rt->ref_ex_schema->argl,
|
||||
ex_data_rt->ref_ex_schema->argp);
|
||||
ex_schema->dup_func(ex_data_rt->table_id, &dup_ex_data, &(ex_container->ex_data),
|
||||
ex_schema->argl, ex_schema->argp);
|
||||
return dup_ex_data;
|
||||
}
|
||||
|
||||
void *ex_data_runtime_get_ex_data_by_container(struct ex_data_runtime *ex_data_rt,
|
||||
void *ex_data_runtime_get_ex_data_by_container(struct ex_data_runtime *ex_data_rt,
|
||||
struct ex_data_schema *ex_schema,
|
||||
struct ex_container *ex_container)
|
||||
{
|
||||
void *dup_ex_data = NULL;
|
||||
ex_data_rt->ref_ex_schema->dup_func(ex_data_rt->table_id, &dup_ex_data,
|
||||
&(ex_container->ex_data),
|
||||
ex_data_rt->ref_ex_schema->argl,
|
||||
ex_data_rt->ref_ex_schema->argp);
|
||||
ex_schema->dup_func(ex_data_rt->table_id, &dup_ex_data, &(ex_container->ex_data),
|
||||
ex_schema->argl, ex_schema->argp);
|
||||
return dup_ex_data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user