Commit 9f54dcef authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Rename a bunch of symbols to toku_symbols. Addresses #8.

git-svn-id: file:///svn/tokudb@823 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6b2f1c61
......@@ -34,12 +34,12 @@ void setup (void) {
int r;
unlink(fname);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(fname, 0, 1, &t, nodesize, ct, NULL_TXN, toku_default_compare_fun, (DB*)0); assert(r==0);
r = toku_open_brt(fname, 0, 1, &t, nodesize, ct, NULL_TXN, toku_default_compare_fun, (DB*)0); assert(r==0);
}
void shutdown (void) {
int r;
r = close_brt(t); assert(r==0);
r = toku_close_brt(t); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
}
void long_long_to_array (unsigned char *a, unsigned long long l) {
......@@ -55,7 +55,7 @@ void insert (long long v) {
long_long_to_array(kc, v);
memset(vc, 0, sizeof vc);
long_long_to_array(vc, v);
brt_insert(t, fill_dbt(&kt, kc, keysize), fill_dbt(&vt, vc, valsize), 0);
toku_brt_insert(t, fill_dbt(&kt, kc, keysize), fill_dbt(&vt, vc, valsize), 0);
if (do_verify) toku_cachetable_verify(ct);
}
......
......@@ -6,7 +6,7 @@ static int brt_root_put_cmd_XY (BRT brt, BRT_CMD *md, TOKUTXN txn) {
}
CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt);
if ((r=cachetable_get_and_pin(brt->cf, *rootp, &node_v, NULL,
brtnode_flush_callback, brtnode_fetch_callback, (void*)(long)brt->h->nodesize))) {
toku_brtnode_flush_callback, toku_brtnode_fetch_callback, (void*)(long)brt->h->nodesize))) {
goto died0;
}
node=node_v;
......
......@@ -119,10 +119,7 @@ int toku_serialize_brt_header_to (int fd, struct brt_header *h);
int toku_serialize_brt_header_to_wbuf (struct wbuf *, struct brt_header *h);
int toku_deserialize_brtheader_from (int fd, DISKOFF off, struct brt_header **brth);
/* return the size of a tree node */
long brtnode_size (BRTNODE node);
void brtnode_free (BRTNODE *node);
void toku_brtnode_free (BRTNODE *node);
//static inline int brtnode_n_hashtables(BRTNODE node) { if (node->height==0) return 1; else return node->u.n.n_children; }
......@@ -175,11 +172,6 @@ void toku_brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, i
/* a brt internal node has split. modify this cursor if it includes the old node in its path. */
void toku_brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
void brt_update_cursors_new_root(BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right);
void brt_update_cursors_leaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
void brt_update_cursors_nonleaf_expand(BRT t, BRTNODE oldnode, int childnum, BRTNODE left, BRTNODE right);
void brt_update_cursors_nonleaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
enum brt_cmd_type {
BRT_NONE = 0,
BRT_INSERT = 1,
......@@ -205,8 +197,8 @@ struct brtenv {
// SPINLOCK checkpointing;
};
extern cachetable_flush_func_t brtnode_flush_callback, brtheader_flush_callback;
extern cachetable_fetch_func_t brtnode_fetch_callback, brtheader_fetch_callback;
extern cachetable_flush_func_t toku_brtnode_flush_callback, toku_brtheader_flush_callback;
extern cachetable_fetch_func_t toku_brtnode_fetch_callback, toku_brtheader_fetch_callback;
extern int toku_read_and_pin_brt_header (CACHEFILE cf, struct brt_header **header);
extern int toku_unpin_brt_header (BRT brt);
extern CACHEKEY* toku_calculate_root_offset_pointer (BRT brt);
......
......@@ -91,7 +91,7 @@ void test_serialize(void) {
assert(datalen==5);
assert(type == BRT_NONE);
}
brtnode_free(&dn);
toku_brtnode_free(&dn);
kv_pair_free(sn.u.n.childkeys[0]);
toku_free(hello_string);
......
This diff is collapsed.
......@@ -62,7 +62,7 @@ int toku_verify_brtnode (BRT brt, DISKOFF off, bytevec lorange, ITEMLEN lolen, b
void *node_v;
int r;
if ((r = toku_cachetable_get_and_pin(brt->cf, off, &node_v, NULL,
brtnode_flush_callback, brtnode_fetch_callback, (void*)(long)brt->h->nodesize)))
toku_brtnode_flush_callback, toku_brtnode_fetch_callback, (void*)(long)brt->h->nodesize)))
return r;
//printf("%s:%d pin %p\n", __FILE__, __LINE__, node_v);
node=node_v;
......
This diff is collapsed.
......@@ -11,23 +11,23 @@
#include "cachetable.h"
#include "log.h"
int open_brt (const char *fname, const char *dbname, int is_create, BRT *, int nodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*);
int toku_open_brt (const char *fname, const char *dbname, int is_create, BRT *, int nodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*);
int toku_brt_create(BRT *);
int brt_set_flags(BRT, int flags);
int brt_get_flags(BRT, int *flags);
int brt_set_nodesize(BRT, int nodesize);
int brt_set_bt_compare(BRT, int (*bt_compare)(DB *, const DBT*, const DBT*));
int brt_set_dup_compare(BRT, int (*dup_compare)(DB *, const DBT*, const DBT*));
int toku_brt_set_flags(BRT, int flags);
int toku_brt_get_flags(BRT, int *flags);
int toku_brt_set_nodesize(BRT, int nodesize);
int toku_brt_set_bt_compare(BRT, int (*bt_compare)(DB *, const DBT*, const DBT*));
int toku_brt_set_dup_compare(BRT, int (*dup_compare)(DB *, const DBT*, const DBT*));
int brt_set_cachetable(BRT, CACHETABLE);
int brt_open(BRT, const char *fname, const char *fname_in_env, const char *dbname, int is_create, int only_create, CACHETABLE ct, TOKUTXN txn);
int brt_remove_subdb(BRT brt, const char *dbname, u_int32_t flags);
int brt_insert (BRT, DBT *, DBT *, TOKUTXN);
int brt_lookup (BRT brt, DBT *k, DBT *v);
int brt_delete (BRT brt, DBT *k);
int close_brt (BRT);
int dump_brt (BRT brt);
int toku_brt_open(BRT, const char *fname, const char *fname_in_env, const char *dbname, int is_create, int only_create, CACHETABLE ct, TOKUTXN txn);
int toku_brt_remove_subdb(BRT brt, const char *dbname, u_int32_t flags);
int toku_brt_insert (BRT, DBT *, DBT *, TOKUTXN);
int toku_brt_lookup (BRT brt, DBT *k, DBT *v);
int toku_brt_delete (BRT brt, DBT *k);
int toku_close_brt (BRT);
int toku_dump_brt (BRT brt);
void brt_fsync (BRT); /* fsync, but don't clear the caches. */
void brt_flush (BRT); /* fsync and clear the caches. */
......
......@@ -77,7 +77,7 @@ static void toku_recover_fheader (struct logtype_fheader *c) {
} else {
assert(0);
}
toku_cachetable_put(cf, 0, h, 0, brtheader_flush_callback, brtheader_fetch_callback, 0);
toku_cachetable_put(cf, 0, h, 0, toku_brtheader_flush_callback, toku_brtheader_fetch_callback, 0);
}
static void toku_recover_newbrtnode (struct logtype_newbrtnode *c) {
......@@ -106,7 +106,7 @@ static void toku_recover_newbrtnode (struct logtype_newbrtnode *c) {
abort();
}
// Now put it in the cachetable
toku_cachetable_put(cf, c->diskoff, n, toku_serialize_brtnode_size(n), brtnode_flush_callback, brtnode_fetch_callback, 0);
toku_cachetable_put(cf, c->diskoff, n, toku_serialize_brtnode_size(n), toku_brtnode_flush_callback, toku_brtnode_fetch_callback, 0);
r = toku_cachetable_unpin(cf, c->diskoff, 1, toku_serialize_brtnode_size(n));
assert(r==0);
}
......@@ -139,7 +139,7 @@ static void toku_recover_insertinleaf (struct logtype_insertinleaf *c) {
int r = find_cachefile(c->filenum, &cf, &brt);
assert(r==0);
void *node_v;
r = toku_cachetable_get_and_pin(cf, c->diskoff, &node_v, NULL, brtnode_flush_callback, brtnode_fetch_callback, brt);
r = toku_cachetable_get_and_pin(cf, c->diskoff, &node_v, NULL, toku_brtnode_flush_callback, toku_brtnode_fetch_callback, brt);
assert(r==0);
BRTNODE node = node_v;
assert(node->height==0);
......
......@@ -447,7 +447,7 @@ int db_env_create(DB_ENV ** envp, u_int32_t flags) {
return 0;
}
int toku_db_txn_commit(DB_TXN * txn, u_int32_t flags) {
static int toku_db_txn_commit(DB_TXN * txn, u_int32_t flags) {
//notef("flags=%d\n", flags);
if (!txn)
return -1;
......@@ -503,7 +503,7 @@ int log_compare(const DB_LSN * a, const DB_LSN * b) {
}
static int toku_db_close(DB * db, u_int32_t flags) {
int r = close_brt(db->i->brt);
int r = toku_close_brt(db->i->brt);
if (r != 0)
return r;
// printf("%s:%d %d=__toku_db_close(%p)\n", __FILE__, __LINE__, r, db);
......@@ -567,7 +567,7 @@ static int toku_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) {
return r;
free(search_val.data);
}
r = brt_delete(db->i->brt, key);
r = toku_brt_delete(db->i->brt, key);
return r;
}
......@@ -575,7 +575,7 @@ static int toku_db_get(DB * db, DB_TXN * txn __attribute__ ((unused)), DBT * key
assert(flags == 0);
int r;
int brtflags;
brt_get_flags(db->i->brt, &brtflags);
toku_brt_get_flags(db->i->brt, &brtflags);
if (brtflags & TOKU_DB_DUPSORT) {
DBC *dbc;
r = db->cursor(db, txn, &dbc, 0);
......@@ -584,7 +584,7 @@ static int toku_db_get(DB * db, DB_TXN * txn __attribute__ ((unused)), DBT * key
dbc->c_close(dbc);
}
} else
r = brt_lookup(db->i->brt, key, data);
r = toku_brt_lookup(db->i->brt, key, data);
return r;
}
......@@ -635,7 +635,7 @@ static char *construct_full_name(const char *dir, const char *fname) {
// have to inherit mode bits and so forth from the first file that was created.
// Other problems may ensue (who is responsible for deleting the file? That's not so bad actually.)
// This suggests that we really need to put the multiple databases into one file.
int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) {
static int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTYPE dbtype, u_int32_t flags, int mode) {
// Warning. Should check arguments. Should check return codes on malloc and open and so forth.
int openflags = 0;
......@@ -684,7 +684,7 @@ int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, D
db->i->open_flags = flags;
db->i->open_mode = mode;
r = brt_open(db->i->brt, db->i->full_fname, fname, dbname,
r = toku_brt_open(db->i->brt, db->i->full_fname, fname, dbname,
flags & DB_CREATE, flags & DB_EXCL,
db->dbenv->i->cachetable,
txn ? txn->i->tokutxn : NULL_TXN);
......@@ -705,13 +705,13 @@ int toku_db_open(DB * db, DB_TXN * txn, const char *fname, const char *dbname, D
return r;
}
int toku_db_put(DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_t flags) {
int r = brt_insert(db->i->brt, key, data, txn ? txn->i->tokutxn : 0);
static int toku_db_put(DB * db, DB_TXN * txn, DBT * key, DBT * data, u_int32_t flags) {
int r = toku_brt_insert(db->i->brt, key, data, txn ? txn->i->tokutxn : 0);
//printf("%s:%d %d=__toku_db_put(...)\n", __FILE__, __LINE__, r);
return r;
}
int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int32_t flags) {
static int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int32_t flags) {
int r;
int r2;
char ffull[PATH_MAX];
......@@ -724,7 +724,7 @@ int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int32_t fla
//TODO: Use master database (instead of manual edit) when implemented.
if ((r = db->open(db, NULL, fname, dbname, DB_BTREE, 0, 0777)) != 0) goto cleanup;
r = brt_remove_subdb(db->i->brt, dbname, flags);
r = toku_brt_remove_subdb(db->i->brt, dbname, flags);
cleanup:
r2 = db->close(db, 0);
return r ? r : r2;
......@@ -740,7 +740,7 @@ int toku_db_remove(DB * db, const char *fname, const char *dbname, u_int32_t fla
return r ? r : r2;
}
int toku_db_rename(DB * db, const char *namea, const char *nameb, const char *namec, u_int32_t flags) {
static int toku_db_rename(DB * db, const char *namea, const char *nameb, const char *namec, u_int32_t flags) {
char afull[PATH_MAX], cfull[PATH_MAX];
int r;
assert(nameb == 0);
......@@ -751,38 +751,36 @@ int toku_db_rename(DB * db, const char *namea, const char *nameb, const char *na
return rename(afull, cfull);
}
int toku_db_set_bt_compare(DB * db, int (*bt_compare) (DB *, const DBT *, const DBT *)) {
int r = brt_set_bt_compare(db->i->brt, bt_compare);
static int toku_db_set_bt_compare(DB * db, int (*bt_compare) (DB *, const DBT *, const DBT *)) {
int r = toku_brt_set_bt_compare(db->i->brt, bt_compare);
return r;
}
int toku_db_set_dup_compare(DB *db, int (*dup_compare)(DB *, const DBT *, const DBT *)) {
int r = brt_set_dup_compare(db->i->brt, dup_compare);
static int toku_db_set_dup_compare(DB *db, int (*dup_compare)(DB *, const DBT *, const DBT *)) {
int r = toku_brt_set_dup_compare(db->i->brt, dup_compare);
return r;
}
int toku_db_set_flags(DB * db, u_int32_t flags) {
static int toku_db_set_flags(DB * db, u_int32_t flags) {
u_int32_t tflags = 0;
if (flags & DB_DUP)
tflags += TOKU_DB_DUP;
if (flags & DB_DUPSORT)
tflags += TOKU_DB_DUPSORT;
int r= brt_set_flags(db->i->brt, tflags);
int r= toku_brt_set_flags(db->i->brt, tflags);
return r;
}
int toku_db_set_pagesize(DB *db, u_int32_t pagesize) {
int r = brt_set_nodesize(db->i->brt, pagesize);
static int toku_db_set_pagesize(DB *db, u_int32_t pagesize) {
int r = toku_brt_set_nodesize(db->i->brt, pagesize);
return r;
}
int toku_db_stat(DB * db, void *v, u_int32_t flags) {
static int toku_db_stat(DB * db, void *v, u_int32_t flags) {
barf();
abort();
}
extern int toku_default_compare_fun(DB * db, const DBT * a, const DBT * b);
int db_create(DB ** db, DB_ENV * env, u_int32_t flags) {
int r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment