00001
00002
00003
00004 #ifndef _NMDB_H
00005 #define _NMDB_H
00006
00007 #include <stdlib.h>
00008
00010 typedef struct nmdb_conn nmdb_t;
00011
00012
00023 nmdb_t *nmdb_init();
00024
00032 int nmdb_add_tipc_server(nmdb_t *db, int port);
00033
00042 int nmdb_add_tcp_server(nmdb_t *db, const char *addr, int port);
00043
00052 int nmdb_add_udp_server(nmdb_t *db, const char *addr, int port);
00053
00062 int nmdb_add_sctp_server(nmdb_t *db, const char *addr, int port);
00063
00071 int nmdb_free(nmdb_t *db);
00072
00073
00093 ssize_t nmdb_get(nmdb_t *db, const unsigned char *key, size_t ksize,
00094 unsigned char *val, size_t vsize);
00095
00109 ssize_t nmdb_cache_get(nmdb_t *db, const unsigned char *key, size_t ksize,
00110 unsigned char *val, size_t vsize);
00111
00125 int nmdb_set(nmdb_t *db, const unsigned char *key, size_t ksize,
00126 const unsigned char *val, size_t vsize);
00127
00140 int nmdb_set_sync(nmdb_t *db, const unsigned char *key, size_t ksize,
00141 const unsigned char *val, size_t vsize);
00142
00156 int nmdb_cache_set(nmdb_t *db, const unsigned char *key, size_t ksize,
00157 const unsigned char *val, size_t vsize);
00158
00171 int nmdb_del(nmdb_t *db, const unsigned char *key, size_t ksize);
00172
00183 int nmdb_del_sync(nmdb_t *db, const unsigned char *key, size_t ksize);
00184
00196 int nmdb_cache_del(nmdb_t *db, const unsigned char *key, size_t ksize);
00197
00216 int nmdb_cas(nmdb_t *db, const unsigned char *key, size_t ksize,
00217 const unsigned char *oldval, size_t ovsize,
00218 const unsigned char *newval, size_t nvsize);
00219
00238 int nmdb_cache_cas(nmdb_t *db, const unsigned char *key, size_t ksize,
00239 const unsigned char *oldval, size_t ovsize,
00240 const unsigned char *newval, size_t nvsize);
00241
00259 int nmdb_incr(nmdb_t *db, const unsigned char *key, size_t ksize,
00260 int64_t increment, int64_t *newval);
00261
00277 int nmdb_cache_incr(nmdb_t *db, const unsigned char *key, size_t ksize,
00278 int64_t increment, int64_t *newval);
00279
00280
00308 ssize_t nmdb_firstkey(nmdb_t *db, unsigned char *key, size_t ksize);
00309
00332 ssize_t nmdb_nextkey(nmdb_t *db, const unsigned char *key, size_t ksize,
00333 unsigned char *newkey, size_t nksize);
00334
00335
00351 int nmdb_stats(nmdb_t *db, unsigned char *buf, size_t bsize,
00352 unsigned int *nservers, unsigned int *nstats);
00353
00354 #endif
00355