libraries directory

This commit is contained in:
Blue 2023-09-29 18:09:09 -03:00
parent 2b913d1d42
commit 0fa8ba6918
Signed by: blue
GPG key ID: 9B203B252A63EE38
7 changed files with 268 additions and 75 deletions

View file

@ -8,6 +8,7 @@
#include <string_view>
#include <regex>
#include <mutex>
#include <queue>
#include "loggable.h"
#include "component.h"
@ -16,11 +17,13 @@
class Collection : protected Loggable, public std::enable_shared_from_this<Collection> {
using Sources = std::set<std::string>;
using SourcesQueue = std::queue<std::string>;
using Downloads = std::map<std::string, std::unique_ptr<Download>>;
using Components = std::map<std::string, std::unique_ptr<Component>>;
public:
Collection(
const std::filesystem::path& location,
const std::filesystem::path& destination,
const std::string& target,
const std::shared_ptr<Logger>& logger,
@ -39,21 +42,30 @@ private:
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);
void rootBuilt(TaskManager::Error err);
static bool isRemote(const std::string& source);
void processSource(const std::string& source);
void queueDownload(const std::string& source);
void queueRead(const std::string& source, const std::filesystem::path& location);
bool _hasSource(const std::string& source) const;
unsigned int _sourcesTotal() const;
unsigned int _sourcesPending() const;
unsigned int _sourcesError() const;
unsigned int _sourcesSuccess() const;
private:
mutable std::mutex mutex;
std::filesystem::path destination;
std::string target;
std::shared_ptr<TaskManager> taskManager;
std::unique_ptr<Component> root;
std::string librariesPath;
Sources knownSources;
Sources successSources;
SourcesQueue pendingSources;
Downloads downloadingSources;
Components readingSources;
Components buildingSources;