use librtti for worker/queue/resource

This commit is contained in:
Rongsong Shen 2026-02-25 16:56:42 +08:00
parent 532c68e6e1
commit 2ee87d4ee6
23 changed files with 1078 additions and 396 deletions

View file

@ -3,12 +3,31 @@
#define _KV_H_ 1
#include <rtti.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
extern typeinfo_t kvtab_int64_type;
extern typeinfo_t kvtab_string_type;
extern typeinfo_t kvtab_generic_type;
typedef uint32_t (*kv_key_hash_fn_t)(void*);
typedef int (*kv_key_assign_fn_t)(void**, void*);
typedef int (*kv_key_cmp_fn_t)(void*, void*);
typedef void (*kv_key_destroy_fn_t)(void*);
typedef struct {
kv_key_hash_fn_t hash;
kv_key_assign_fn_t assign;
kv_key_cmp_fn_t cmp;
kv_key_destroy_fn_t destroy;
} kv_key_ops_t;
typedef struct {
uint32_t nslots;
kv_key_ops_t* keyops;
destroy_fn_t datakiller;
} kv_params_t;
extern typeinfo_t kvtab_type;
extern kv_key_ops_t int_key_ops;
extern kv_key_ops_t string_key_ops;
extern int key_cmp_default(void*, void*, size_t);
#endif