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

A class that manages the manifest file, including reading and writing records and snapshots. 更多...

#include <ob_manifest.h>

Public 成员函数

 ObManifest (const std::string &path)
 Constructs an ObManifest object with the specified path. 更多...
 
RC open ()
 Opens the manifest file and initializes the reader and writer. 更多...
 
template<typename T >
RC push (const T &data)
 Pushes a record or snapshot to the writer. 更多...
 
RC redirect (const ObManifestSnapshot &snapshot, const ObManifestNewMemtable &memtable)
 Redirects to a new manifest file. 更多...
 
RC recover (std::unique_ptr< ObManifestSnapshot > &snapshot_record, std::unique_ptr< ObManifestNewMemtable > &memtbale_record, std::vector< ObManifestCompaction > &compactions)
 Redirects to a new manifest file. 更多...
 

Public 属性

uint64_t latest_seq {0}
 The latest sequence number persisted in the LSM.
 

Private 成员函数

string get_manifest_file_path (string path, uint64_t mf_seq)
 Constructs the path to the manifest file. 更多...
 

Private 属性

filesystem::path path_
 The directory path where manifest files are stored.
 
filesystem::path current_path_
 The path to the CURRENT file that tracks the latest manifest file.
 
uint64_t mf_seq_
 The sequence ID of the current manifest file.
 
std::unique_ptr< ObFileWriterwriter_
 The file writer for manifest data.
 
std::unique_ptr< ObFileReaderreader_
 The file reader for manifest data.
 

友元

class ObManifestTester
 

详细描述

A class that manages the manifest file, including reading and writing records and snapshots.

This class handles the reading and writing of manifest records and snapshots, ensuring the data is serialized to JSON format and stored in a file. The manifest file is used to track SSTable changes during compaction and recovery.

构造及析构函数说明

◆ ObManifest()

oceanbase::ObManifest::ObManifest ( const std::string &  path)
inline

Constructs an ObManifest object with the specified path.

参数
pathThe directory path where the manifest files are stored.

成员函数说明

◆ get_manifest_file_path()

string oceanbase::ObManifest::get_manifest_file_path ( string  path,
uint64_t  mf_seq 
)
inlineprivate

Constructs the path to the manifest file.

参数
pathThe base path where the manifest file is stored.
mf_seqThe sequence ID of the manifest file.
返回
The full path to the manifest file.

◆ open()

RC oceanbase::ObManifest::open ( )

Opens the manifest file and initializes the reader and writer.

返回
RC::SUCCESS if the file is opened successfully, otherwise RC::IOERR_OPEN.

◆ push()

template<typename T >
RC oceanbase::ObManifest::push ( const T &  data)
inline

Pushes a record or snapshot to the writer.

This function serializes either an ObManifestCompaction ,ObManifestNewMemtable or ObManifestSnapshot to JSON format and writes it to the file. It also prefixes the JSON data with its length for easy retrieval.

模板参数
TThe type of the data to push (either ObManifestCompaction ,ObManifestNewMemtable or ObManifestSnapshot).
参数
dataThe data to be serialized and pushed to the file.
返回
RC::SUCCESS if Push successful

◆ recover()

RC oceanbase::ObManifest::recover ( std::unique_ptr< ObManifestSnapshot > &  snapshot_record,
std::unique_ptr< ObManifestNewMemtable > &  memtbale_record,
std::vector< ObManifestCompaction > &  compactions 
)

Redirects to a new manifest file.

参数
snapshotRecord a snapshot of ObLsm.
memtableRecord the latest WAL's id.
compactionsRecord changes to each compaction operation.
返回
RC::SUCCESS, If there is nothing wrong with the recovery process.

◆ redirect()

RC oceanbase::ObManifest::redirect ( const ObManifestSnapshot snapshot,
const ObManifestNewMemtable memtable 
)

Redirects to a new manifest file.

参数
snapshotThe snapshot containing the data to be written to the new manifest file.
memtableThe mamtable record containing the memtable_id to be written to the new manifest file.
返回
RC::SUCCESS,if ObManifest successfully writes snapshot and memtable records into a new manifest file.

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