33
44#include < array>
55#include < atomic>
6+ #include < filesystem>
67#include < mutex>
78#include < string_view>
89#include < thread>
2526
2627#include " glog/logging.h"
2728
28- #include " boost/filesystem.hpp"
29- #include " boost/foreach.hpp"
30-
3129#include " limestone/api/datastore.h"
3230
3331namespace shirakami ::testing {
@@ -62,13 +60,11 @@ class limestone_unit_test : public ::testing::Test { // NOLINT
6260 static inline std::string metadata_log_dir_; // NOLINT
6361};
6462
65- std::size_t dir_size (boost ::filesystem::path& path) {
63+ std::size_t dir_size (std ::filesystem::path& path) {
6664 std::size_t total_file_size{0 };
67- BOOST_FOREACH (const boost::filesystem::path& p, // NOLINT
68- std::make_pair (boost::filesystem::directory_iterator (path),
69- boost::filesystem::directory_iterator ())) {
70- if (!boost::filesystem::is_directory (p)) {
71- total_file_size += boost::filesystem::file_size (p);
65+ for (const std::filesystem::path& p : std::filesystem::directory_iterator (path)) {
66+ if (!std::filesystem::is_directory (p)) {
67+ total_file_size += std::filesystem::file_size (p);
7268 }
7369 }
7470
@@ -92,8 +88,8 @@ TEST_F(limestone_unit_test, logging_and_recover) { // NOLINT
9288 std::string data_dir =
9389 " /tmp/shirakami" + std::to_string (tid) + " -" + std::to_string (tsc);
9490 std::string metadata_dir = data_dir + " m" ;
95- boost ::filesystem::path data_location (data_dir);
96- boost ::filesystem::path metadata_path (metadata_dir);
91+ std ::filesystem::path data_location (data_dir);
92+ std ::filesystem::path metadata_path (metadata_dir);
9793
9894 // prepare durable epoch
9995 std::atomic<size_t > limestone_durable_epoch{0 };
@@ -106,14 +102,14 @@ TEST_F(limestone_unit_test, logging_and_recover) { // NOLINT
106102 };
107103
108104 // prepare data / metadata directory
109- if (boost ::filesystem::exists (data_location)) {
110- boost ::filesystem::remove_all (data_location);
105+ if (std ::filesystem::exists (data_location)) {
106+ std ::filesystem::remove_all (data_location);
111107 }
112- ASSERT_TRUE (boost ::filesystem::create_directory (data_location));
113- if (boost ::filesystem::exists (metadata_dir)) {
114- boost ::filesystem::remove_all (metadata_dir);
108+ ASSERT_TRUE (std ::filesystem::create_directory (data_location));
109+ if (std ::filesystem::exists (metadata_dir)) {
110+ std ::filesystem::remove_all (metadata_dir);
115111 }
116- ASSERT_TRUE (boost ::filesystem::create_directory (metadata_dir));
112+ ASSERT_TRUE (std ::filesystem::create_directory (metadata_dir));
117113
118114 // allocate datastore
119115 std::unique_ptr<limestone::api::datastore> datastore;
@@ -127,7 +123,7 @@ TEST_F(limestone_unit_test, logging_and_recover) { // NOLINT
127123#ifdef HAVE_LIMESTONE_DATASTORE_CREATE_CHANNEL_NONE
128124 limestone::api::log_channel* lc{&d_ptr->create_channel ()};
129125#else
130- limestone::api::log_channel* lc{&d_ptr->create_channel (data_location )};
126+ limestone::api::log_channel* lc{&d_ptr->create_channel (data_dir )};
131127#endif
132128
133129 // start datastore
@@ -157,10 +153,10 @@ TEST_F(limestone_unit_test, logging_and_recover) { // NOLINT
157153 }
158154
159155 // check existence of log file about (*1)
160- ASSERT_TRUE (boost ::filesystem::exists (data_location));
156+ ASSERT_TRUE (std ::filesystem::exists (data_location));
161157
162158 // log file size after flushing log (*1)
163- boost:: uintmax_t size1 = dir_size (data_location);
159+ auto size1 = dir_size (data_location);
164160
165161 // flush logs
166162 lc->begin_session ();
@@ -180,7 +176,7 @@ TEST_F(limestone_unit_test, logging_and_recover) { // NOLINT
180176 }
181177
182178 // log file size after flushing log (*2)
183- boost:: uintmax_t size2 = dir_size (data_location);
179+ auto size2 = dir_size (data_location);
184180
185181 // verify size1 != size2
186182 ASSERT_NE (size1, size2);
@@ -219,8 +215,8 @@ TEST_F(limestone_unit_test, persistent_callback) { // NOLINT
219215 std::string data_dir =
220216 " /tmp/shirakami" + std::to_string (tid) + " -" + std::to_string (tsc);
221217 std::string metadata_dir = data_dir + " m" ;
222- boost ::filesystem::path data_location (data_dir);
223- boost ::filesystem::path metadata_path (metadata_dir);
218+ std ::filesystem::path data_location (data_dir);
219+ std ::filesystem::path metadata_path (metadata_dir);
224220
225221 // prepare durable epoch
226222 std::atomic<size_t > limestone_durable_epoch{0 };
@@ -233,14 +229,14 @@ TEST_F(limestone_unit_test, persistent_callback) { // NOLINT
233229 };
234230
235231 // prepare data / metadata directory
236- if (boost ::filesystem::exists (data_location)) {
237- boost ::filesystem::remove_all (data_location);
232+ if (std ::filesystem::exists (data_location)) {
233+ std ::filesystem::remove_all (data_location);
238234 }
239- ASSERT_TRUE (boost ::filesystem::create_directory (data_location));
240- if (boost ::filesystem::exists (metadata_dir)) {
241- boost ::filesystem::remove_all (metadata_dir);
235+ ASSERT_TRUE (std ::filesystem::create_directory (data_location));
236+ if (std ::filesystem::exists (metadata_dir)) {
237+ std ::filesystem::remove_all (metadata_dir);
242238 }
243- ASSERT_TRUE (boost ::filesystem::create_directory (metadata_dir));
239+ ASSERT_TRUE (std ::filesystem::create_directory (metadata_dir));
244240
245241 // allocate datastore
246242 std::unique_ptr<limestone::api::datastore> datastore;
0 commit comments