18 #ifndef UpdateFetcher_h__
19 #define UpdateFetcher_h__
30 typedef boost::filesystem::path
Path;
34 std::function<
void(std::string
const&)>
const&
apply,
35 std::function<
void(Path
const& path)>
const& applyFile,
36 std::function<
QueryResult(std::string
const&)>
const& retrieve);
39 bool const archivedRedundancy,
int32 const cleanDeadReferencesMaxCount)
const;
57 : name(name_),
hash(hash_), state(state_), timestamp(timestamp_) { }
69 return (state ==
"RELEASED") ? RELEASED : ARCHIVED;
74 return (state == RELEASED) ?
"RELEASED" :
"ARCHIVED";
79 return StateConvert(state);
96 inline bool operator() (LocaleFileEntry
const&
left, LocaleFileEntry
const& right)
const
98 return left.first.filename().string() < right.first.filename().string();
107 LocaleFileStorage GetFileList()
const;
108 void FillFileListRecursively(Path
const& path, LocaleFileStorage& storage,
111 DirectoryStorage ReceiveIncludedDirectories()
const;
112 AppliedFileStorage ReceiveAppliedFiles()
const;
114 std::string ReadSQLUpdate(Path
const& file)
const;
115 std::string CalculateHash(std::string
const&
query)
const;
117 uint32 Apply(Path
const& path)
const;
120 void RenameEntry(std::string
const& from, std::string
const& to)
const;
121 void CleanUp(AppliedFileStorage
const& storage)
const;
123 void UpdateState(std::string
const& name,
State const state)
const;
127 std::function<void(std::string const&)>
const _apply;
129 std::function<QueryResult(std::string const&)>
const _retrieve;
132 #endif // UpdateFetcher_h__
#define TC_DATABASE_API
Definition: Define.h:122
AppliedFileEntry(std::string const &name_, std::string const &hash_, State state_, uint64 timestamp_)
Definition: UpdateFetcher.h:56
Definition: UpdateFetcher.h:94
#define hash
Definition: private_namespace.h:186
uint64 const timestamp
Definition: UpdateFetcher.h:65
std::function< void(std::string const &)> const _apply
Definition: UpdateFetcher.h:127
Path const _sourceDirectory
Definition: UpdateFetcher.h:125
std::string GetStateAsString() const
Definition: UpdateFetcher.h:77
static State StateConvert(std::string const &state)
Definition: UpdateFetcher.h:67
std::function< void(Path const &path)> const _applyFile
Definition: UpdateFetcher.h:128
Definition: UpdateFetcher.h:83
static std::string StateConvert(State const state)
Definition: UpdateFetcher.h:72
Definition: UpdateFetcher.h:50
char * query(struct soap *soap)
Definition: httpget.cpp:244
void apply(T *val)
Definition: ByteConverter.h:41
Definition: UpdateFetcher.h:54
std::set< LocaleFileEntry, PathCompare > LocaleFileStorage
Definition: UpdateFetcher.h:102
Definition: DBUpdater.h:44
std::unordered_map< std::string, std::string > HashToFileNameStorage
Definition: UpdateFetcher.h:103
boost::filesystem::path Path
Definition: UpdateFetcher.h:30
std::string const hash
Definition: UpdateFetcher.h:61
int32_t int32
Definition: Define.h:146
std::vector< UpdateFetcher::DirectoryEntry > DirectoryStorage
Definition: UpdateFetcher.h:105
uint32_t uint32
Definition: Define.h:150
std::unordered_map< std::string, AppliedFileEntry > AppliedFileStorage
Definition: UpdateFetcher.h:104
uint64_t uint64
Definition: Define.h:149
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
bool left(const int *a, const int *b, const int *c)
Definition: RecastContour.cpp:487
State const state
Definition: UpdateFetcher.h:89
std::pair< Path, State > LocaleFileEntry
Definition: UpdateFetcher.h:92
Definition: UpdateFetcher.h:44
std::function< QueryResult(std::string const &)> const _retrieve
Definition: UpdateFetcher.h:129
State const state
Definition: UpdateFetcher.h:63
std::string const name
Definition: UpdateFetcher.h:59
State
Definition: UpdateFetcher.h:48
Definition: UpdateFetcher.h:28
Path const path
Definition: UpdateFetcher.h:87
UpdateMode
Definition: UpdateFetcher.h:42
DirectoryEntry(Path const &path_, State state_)
Definition: UpdateFetcher.h:85
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150