MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
Public 成员函数 | Private 成员函数 | Private 属性 | 友元 | 所有成员列表
InternalIndexNodeHandler类 参考

内部节点的操作 更多...

#include <bplus_tree.h>

类 InternalIndexNodeHandler 继承关系图:
IndexNodeHandler

Public 成员函数

 InternalIndexNodeHandler (const IndexFileHeader &header, Frame *frame)
 
void init_empty ()
 
void create_new_root (PageNum first_page_num, const char *key, PageNum page_num)
 
void insert (const char *key, PageNum page_num, const KeyComparator &comparator)
 
RC move_half_to (LeafIndexNodeHandler &other, DiskBufferPool *bp)
 
char * key_at (int index)
 
PageNum value_at (int index)
 
int value_index (PageNum page_num)
 
void set_key_at (int index, const char *key)
 
void remove (int index)
 
int lookup (const KeyComparator &comparator, const char *key, bool *found=nullptr, int *insert_position=nullptr) const
 
RC move_to (InternalIndexNodeHandler &other, DiskBufferPool *disk_buffer_pool)
 
RC move_first_to_end (InternalIndexNodeHandler &other, DiskBufferPool *disk_buffer_pool)
 
RC move_last_to_front (InternalIndexNodeHandler &other, DiskBufferPool *bp)
 
RC move_half_to (InternalIndexNodeHandler &other, DiskBufferPool *bp)
 
bool validate (const KeyComparator &comparator, DiskBufferPool *bp) const
 
- Public 成员函数 继承自 IndexNodeHandler
 IndexNodeHandler (const IndexFileHeader &header, Frame *frame)
 
void init_empty (bool leaf)
 
bool is_leaf () const
 
int key_size () const
 
int value_size () const
 
int item_size () const
 
void increase_size (int n)
 
int size () const
 
int max_size () const
 
int min_size () const
 
void set_parent_page_num (PageNum page_num)
 
PageNum parent_page_num () const
 
PageNum page_num () const
 
bool is_safe (BplusTreeOperationType op, bool is_root_node)
 
bool validate () const
 

Private 成员函数

RC copy_from (const char *items, int num, DiskBufferPool *disk_buffer_pool)
 
RC append (const char *item, DiskBufferPool *bp)
 
RC preappend (const char *item, DiskBufferPool *bp)
 
char * __item_at (int index) const
 
char * __key_at (int index) const
 
char * __value_at (int index) const
 
int value_size () const
 
int item_size () const
 

Private 属性

InternalIndexNodeinternal_node_ = nullptr
 

友元

std::string to_string (const InternalIndexNodeHandler &handler, const KeyPrinter &printer)
 

额外继承的成员函数

- Protected 属性 继承自 IndexNodeHandler
const IndexFileHeaderheader_
 
PageNum page_num_
 
IndexNodenode_
 

详细描述

内部节点的操作

成员函数说明

◆ copy_from()

RC InternalIndexNodeHandler::copy_from ( const char *  items,
int  num,
DiskBufferPool disk_buffer_pool 
)
private

copy items from other node to self's right

◆ insert()

void InternalIndexNodeHandler::insert ( const char *  key,
PageNum  page_num,
const KeyComparator comparator 
)

insert one entry the entry to be inserted will never at the first slot. the right child page after split will always have bigger keys.

◆ lookup()

int InternalIndexNodeHandler::lookup ( const KeyComparator comparator,
const char *  key,
bool *  found = nullptr,
int *  insert_position = nullptr 
) const

与Leaf节点不同,lookup返回指定key应该属于哪个子节点,返回这个子节点在当前节点中的索引 如果想要返回插入位置,就提供 insert_position 参数

参数
[in]comparator用于键值比较的函数
[in]key查找的键值
[out]found如果是有效指针,将会返回当前是否存在指定的键值
[out]insert_position如果是有效指针,将会返回可以插入指定键值的位置

lookup the first item which key <= item

返回
unlike the leafNode, the return value is not the insert position, but only the index of child to find.

◆ value_index()

int InternalIndexNodeHandler::value_index ( PageNum  page_num)

返回指定子节点在当前节点中的索引


该类的文档由以下文件生成: