MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
全部  文件 函数 变量 枚举 枚举值 宏定义  
Public 成员函数 | Private 成员函数 | Private 属性 | 所有成员列表
BplusTreeScanner类 参考

B+树的扫描器 更多...

#include <bplus_tree.h>

Public 成员函数

 BplusTreeScanner (BplusTreeHandler &tree_handler)
 
RC open (const char *left_user_key, int left_len, bool left_inclusive, const char *right_user_key, int right_len, bool right_inclusive)
 扫描指定范围的数据 更多...
 
RC next_entry (RID &rid)
 
RC close ()
 

Private 成员函数

RC fix_user_key (const char *user_key, int key_len, bool want_greater, char **fixed_key, bool *should_inclusive)
 
void fetch_item (RID &rid)
 
bool touch_end ()
 

Private 属性

bool inited_ = false
 
BplusTreeHandlertree_handler_
 
LatchMemo latch_memo_
 
Framecurrent_frame_ = nullptr
 使用左右叶子节点和位置来表示扫描的起始位置和终止位置 起始位置和终止位置都是有效的数据
 
common::MemPoolItem::unique_ptr right_key_
 
int iter_index_ = -1
 
bool first_emitted_ = false
 

详细描述

B+树的扫描器

成员函数说明

◆ fix_user_key()

RC BplusTreeScanner::fix_user_key ( const char *  user_key,
int  key_len,
bool  want_greater,
char **  fixed_key,
bool *  should_inclusive 
)
private

如果key的类型是CHARS, 扩展或缩减user_key的大小刚好是schema中定义的大小

◆ next_entry()

RC BplusTreeScanner::next_entry ( RID rid)

如果这里直接去加锁,那可能会造成死锁 因为这里访问页面的方式顺序与插入、删除的顺序不一样 如果加锁失败,就由上层做重试

◆ open()

RC BplusTreeScanner::open ( const char *  left_user_key,
int  left_len,
bool  left_inclusive,
const char *  right_user_key,
int  right_len,
bool  right_inclusive 
)

扫描指定范围的数据

参数
left_user_key扫描范围的左边界,如果是null,则没有左边界
left_lenleft_user_key 的内存大小(只有在变长字段中才会关注)
left_inclusive左边界的值是否包含在内
right_user_key扫描范围的右边界。如果是null,则没有右边界
right_lenright_user_key 的内存大小(只有在变长字段中才会关注)
right_inclusive右边界的值是否包含在内

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