diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-05-12 18:49:51 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-05-12 18:50:27 +0200 |
| commit | 7e538980a2b4fc6c74bde7bd456633d954272708 (patch) | |
| tree | 73454d83035b0ddd099e4bc934222df60b66f597 /src/server/database/Updater/UpdateFetcher.h | |
| parent | 8fdf0778ca340d0bbf0e70dbf091d20c838981d3 (diff) | |
Core/Database: Include cleanup
Diffstat (limited to 'src/server/database/Updater/UpdateFetcher.h')
| -rw-r--r-- | src/server/database/Updater/UpdateFetcher.h | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/server/database/Updater/UpdateFetcher.h b/src/server/database/Updater/UpdateFetcher.h index 0ca18f43886..f5187d261a7 100644 --- a/src/server/database/Updater/UpdateFetcher.h +++ b/src/server/database/Updater/UpdateFetcher.h @@ -18,14 +18,35 @@ #ifndef UpdateFetcher_h__ #define UpdateFetcher_h__ -#include <DBUpdater.h> - -#include <functional> +#include "Define.h" +#include "DatabaseEnvFwd.h" +#include <set> #include <string> -#include <memory> +#include <unordered_map> #include <set> #include <vector> +namespace boost +{ + namespace filesystem + { + class path; + } +} + +struct TC_DATABASE_API UpdateResult +{ + UpdateResult() + : updated(0), recent(0), archived(0) { } + + UpdateResult(size_t const updated_, size_t const recent_, size_t const archived_) + : updated(updated_), recent(recent_), archived(archived_) { } + + size_t updated; + size_t recent; + size_t archived; +}; + class TC_DATABASE_API UpdateFetcher { typedef boost::filesystem::path Path; @@ -35,6 +56,7 @@ public: std::function<void(std::string const&)> const& apply, std::function<void(Path const& path)> const& applyFile, std::function<QueryResult(std::string const&)> const& retrieve); + ~UpdateFetcher(); UpdateResult Update(bool const redundancyChecks, bool const allowRehash, bool const archivedRedundancy, int32 const cleanDeadReferencesMaxCount) const; @@ -81,23 +103,13 @@ private: } }; - struct DirectoryEntry - { - DirectoryEntry(Path const& path_, State state_) : path(path_), state(state_) { } - - Path const path; - - State const state; - }; + struct DirectoryEntry; typedef std::pair<Path, State> LocaleFileEntry; struct PathCompare { - inline bool operator() (LocaleFileEntry const& left, LocaleFileEntry const& right) const - { - return left.first.filename().string() < right.first.filename().string(); - } + bool operator()(LocaleFileEntry const& left, LocaleFileEntry const& right) const; }; typedef std::set<LocaleFileEntry, PathCompare> LocaleFileStorage; @@ -122,7 +134,7 @@ private: void UpdateState(std::string const& name, State const state) const; - Path const _sourceDirectory; + std::unique_ptr<Path> const _sourceDirectory; std::function<void(std::string const&)> const _apply; std::function<void(Path const& path)> const _applyFile; |
