some more refactoring work
This commit is contained in:
parent
7b9112c0dd
commit
cdaf94e3cd
7 changed files with 324 additions and 38 deletions
|
@ -5,18 +5,25 @@
|
|||
#include <map>
|
||||
#include <set>
|
||||
#include <exception>
|
||||
#include <string_view>
|
||||
|
||||
#include "loggable.h"
|
||||
#include "component.h"
|
||||
#include "download.h"
|
||||
#include "taskmanager.h"
|
||||
|
||||
class Collection : protected Loggable {
|
||||
using Sources = std::set<std::string>;
|
||||
using Downloads = std::map<std::string, std::unique_ptr<Download>>;
|
||||
using Components = std::map<std::string, std::unique_ptr<Component>>;
|
||||
public:
|
||||
class UnknownSource;
|
||||
class DuplicateSource;
|
||||
class DuplicatePath;
|
||||
|
||||
Collection(
|
||||
const std::filesystem::path& destination,
|
||||
const std::string& target,
|
||||
const std::shared_ptr<Logger>& logger,
|
||||
const std::shared_ptr<TaskManager>& taskManager
|
||||
);
|
||||
|
@ -30,19 +37,24 @@ public:
|
|||
void addSource(const std::string& source);
|
||||
|
||||
private:
|
||||
void sourceDownloadError(const std::string& source);
|
||||
void sourceBuildError(const std::string& source);
|
||||
void sourceDownaloded(const std::string& source);
|
||||
void sourceBuilt(const std::string& source);
|
||||
void sourceDownaloded(const std::string& source, TaskManager::Error err);
|
||||
void sourceRead(const std::string& source, TaskManager::Error err);
|
||||
void sourceBuilt(const std::string& source, TaskManager::Error err);
|
||||
|
||||
bool isRemote(const std::string& source);
|
||||
|
||||
void queueDownload(const std::string& source);
|
||||
void queueRead(const std::string& source, const std::filesystem::path& location);
|
||||
|
||||
private:
|
||||
std::filesystem::path destination;
|
||||
std::string target;
|
||||
std::shared_ptr<TaskManager> taskManager;
|
||||
std::set<std::string> errorSources;
|
||||
std::set<std::string> pendingSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> failedSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> downloadedSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> buildingSources;
|
||||
std::map<std::string, std::unique_ptr<Component>> successSources;
|
||||
Sources knownSources;
|
||||
Sources successSources;
|
||||
Downloads downloadingSources;
|
||||
Components readingSources;
|
||||
Components buildingSources;
|
||||
};
|
||||
|
||||
class Collection::UnknownSource : public std::runtime_error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue