Skip to content

Commit 6530eb2

Browse files
committed
WIP2
1 parent 9466dae commit 6530eb2

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

include/bitcoin/database/file/utilities.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ BCD_API bool copy_directory(const path& from, const path& to) NOEXCEPT;
7272
BCD_API code copy_directory_ex(const path& from, const path& to) NOEXCEPT;
7373

7474
/// File descriptor functions (for memory mapping).
75-
BCD_API int open(const path& filename) NOEXCEPT;
76-
BCD_API code open_ex(int& file_descriptor, const path& filename) NOEXCEPT;
75+
BCD_API int open(const path& filename, bool random=false) NOEXCEPT;
76+
BCD_API code open_ex(int& file_descriptor, const path& filename,
77+
bool random=false) NOEXCEPT;
7778
BCD_API bool close(int file_descriptor) NOEXCEPT;
7879
BCD_API code close_ex(int file_descriptor) NOEXCEPT;
7980
BCD_API bool size(size_t& out, int file_descriptor) NOEXCEPT;

include/bitcoin/database/memory/map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class BCD_API map
4343
DELETE_COPY_MOVE(map);
4444

4545
map(const std::filesystem::path& filename, size_t minimum=1,
46-
size_t expansion=0, bool random=true) NOEXCEPT;
46+
size_t expansion=0, bool random=false) NOEXCEPT;
4747

4848
/// Destruct for debug assertion only.
4949
virtual ~map() NOEXCEPT;

src/file/utilities.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,8 @@ code copy_directory_ex(const path& from, const path& to) NOEXCEPT
242242

243243
// File descriptor functions required for memory mapping.
244244

245-
int open(const path& filename) NOEXCEPT
245+
int open(const path& filename, bool random) NOEXCEPT
246246
{
247-
// TODO: provide as parameter for random vs. sequential accesss.
248-
const auto random{ true };
249-
250247
const auto path = system::to_extended_path(filename);
251248
int file_descriptor{};
252249

@@ -294,10 +291,10 @@ int open(const path& filename) NOEXCEPT
294291
return file_descriptor;
295292
}
296293

297-
code open_ex(int& file_descriptor, const path& filename) NOEXCEPT
294+
code open_ex(int& file_descriptor, const path& filename, bool random) NOEXCEPT
298295
{
299296
system::error::clear_errno();
300-
file_descriptor = open(filename);
297+
file_descriptor = open(filename, random);
301298
return system::error::get_errno();
302299
}
303300

0 commit comments

Comments
 (0)