@@ -28,23 +28,69 @@ namespace limestone::internal {
2828
2929using epoch_id_type = uint64_t ;
3030
31+
3132class wal_history {
3233public:
34+ /* *
35+ * @brief Size of the unique_id field in bytes.
36+ */
3337 static constexpr std::size_t unique_id_size = 16 ;
38+
39+ /* *
40+ * @brief Structure representing a single WAL history record.
41+ */
3442 struct record {
35- epoch_id_type epoch;
36- std::array<std::uint8_t , unique_id_size> unique_id;
37- std::time_t timestamp;
43+ epoch_id_type epoch; // /< Epoch value.
44+ std::array<std::uint8_t , unique_id_size> unique_id; // /< 16-byte unique identifier.
45+ std::time_t timestamp; // /< UNIX timestamp (seconds since epoch).
3846 };
3947
40- explicit wal_history (boost::filesystem::path dir_path);
4148
49+ /* *
50+ * @brief Constructs a wal_history object for the specified directory.
51+ * @param dir_path Directory path where the wal_history file is stored.
52+ * @note This constructor does not throw exceptions.
53+ */
54+ explicit wal_history (boost::filesystem::path dir_path) noexcept ;
55+
56+ /* *
57+ * @brief Appends a new WAL history record for the given epoch.
58+ * @param epoch The epoch value to append.
59+ * @throws limestone::api::limestone_io_exception I/O error
60+ */
4261 void append (epoch_id_type epoch);
62+
63+ /* *
64+ * @brief Returns a list of all WAL history records.
65+ * @return Vector of WAL history records.
66+ * @throws limestone::api::limestone_io_exception I/O error
67+ */
4368 [[nodiscard]] std::vector<record> list () const ;
69+
70+ /* *
71+ * @brief Checks the WAL history file and recovers if necessary.
72+ * @throws limestone::api::limestone_io_exception I/O error
73+ */
4474 void check_and_recover ();
75+
76+ /* *
77+ * @brief Checks if the WAL history file exists.
78+ * @return true if the file exists, false otherwise.
79+ * @throws limestone::api::limestone_io_exception I/O error
80+ */
4581 [[nodiscard]] bool exists () const ;
46- [[nodiscard]] boost::filesystem::path get_file_path () const ;
47- [[nodiscard]] static constexpr const char * file_name () { return file_name_; }
82+
83+ /* *
84+ * @brief Returns the file path of the WAL history file.
85+ * @return Path to the WAL history file.
86+ */
87+ [[nodiscard]] boost::filesystem::path get_file_path () const noexcept ;
88+
89+ /* *
90+ * @brief Returns the file name of the WAL history file.
91+ * @return File name as a string literal.
92+ */
93+ [[nodiscard]] static constexpr const char * file_name () noexcept { return file_name_; }
4894
4995protected:
5096 // Note: These members are protected (not private) to allow access from test subclasses.
0 commit comments