MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
|
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< ObFileWriter > | writer_ |
The file writer for manifest data. | |
std::unique_ptr< ObFileReader > | reader_ |
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.
|
inline |
Constructs an ObManifest object with the specified path.
path | The directory path where the manifest files are stored. |
|
inlineprivate |
Constructs the path to the manifest file.
path | The base path where the manifest file is stored. |
mf_seq | The sequence ID of the manifest file. |
RC oceanbase::ObManifest::open | ( | ) |
Opens the manifest file and initializes the reader and writer.
|
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.
T | The type of the data to push (either ObManifestCompaction ,ObManifestNewMemtable or ObManifestSnapshot). |
data | The data to be serialized and pushed to the file. |
RC oceanbase::ObManifest::recover | ( | std::unique_ptr< ObManifestSnapshot > & | snapshot_record, |
std::unique_ptr< ObManifestNewMemtable > & | memtbale_record, | ||
std::vector< ObManifestCompaction > & | compactions | ||
) |
RC oceanbase::ObManifest::redirect | ( | const ObManifestSnapshot & | snapshot, |
const ObManifestNewMemtable & | memtable | ||
) |
Redirects to a new manifest file.
snapshot | The snapshot containing the data to be written to the new manifest file. |
memtable | The mamtable record containing the memtable_id to be written to the new manifest file. |