Decentralize resource synchronization. Remove notion of SynchronizationJob.

This commit is contained in:
Emil Axelsson
2017-11-12 19:09:16 +01:00
parent 19812af629
commit 2fa42859cd
12 changed files with 46 additions and 169 deletions

View File

@@ -106,12 +106,13 @@ std::string HttpSynchronization::directory() {
return FileSys.absPath(d);
}
void HttpSynchronization::synchronize() {
void HttpSynchronization::start() {
if (hasSyncFile()) {
resolve();
return;
}
// TODO: Do this in a new thread!
std::vector<std::string> listUrls = fileListUrls();
for (const auto& url : listUrls) {
if (trySyncFromUrl(url)) {
@@ -120,7 +121,13 @@ void HttpSynchronization::synchronize() {
}
}
}
void HttpSynchronization::cancel() {
}
void HttpSynchronization::clear() {
}
std::vector<std::string> HttpSynchronization::fileListUrls() {
std::string query = std::string("?") + QueryKeyIdentifier + "=" + _identifier +
"&" + QueryKeyFileVersion + "=" + std::to_string(_version) +