diskTreeComponentIterator -> diskTreeComponent::iterator
git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@671 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
parent
85ca7a935c
commit
452ee97442
7 changed files with 37 additions and 37 deletions
|
@ -748,7 +748,7 @@ void diskTreeComponent::print_tree(int xid, pageid_t pid, int64_t depth) {
|
|||
//diskTreeComponentIterator implementation
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
diskTreeComponentIterator::diskTreeComponentIterator(int xid, recordid root) {
|
||||
diskTreeComponent::iterator::iterator(int xid, recordid root) {
|
||||
if(root.page == 0 && root.slot == 0 && root.size == -1) abort();
|
||||
p = loadPage(xid,root.page);
|
||||
readlock(p->rwlatch,0);
|
||||
|
@ -787,7 +787,7 @@ diskTreeComponentIterator::diskTreeComponentIterator(int xid, recordid root) {
|
|||
justOnePage = (depth == 0);
|
||||
}
|
||||
|
||||
diskTreeComponentIterator::diskTreeComponentIterator(int xid, recordid root, const byte* key, len_t keylen) {
|
||||
diskTreeComponent::iterator::iterator(int xid, recordid root, const byte* key, len_t keylen) {
|
||||
if(root.page == NULLRID.page && root.slot == NULLRID.slot) abort();
|
||||
|
||||
p = loadPage(xid,root.page);
|
||||
|
@ -831,7 +831,7 @@ diskTreeComponentIterator::diskTreeComponentIterator(int xid, recordid root, con
|
|||
/**
|
||||
* move to the next page
|
||||
**/
|
||||
int diskTreeComponentIterator::next()
|
||||
int diskTreeComponent::iterator::next()
|
||||
{
|
||||
if(done) return 0;
|
||||
|
||||
|
@ -879,7 +879,7 @@ int diskTreeComponentIterator::next()
|
|||
}
|
||||
}
|
||||
|
||||
void diskTreeComponentIterator::close() {
|
||||
void diskTreeComponent::iterator::close() {
|
||||
|
||||
if(p) {
|
||||
unlock(p->rwlatch);
|
||||
|
|
|
@ -134,13 +134,11 @@ private:
|
|||
|
||||
DataPage<datatuple>::RegionAllocator* region_alloc;
|
||||
|
||||
};
|
||||
|
||||
class diskTreeComponentIterator {
|
||||
|
||||
public:
|
||||
diskTreeComponentIterator(int xid, recordid root);
|
||||
diskTreeComponentIterator(int xid, recordid root, const byte* key, len_t keylen);
|
||||
class iterator {
|
||||
public:
|
||||
iterator(int xid, recordid root);
|
||||
iterator(int xid, recordid root, const byte* key, len_t keylen);
|
||||
int next();
|
||||
void close();
|
||||
|
||||
|
@ -158,13 +156,14 @@ public:
|
|||
inline void tupleDone() { }
|
||||
inline void releaseLock() { }
|
||||
|
||||
private:
|
||||
private:
|
||||
Page * p;
|
||||
int xid_;
|
||||
bool done;
|
||||
recordid current;
|
||||
indexnode_rec *t;
|
||||
int justOnePage;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
#endif /* DISKTREECOMPONENT_H_ */
|
||||
|
|
|
@ -12,9 +12,9 @@ void diskTreeIterator<TUPLE>::init_iterators(TUPLE * key1, TUPLE * key2) {
|
|||
lsmIterator_ = NULL;
|
||||
} else {
|
||||
if(key1) {
|
||||
lsmIterator_ = new diskTreeComponentIterator(-1, tree_, key1->key(), key1->keylen());
|
||||
lsmIterator_ = new diskTreeComponent::iterator(-1, tree_, key1->key(), key1->keylen());
|
||||
} else {
|
||||
lsmIterator_ = new diskTreeComponentIterator(-1, tree_);
|
||||
lsmIterator_ = new diskTreeComponent::iterator(-1, tree_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ private:
|
|||
private:
|
||||
recordid tree_; //root of the tree
|
||||
|
||||
diskTreeComponentIterator* lsmIterator_;
|
||||
diskTreeComponent::iterator* lsmIterator_;
|
||||
|
||||
pageid_t curr_pageid; //current page id
|
||||
DataPage<TUPLE> *curr_page; //current page
|
||||
|
|
|
@ -595,12 +595,13 @@ int op_stat_histogram(pthread_data* data, size_t limit) {
|
|||
}
|
||||
|
||||
int xid = Tbegin();
|
||||
diskTreeComponentIterator * it = new diskTreeComponentIterator(xid, data->ltable->get_tree_c2()->get_root_rec());
|
||||
diskTreeComponent::iterator * it = new diskTreeComponent::iterator(xid, data->ltable->get_tree_c2()->get_root_rec());
|
||||
size_t count = 0;
|
||||
int err = 0;
|
||||
|
||||
while(it->next()) { count++; }
|
||||
it->close();
|
||||
delete(it);
|
||||
|
||||
uint64_t stride;
|
||||
|
||||
|
@ -619,7 +620,7 @@ int op_stat_histogram(pthread_data* data, size_t limit) {
|
|||
|
||||
size_t cur_stride = 0;
|
||||
size_t i = 0;
|
||||
it = new diskTreeComponentIterator(xid, data->ltable->get_tree_c2()->get_root_rec());
|
||||
it = new diskTreeComponent::iterator(xid, data->ltable->get_tree_c2()->get_root_rec());
|
||||
while(it->next()) {
|
||||
i++;
|
||||
if(i == count || !cur_stride) { // do we want to send this key? (this matches the first, last and interior keys)
|
||||
|
|
|
@ -24,7 +24,7 @@ int main(int argc, char **argv)
|
|||
// lsmTableHandle<PAGELAYOUT>* h = TlsmTableStart<PAGELAYOUT>(lsmTable, INVALID_COL);
|
||||
|
||||
xid = Tbegin();
|
||||
diskTreeComponentIterator * it = new diskTreeComponentIterator(xid,ltable.get_tree_c2()->get_root_rec() );
|
||||
diskTreeComponent::iterator * it = new diskTreeComponent::iterator(xid,ltable.get_tree_c2()->get_root_rec() );
|
||||
it->close();
|
||||
delete it;
|
||||
Tcommit(xid);
|
||||
|
|
|
@ -129,7 +129,7 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
|
||||
|
||||
int64_t count = 0;
|
||||
diskTreeComponentIterator * it = new diskTreeComponentIterator(xid, tree);
|
||||
diskTreeComponent::iterator * it = new diskTreeComponent::iterator(xid, tree);
|
||||
|
||||
while(it->next()) {
|
||||
byte * key;
|
||||
|
|
Loading…
Reference in a new issue