diff --git a/diskTreeComponent.cpp b/diskTreeComponent.cpp index 7c033b8..05aee37 100644 --- a/diskTreeComponent.cpp +++ b/diskTreeComponent.cpp @@ -23,7 +23,7 @@ // LOGTREE implementation ///////////////////////////////////////////////////////////////// -const RegionAllocConf_t diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 }; +const diskTreeComponent::internalNodes::RegionAllocConf_t diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 }; //LSM_ROOT_PAGE diff --git a/diskTreeComponent.h b/diskTreeComponent.h index 1db4d7c..41ff56d 100644 --- a/diskTreeComponent.h +++ b/diskTreeComponent.h @@ -22,27 +22,28 @@ #include "tuplemerger.h" #include "datatuple.h" - -typedef struct RegionAllocConf_t -{ - recordid regionList; - pageid_t regionCount; - pageid_t nextPage; - pageid_t endOfRegion; - pageid_t regionSize; -} RegionAllocConf_t; - -struct indexnode_rec { - pageid_t ptr; -}; - -typedef pageid_t(*diskTreeComponent_page_allocator_t)(int, void *); -typedef void(*diskTreeComponent_page_deallocator_t)(int, void *); - class diskTreeComponent { + public: class internalNodes{ public: + struct indexnode_rec { + pageid_t ptr; + }; + + typedef struct RegionAllocConf_t + { + recordid regionList; + pageid_t regionCount; + pageid_t nextPage; + pageid_t endOfRegion; + pageid_t regionSize; + } RegionAllocConf_t; + + typedef pageid_t(*diskTreeComponent_page_allocator_t)(int, void *); + typedef void(*diskTreeComponent_page_deallocator_t)(int, void *); + + internalNodes(int xid): region_alloc(new DataPage::RegionAllocator(xid, 10000)) {create(xid);} // XXX shouldn't hardcode region size. internalNodes(int xid, recordid root, recordid state, recordid dp_state) : tree_state(state), diff --git a/logstore.cpp b/logstore.cpp index 019a539..9ed908e 100644 --- a/logstore.cpp +++ b/logstore.cpp @@ -467,7 +467,7 @@ DataPage* logtable::insertTuple(int xid, datatuple *tuple, diskTreeCo } - RegionAllocConf_t alloc_conf; + diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf; //insert the record key and id of the first page of the datapage to the diskTreeComponent Tread(xid,ltree->get_tree_state(), &alloc_conf); diskTreeComponent::internalNodes::appendPage(xid, ltree->get_root_rec(), ltree->lastLeaf, diff --git a/logstore.h b/logstore.h index f471918..8086b2b 100644 --- a/logstore.h +++ b/logstore.h @@ -107,7 +107,7 @@ public: recordid c1_dp_state; }; - const static RegionAllocConf_t DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER; + const static diskTreeComponent::internalNodes::RegionAllocConf_t DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER; logtable_mergedata * mergedata; rwl * header_lock; diff --git a/test/check_datapage.cpp b/test/check_datapage.cpp index 10f7d7f..1084f69 100644 --- a/test/check_datapage.cpp +++ b/test/check_datapage.cpp @@ -51,7 +51,7 @@ void insertProbeIter(size_t NUM_ENTRIES) DataPage::RegionAllocator * alloc = new DataPage::RegionAllocator(xid, 10000); // ~ 10 datapages per region. - recordid alloc_state = Talloc(xid,sizeof(RegionAllocConf_t)); + recordid alloc_state = Talloc(xid,sizeof(diskTreeComponent::internalNodes::RegionAllocConf_t)); Tset(xid,alloc_state, &diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER); diff --git a/test/check_logtree.cpp b/test/check_logtree.cpp index 13eb582..173e710 100644 --- a/test/check_logtree.cpp +++ b/test/check_logtree.cpp @@ -79,7 +79,7 @@ void insertProbeIter_str(int NUM_ENTRIES) //printf("TlsmAppendPage %d\n",i); recordid rid = lt->get_tree_state(); - RegionAllocConf_t alloc_conf; + diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf; Tread(xid,rid,&alloc_conf); diskTreeComponent::internalNodes::appendPage(xid, tree, lt->lastLeaf, currkey, keylen, lt->alloc_region, &alloc_conf, i + OFFSET); @@ -196,7 +196,7 @@ void insertProbeIter_int(int NUM_ENTRIES) printf("TlsmAppendPage %d\n",i); recordid rid = lt->get_tree_state(); - RegionAllocConf_t alloc_conf; + diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf; Tread(xid,rid,&alloc_conf); diskTreeComponent::internalNodes::appendPage(xid, tree, lt->lastLeaf, currkey, keylen, lt->alloc_region, &alloc_conf, i + OFFSET); diff --git a/test/check_mergetuple.cpp b/test/check_mergetuple.cpp index 1fe91cf..0b60982 100644 --- a/test/check_mergetuple.cpp +++ b/test/check_mergetuple.cpp @@ -50,8 +50,6 @@ void insertProbeIter(size_t NUM_ENTRIES) printf("size partition %d is %d\n", i+1, key_arr->size()); } - - key_v_t * key_arr = new key_v_t; std::vector iters;