forked from lei.chen/myxce
use librtti for worker/queue/resource
This commit is contained in:
parent
532c68e6e1
commit
2ee87d4ee6
23 changed files with 1078 additions and 396 deletions
0
src/include/configobj.h
Normal file
0
src/include/configobj.h
Normal 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
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@
|
|||
#include "xlist.h"
|
||||
#include "zarray.h"
|
||||
|
||||
typedef enum {
|
||||
KVMGR_KEY_INT = 0,
|
||||
KVMGR_KEY_STRING
|
||||
} kvmgr_key_type_t;
|
||||
|
||||
typedef struct {
|
||||
mylock_t lock;
|
||||
htab_t htab;
|
||||
|
|
@ -65,4 +70,12 @@ extern worker_t* workermgr_lock(workermgr_t*, char*, int);
|
|||
extern worker_t* workermgr_lock_byid(workermgr_t*, int, int);
|
||||
extern void workermgr_del(workermgr_t*, worker_t*);
|
||||
|
||||
typedef struct {
|
||||
kvmgr_key_type_t key_type;
|
||||
unsigned int dynamic : 1;
|
||||
uint32_t nslots;
|
||||
uint32_t delta;
|
||||
destroy_fn_t datakiller;
|
||||
} kvmgr_params_t;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
9
src/include/qobj.h
Normal file
9
src/include/qobj.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#if !defined(_QOBJ_H_)
|
||||
|
||||
#define _QOBJ_H_ 1
|
||||
|
||||
#include "xce/types.h"
|
||||
|
||||
extern xce_queue_t *makeQueue(xce_queue_t*);
|
||||
|
||||
#endif
|
||||
0
src/include/resobj.h
Normal file
0
src/include/resobj.h
Normal file
9
src/include/wobj.h
Normal file
9
src/include/wobj.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#if !defined(_WOBBJ_H_)
|
||||
|
||||
#define _WOBJ_H_ 1
|
||||
|
||||
#include "xce/types.h"
|
||||
|
||||
extern xce_worker_t* makeWorker(xce_worker_t*);
|
||||
|
||||
#endif
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
#define _ZARRAY_H_ 1
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <rtti.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "mylock.h"
|
||||
#include "xlist.h"
|
||||
|
|
@ -36,7 +36,10 @@ extern void* zarray_get(zarray_t*, int);
|
|||
extern void* zarray_find(zarray_t*, zarray_find_cond_fn_t, ...);
|
||||
extern void zarray_fini(zarray_t*);
|
||||
|
||||
typedef void (*xzarray_item_killer_t)(void *);
|
||||
typedef struct {
|
||||
int delta;
|
||||
destroy_fn_t datakiller;
|
||||
} xzarray_params_t;
|
||||
|
||||
extern typeinfo_t xzarray_type;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue