mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 04:30:09 -05:00
Restructure sync directories and change sync API
This commit is contained in:
@@ -26,9 +26,13 @@
|
||||
|
||||
#include <openspace/util/asynchttprequest.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "HttpSynchronization";
|
||||
const char* KeyIdentifier = "Identifier";
|
||||
const char* KeyVersion = "Version";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -36,11 +40,44 @@ namespace openspace {
|
||||
HttpSynchronization::HttpSynchronization(const ghoul::Dictionary& dict)
|
||||
: openspace::ResourceSynchronization()
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dict,
|
||||
"HttpSynchroniztion"
|
||||
);
|
||||
|
||||
_identifier = dict.value<std::string>(KeyIdentifier);
|
||||
_version = static_cast<int>(dict.value<double>(KeyVersion));
|
||||
}
|
||||
|
||||
documentation::Documentation HttpSynchronization::Documentation() {
|
||||
return {};
|
||||
using namespace openspace::documentation;
|
||||
return {
|
||||
"HttpSynchronization",
|
||||
"http_synchronization",
|
||||
{
|
||||
{
|
||||
KeyIdentifier,
|
||||
new StringVerifier,
|
||||
Optional::No,
|
||||
"A unique identifier for this resource"
|
||||
},
|
||||
{
|
||||
KeyVersion,
|
||||
new IntVerifier,
|
||||
Optional::No,
|
||||
"The version of this resource"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
std::string HttpSynchronization::directory() {
|
||||
return _syncRoot +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
_identifier +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
std::to_string(_version);
|
||||
}
|
||||
|
||||
void HttpSynchronization::synchronize() {
|
||||
|
||||
@@ -39,7 +39,13 @@ public:
|
||||
HttpSynchronization(const ghoul::Dictionary& dict);
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
std::string directory() override;
|
||||
void synchronize() override;
|
||||
|
||||
private:
|
||||
bool directoryExists();
|
||||
std::string _identifier;
|
||||
int _version;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user