• Home
  • Raw
  • Download

Lines Matching refs:wdb

180 static NEOERR *wdb_alloc (WDB **wdb, int flags)  in wdb_alloc()  argument
201 *wdb = my_wdb; in wdb_alloc()
215 static NEOERR *wdb_load_defn_v1 (WDB *wdb, FILE *fp) in wdb_load_defn_v1() argument
254 err = wdb_decode_str_alloc (v, &(wdb->key)); in wdb_load_defn_v1()
259 err = wdb_decode_str_alloc (v, &(wdb->name)); in wdb_load_defn_v1()
264 wdb->last_ondisk = atoi (v); in wdb_load_defn_v1()
283 err = dictSetValue(wdb->attrs, k, v); in wdb_load_defn_v1()
306 err = dictSetValue(wdb->cols, k, col); in wdb_load_defn_v1()
309 err = uListAppend(wdb->cols_l, col); in wdb_load_defn_v1()
316 err = skipInsert (wdb->ondisk, col->ondisk_index, in wdb_load_defn_v1()
328 static NEOERR *wdb_save_defn_v1 (WDB *wdb, FILE *fp) in wdb_save_defn_v1() argument
342 err = wdb_encode_str_alloc (wdb->name, &s); in wdb_save_defn_v1()
348 err = wdb_encode_str_alloc (wdb->key, &s); in wdb_save_defn_v1()
355 r = fprintf (fp, "ondisk:%d\n", wdb->last_ondisk); in wdb_save_defn_v1()
361 s = (char *) dictNext (wdb->attrs, &key, NULL); in wdb_save_defn_v1()
374 s = (char *) dictNext (wdb->attrs, &key, NULL); in wdb_save_defn_v1()
381 len = uListLength(wdb->cols_l); in wdb_save_defn_v1()
385 err = uListGet (wdb->cols_l, x, (void *)&col); in wdb_save_defn_v1()
405 static NEOERR *wdb_load_defn (WDB *wdb, const char *name) in wdb_load_defn() argument
431 err = wdb_load_defn_v1(wdb, fp); in wdb_load_defn()
441 wdb->table_version = rand(); in wdb_load_defn()
446 static NEOERR *wdb_save_defn (WDB *wdb, const char *name) in wdb_save_defn() argument
460 err = wdb_save_defn_v1 (wdb, fp); in wdb_save_defn()
476 wdb->defn_dirty = 0; in wdb_save_defn()
477 wdb->table_version = rand(); in wdb_save_defn()
482 NEOERR *wdb_open (WDB **wdb, const char *name, int flags) in wdb_open() argument
489 *wdb = NULL; in wdb_open()
516 *wdb = my_wdb; in wdb_open()
521 NEOERR *wdb_save (WDB *wdb) in wdb_save() argument
523 if (wdb->defn_dirty) in wdb_save()
525 wdb_save_defn (wdb, wdb->path); in wdb_save()
530 void wdb_destroy (WDB **wdb) in wdb_destroy() argument
534 my_wdb = *wdb; in wdb_destroy()
586 *wdb = NULL; in wdb_destroy()
680 static NEOERR *pack_row (WDB *wdb, WDBRow *row, void **rdata, int *rdlen) in pack_row() argument
702 len = uListLength(wdb->cols_l); in pack_row()
709 err = uListGet (wdb->cols_l, x, (void *)&col); in pack_row()
746 static NEOERR *unpack_row (WDB *wdb, void *rdata, int dlen, WDBRow *row) in unpack_row() argument
765 inmem_index = (int) skipSearch (wdb->ondisk, ondisk_index, NULL); in unpack_row()
793 NEOERR *wdb_column_insert (WDB *wdb, int loc, const char *key, char type) in wdb_column_insert() argument
799 col = (WDBColumn *) dictSearch (wdb->cols, key, NULL); in wdb_column_insert()
820 col->ondisk_index = wdb->last_ondisk++; in wdb_column_insert()
824 err = dictSetValue(wdb->cols, key, col); in wdb_column_insert()
832 err = uListAppend (wdb->cols_l, (void *)col); in wdb_column_insert()
834 x = uListLength (wdb->cols_l); in wdb_column_insert()
836 err = skipInsert (wdb->ondisk, col->ondisk_index, in wdb_column_insert()
845 err = dictSetValue(wdb->cols, key, col); in wdb_column_insert()
853 err = uListInsert (wdb->cols_l, loc, (void *)col); in wdb_column_insert()
855 len = uListLength (wdb->cols_l); in wdb_column_insert()
859 err = uListGet (wdb->cols_l, x, (void *)&ocol); in wdb_column_insert()
862 err = skipInsert (wdb->ondisk, ocol->ondisk_index, in wdb_column_insert()
869 wdb->defn_dirty = 1; in wdb_column_insert()
870 wdb->table_version = rand(); in wdb_column_insert()
875 NEOERR *wdb_column_update (WDB *wdb, const char *oldkey, const char *newkey) in wdb_column_update() argument
882 ocol = (WDBColumn *) dictSearch (wdb->cols, oldkey, NULL); in wdb_column_update()
903 len = uListLength(wdb->cols_l); in wdb_column_update()
906 err = uListGet (wdb->cols_l, x, (void *)&vcol); in wdb_column_update()
910 err = uListSet (wdb->cols_l, x, (void *)col); in wdb_column_update()
920 r = dictRemove (wdb->cols, oldkey); /* Only failure is key not found */ in wdb_column_update()
921 err = dictSetValue(wdb->cols, newkey, col); in wdb_column_update()
930 wdb->defn_dirty = 1; in wdb_column_update()
931 wdb->table_version = rand(); in wdb_column_update()
936 NEOERR *wdb_column_delete (WDB *wdb, const char *name) in wdb_column_delete() argument
942 len = uListLength(wdb->cols_l); in wdb_column_delete()
945 err = uListGet (wdb->cols_l, x, (void *)&col); in wdb_column_delete()
949 err = uListDelete (wdb->cols_l, x, NULL); in wdb_column_delete()
955 r = dictRemove (wdb->cols, name); /* Only failure is key not found */ in wdb_column_delete()
961 wdb->defn_dirty = 1; in wdb_column_delete()
962 wdb->table_version = rand(); in wdb_column_delete()
967 NEOERR *wdb_column_exchange (WDB *wdb, const char *key1, const char *key2) in wdb_column_exchange() argument
974 NEOERR *wdb_update (WDB *wdb, const char *name, const char *key) in wdb_update() argument
976 if (name != NULL && strcmp(wdb->name, name)) in wdb_update()
978 if (wdb->name != NULL) in wdb_update()
979 free(wdb->name); in wdb_update()
980 wdb->name = strdup(name); in wdb_update()
981 if (wdb->name == NULL) in wdb_update()
984 wdb->defn_dirty = 1; in wdb_update()
985 wdb->table_version = rand(); in wdb_update()
987 if (key != NULL && strcmp(wdb->key, key)) in wdb_update()
989 if (wdb->key != NULL) in wdb_update()
990 free(wdb->key); in wdb_update()
991 wdb->key = strdup(key); in wdb_update()
992 if (wdb->key == NULL) in wdb_update()
994 wdb->defn_dirty = 0; in wdb_update()
998 wdb->defn_dirty = 1; in wdb_update()
999 wdb->table_version = rand(); in wdb_update()
1004 NEOERR *wdb_create (WDB **wdb, const char *path, const char *name, in wdb_create() argument
1013 *wdb = NULL; in wdb_create()
1063 *wdb = my_wdb; in wdb_create()
1068 NEOERR *wdb_attr_next (WDB *wdb, char **key, char **value) in wdb_attr_next() argument
1070 *value = (char *) dictNext (wdb->attrs, key, NULL); in wdb_attr_next()
1075 NEOERR *wdb_attr_get (WDB *wdb, const char *key, char **value) in wdb_attr_get() argument
1079 v = dictSearch (wdb->attrs, key, NULL); in wdb_attr_get()
1089 NEOERR *wdb_attr_set (WDB *wdb, const char *key, const char *value) in wdb_attr_set() argument
1098 err = dictSetValue(wdb->attrs, key, v); in wdb_attr_set()
1102 wdb->defn_dirty = 1; in wdb_attr_set()
1107 NEOERR *wdbr_get (WDB *wdb, WDBRow *row, const char *key, void **value) in wdbr_get() argument
1112 col = (WDBColumn *) dictSearch (wdb->cols, key, NULL); in wdbr_get()
1127 NEOERR *wdbr_set (WDB *wdb, WDBRow *row, const char *key, void *value) in wdbr_set() argument
1131 col = (WDBColumn *) dictSearch (wdb->cols, key, NULL); in wdbr_set()
1148 static NEOERR *alloc_row (WDB *wdb, WDBRow **row) in alloc_row() argument
1155 len = uListLength (wdb->cols_l); in alloc_row()
1162 my_row->table_version = wdb->table_version; in alloc_row()
1169 NEOERR *wdbr_destroy (WDB *wdb, WDBRow **row) in wdbr_destroy() argument
1185 if (wdb->table_version != my_row->table_version) in wdbr_destroy()
1191 len = uListLength(wdb->cols_l); in wdbr_destroy()
1197 err = uListGet (wdb->cols_l, x, (void *)&col); in wdbr_destroy()
1218 NEOERR *wdbr_lookup (WDB *wdb, const char *key, WDBRow **row) in wdbr_lookup() argument
1236 r = wdb->db->get (wdb->db, NULL, &dkey, &data, 0); in wdbr_lookup()
1243 err = alloc_row (wdb, &my_row); in wdbr_lookup()
1259 err = unpack_row (wdb, data.data, data.size, my_row); in wdbr_lookup()
1272 NEOERR *wdbr_create (WDB *wdb, const char *key, WDBRow **row) in wdbr_create() argument
1280 err = alloc_row (wdb, &my_row); in wdbr_create()
1286 wdbr_destroy (wdb, &my_row); in wdbr_create()
1295 NEOERR *wdbr_save (WDB *wdb, WDBRow *row, int flags) in wdbr_save() argument
1308 err = pack_row (wdb, row, &(data.data), &data.size); in wdbr_save()
1316 r = wdb->db->put (wdb->db, NULL, &dkey, &data, dflags); in wdbr_save()
1327 NEOERR *wdbr_delete (WDB *wdb, const char *key) in wdbr_delete() argument
1339 r = wdb->db->del (wdb->db, NULL, &dkey, 0); in wdbr_delete()
1349 NEOERR *wdbr_dump (WDB *wdb, WDBRow *row) in wdbr_dump() argument
1362 NEOERR *wdbc_create (WDB *wdb, WDBCursor **cursor) in wdbc_create() argument
1371 r = (wdb->db)->cursor (wdb->db, NULL, &db_cursor); in wdbc_create()
1373 r = (wdb->db)->cursor (wdb->db, NULL, &db_cursor, 0); in wdbc_create()
1385 new_cursor->table_version = wdb->table_version; in wdbc_create()
1393 NEOERR *wdbc_destroy (WDB *wdb, WDBCursor **cursor) in wdbc_destroy() argument
1404 NEOERR *wdbr_next (WDB *wdb, WDBCursor *cursor, WDBRow **row, int flags) in wdbr_next() argument
1413 if (wdb->table_version != cursor->table_version) in wdbr_next()
1443 err = alloc_row (wdb, &my_row); in wdbr_next()
1462 err = unpack_row (wdb, data.data, data.size, my_row); in wdbr_next()
1476 NEOERR *wdbr_find (WDB *wdb, WDBCursor *cursor, const char *key, WDBRow **row) in wdbr_find() argument
1485 if (wdb->table_version != cursor->table_version) in wdbr_find()
1505 err = alloc_row (wdb, &my_row); in wdbr_find()
1524 err = unpack_row (wdb, data.data, data.size, my_row); in wdbr_find()
1537 NEOERR *wdb_keys (WDB *wdb, char **primary_key, ULIST **data) in wdb_keys() argument
1548 my_key = strdup(wdb->key); in wdb_keys()
1552 len = uListLength(wdb->cols_l); in wdb_keys()
1562 err = uListGet (wdb->cols_l, x, (void *)&col); in wdb_keys()