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

MemTable implementation for LSM-Tree. 更多...

#include <ob_memtable.h>

类 oceanbase::ObMemTable 继承关系图:

struct  KeyComparator
 Compares two keys. 更多...
 

Public 成员函数

shared_ptr< ObMemTableget_shared_ptr ()
 Retrieves a shared pointer to the current ObMemTable instance. 更多...
 
void put (uint64_t seq, const string_view &key, const string_view &value)
 Inserts a key-value pair into the memtable. 更多...
 
size_t appro_memory_usage () const
 Estimates the memory usage of the memtable. 更多...
 
ObLsmIteratornew_iterator ()
 Creates a new iterator for traversing the contents of the memtable. 更多...
 

Private 类型

typedef ObSkipList< const char *, KeyComparatorTable
 

Private 属性

KeyComparator comparator_
 Comparator used for ordering keys in the memtable. 更多...
 
Table table_
 The underlying data structure used for key-value storage. 更多...
 
ObArena arena_
 Memory arena used for memory management in the memtable. 更多...
 

友元

class ObMemTableIterator
 

详细描述

MemTable implementation for LSM-Tree.

The ObMemTable represents an in-memory structure that stores key-value pairs before they are flushed to disk as SSTables. It supports key-value insertion, querying, and iteration. The implementation currently uses a skip list as the underlying data structure.

成员函数说明

◆ appro_memory_usage()

size_t oceanbase::ObMemTable::appro_memory_usage ( ) const
inline

Estimates the memory usage of the memtable.

Returns the approximate memory usage of the memtable, including the skip list and associated memory allocations.

返回
The approximate memory usage in bytes.

◆ get_shared_ptr()

shared_ptr< ObMemTable > oceanbase::ObMemTable::get_shared_ptr ( )
inline

Retrieves a shared pointer to the current ObMemTable instance.

This method utilizes std::enable_shared_from_this to provide a shared pointer to the current object. Useful when the current object needs to be shared safely among multiple components.

返回
A shared pointer to the current ObMemTable instance.

◆ new_iterator()

ObLsmIterator * oceanbase::ObMemTable::new_iterator ( )

Creates a new iterator for traversing the contents of the memtable.

This method returns a heap-allocated iterator for iterating over key-value pairs stored in the memtable. The caller is responsible for managing the lifetime of the returned iterator.

返回
A pointer to the newly created ObLsmIterator for the memtable.

◆ put()

void oceanbase::ObMemTable::put ( uint64_t  seq,
const string_view &  key,
const string_view &  value 
)

Inserts a key-value pair into the memtable.

Each entry is versioned using the provided seq number. If the same key is inserted multiple times, the version with the highest sequence number will take precedence when queried.

参数
seqA sequence number used for versioning the key-value entry.
keyThe key to be inserted.
valueThe value associated with the key.

类成员变量说明

◆ arena_

ObArena oceanbase::ObMemTable::arena_
private

Memory arena used for memory management in the memtable.

Allocates and tracks memory usage for the skip list and other internal components of the memtable.

◆ comparator_

KeyComparator oceanbase::ObMemTable::comparator_
private

Comparator used for ordering keys in the memtable.

This member defines the rules for comparing keys in the skip list. TODO: support user-defined comparator

◆ table_

Table oceanbase::ObMemTable::table_
private

The underlying data structure used for key-value storage.

Currently implemented as a skip list. Future versions may support alternative data structures, such as hash tables.


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