16#include "common/lang/mutex.h"
17#include "common/sys/rc.h"
18#include "oblsm/util/ob_file_writer.h"
43 WalRecord(uint64_t s, std::string k, std::string v) :
seq(s),
key(std::move(k)),
val(std::move(v)) {}
88 RC
open(
const std::string &filename) {
return RC::UNIMPLEMENTED; }
100 RC
recover(
const std::string &wal_file, std::vector<WalRecord> &wal_records);
112 RC
put(uint64_t seq, std::string_view key, std::string_view val);
120 RC
sync() {
return RC::UNIMPLEMENTED; }
122 const string &filename()
const {
return filename_; }
Definition: ob_lsm_wal.h:67
RC put(uint64_t seq, std::string_view key, std::string_view val)
Writes a key-value pair to the WAL.
Definition: ob_lsm_wal.cpp:21
RC sync()
Synchronizes the WAL to disk. Forces any buffered data in the WAL to be written to the underlying sto...
Definition: ob_lsm_wal.h:120
WAL()
Default constructor for the Wal class.
Definition: ob_lsm_wal.h:72
RC open(const std::string &filename)
Opens the WAL file for writing. This function initializes the file writer and prepares the WAL file f...
Definition: ob_lsm_wal.h:88
RC recover(const std::string &wal_file, std::vector< WalRecord > &wal_records)
Recovers data from a specified WAL file.
Definition: ob_lsm_wal.cpp:16
~WAL()=default
Destructor for the Wal class. Ensures that the file writer is closed when the Wal object is destroyed...
A structure representing a record in the Write-Ahead Log (WAL). Each record contains a sequence numbe...
Definition: ob_lsm_wal.h:28
uint64_t seq
Definition: ob_lsm_wal.h:30
WalRecord(uint64_t s, std::string k, std::string v)
Parameterized constructor to create a new WalRecord object.
Definition: ob_lsm_wal.h:43
std::string key
Definition: ob_lsm_wal.h:32
std::string val
Definition: ob_lsm_wal.h:34