80 lines
3.2 KiB
Diff
80 lines
3.2 KiB
Diff
--- a/include/bitcoin/bitcoin/log/file_collector.hpp
|
|
+++ b/include/bitcoin/bitcoin/log/file_collector.hpp
|
|
@@ -68,14 +68,18 @@ public:
|
|
void store_file(boost::filesystem::path const& src_path) override;
|
|
|
|
//! Scans the target directory for the files that have already been stored
|
|
+ boost::log::sinks::file::scan_result scan_for_files(
|
|
+ boost::log::sinks::file::scan_method method,
|
|
+ boost::filesystem::path const& pattern) override;
|
|
uintmax_t scan_for_files(boost::log::sinks::file::scan_method method,
|
|
- boost::filesystem::path const& pattern, unsigned int* counter) override;
|
|
+ boost::filesystem::path const& pattern, unsigned int* counter);
|
|
|
|
//! The function updates storage restrictions
|
|
void update(size_t max_size, size_t min_free_space, size_t max_files);
|
|
|
|
//! The function checks if the directory is governed by this collector
|
|
bool is_governed(boost::filesystem::path const& dir) const;
|
|
+ bool is_in_storage(boost::filesystem::path const & src_path) const override;
|
|
|
|
private:
|
|
//! Information about a single stored file
|
|
--- a/src/log/file_collector.cpp
|
|
+++ b/src/log/file_collector.cpp
|
|
@@ -357,6 +357,17 @@ void file_collector::store_file(filesyst
|
|
|
|
|
|
//! Scans the target directory for the files that have already been stored
|
|
+boost::log::sinks::file::scan_result file_collector::scan_for_files(
|
|
+ boost::log::sinks::file::scan_method method,
|
|
+ filesystem::path const& pattern)
|
|
+{
|
|
+ boost::log::sinks::file::scan_result result;
|
|
+ unsigned int counter = 0;
|
|
+ result.found_count = scan_for_files(method, pattern, &counter);
|
|
+ result.last_file_counter = counter;
|
|
+ return result;
|
|
+}
|
|
+
|
|
uintmax_t file_collector::scan_for_files(
|
|
boost::log::sinks::file::scan_method method,
|
|
filesystem::path const& pattern, unsigned int* counter)
|
|
@@ -450,6 +461,15 @@ bool file_collector::is_governed(filesys
|
|
return filesystem::equivalent(storage_dir_, dir);
|
|
}
|
|
|
|
+/* I don't care if this is correct or not */
|
|
+/* upstream removed */
|
|
+bool file_collector::is_in_storage(filesystem::path const& src_path) const
|
|
+{
|
|
+ if (!is_governed(src_path.parent_path()))
|
|
+ return false;
|
|
+ return filesystem::exists(src_path);
|
|
+}
|
|
+
|
|
filesystem::path file_collector::make_absolute(
|
|
filesystem::path const& path)
|
|
{
|
|
--- a/include/bitcoin/bitcoin/unicode/file_lock.hpp
|
|
+++ b/include/bitcoin/bitcoin/unicode/file_lock.hpp
|
|
@@ -14,14 +14,11 @@
|
|
#define LIBBITCOIN_INTERPROCESS_FILE_LOCK_HPP
|
|
|
|
#include <string>
|
|
-#include <boost/interprocess/detail/config_begin.hpp>
|
|
-#include <boost/interprocess/detail/workaround.hpp>
|
|
+#include <boost/date_time/posix_time/posix_time_types.hpp>
|
|
#include <boost/interprocess/exceptions.hpp>
|
|
-#include <boost/interprocess/detail/os_file_functions.hpp>
|
|
-#include <boost/interprocess/detail/os_thread_functions.hpp>
|
|
-#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
|
|
-#include <boost/interprocess/sync/detail/common_algorithms.hpp>
|
|
-#include <boost/interprocess/sync/detail/locks.hpp>
|
|
+#include <boost/interprocess/file_mapping.hpp>
|
|
+#include <boost/interprocess/sync/interprocess_mutex.hpp>
|
|
+#include <boost/interprocess/sync/file_lock.hpp>
|
|
#include <boost/move/move.hpp>
|
|
|
|
// Includes <windows.h> from bitcoin/unicode.hpp under _MSC_VER.
|