-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented B-tree index (Note: more testing is needed) (#46)
* btree index implementation started. * implementing bree index: WIP. * implementing bree index: added new serialization method to Value type. * implementing bree index: added testcase of BTreeIndex. * implementing bree index: added codes for finalize BLTree container. * updated bltree-go-for-embedding lib and modified testcases which uses the lib. * implementing bree index: wrote btree index except MIN and MAX key passing. testcase has not been passed. * implementing bree index: debugging (1). * implementing bree index: inserting multiple records and full scan with BTreeIndex successed. * TestKeyDuplicateInsertDeleteWithBTreeIndexInt passed! * TestKeyDuplicateInsertDeleteWithBTreeIndex{Float, Varchar} passed!
- Loading branch information
Showing
26 changed files
with
595 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package btree | ||
|
||
import ( | ||
"github.com/ryogrid/SamehadaDB/lib/samehada/samehada_util" | ||
"github.com/ryogrid/SamehadaDB/lib/storage/buffer" | ||
"github.com/ryogrid/SamehadaDB/lib/storage/index/index_common" | ||
"github.com/ryogrid/SamehadaDB/lib/storage/page" | ||
"github.com/ryogrid/SamehadaDB/lib/storage/page/skip_list_page" | ||
"github.com/ryogrid/SamehadaDB/lib/types" | ||
blink_tree "github.com/ryogrid/bltree-go-for-embedding" | ||
) | ||
|
||
type BTreeIterator struct { | ||
bltr *blink_tree.BLTree | ||
bpm *buffer.BufferPoolManager | ||
curNode *skip_list_page.SkipListBlockPage | ||
curEntry *index_common.IndexEntry | ||
rangeStartKey *types.Value | ||
rangeEndKey *types.Value | ||
keyType types.TypeID | ||
entryList []*index_common.IndexEntry | ||
curEntryIdx int32 | ||
} | ||
|
||
func NewSkipListIterator(bltr *blink_tree.BLTree, rangeStartKey *types.Value, rangeEndKey *types.Value) *BTreeIterator { | ||
ret := new(BTreeIterator) | ||
|
||
// TODO: (SDB) need to implement this | ||
panic("Not implemented yet") | ||
//headerPage := sl.getHeaderPage() | ||
// | ||
//ret.sl = sl | ||
//ret.bpm = sl.bpm | ||
// | ||
//ret.rangeStartKey = rangeStartKey | ||
//ret.rangeEndKey = rangeEndKey | ||
//ret.keyType = headerPage.GetKeyType() | ||
//ret.entryList = make([]*skip_list_page.IndexEntry, 0) | ||
// | ||
//ret.initRIDList(sl) | ||
|
||
return ret | ||
} | ||
|
||
func (itr *BTreeIterator) initRIDList(bltr *blink_tree.BLTree) { | ||
// TODO: (SDB) need to implement this | ||
panic("Not implemented yet") | ||
} | ||
|
||
func (itr *BTreeIterator) Next() (done bool, err error, key *types.Value, rid *page.RID) { | ||
// TODO: (SDB) need to implement this | ||
panic("Not implemented yet") | ||
if itr.curEntryIdx < int32(len(itr.entryList)) { | ||
ret := itr.entryList[itr.curEntryIdx] | ||
itr.curEntryIdx++ | ||
tmpRID := samehada_util.UnpackUint64toRID(ret.Value) | ||
return false, nil, samehada_util.GetPonterOfValue(ret.Key), &tmpRID | ||
} else { | ||
return true, nil, nil, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.