Feature/sync unsync (#1722)

Add Lua script to manually sync or unsync resources (closes #1713)
This commit is contained in:
Alexander Bock
2021-08-23 13:42:08 +02:00
committed by GitHub
parent 8b59760a59
commit 9d8d4147e8
4 changed files with 115 additions and 0 deletions
+32
View File
@@ -31,6 +31,7 @@
#include <openspace/engine/globalscallbacks.h>
#include <openspace/rendering/renderable.h>
#include <openspace/rendering/screenspacerenderable.h>
#include <openspace/scripting/lualibrary.h>
#include <openspace/util/factorymanager.h>
#include <openspace/util/resourcesynchronization.h>
#include <ghoul/filesystem/filesystem.h>
@@ -40,6 +41,8 @@
#include <ghoul/misc/memorypool.h>
#include <ghoul/misc/templatefactory.h>
#include "syncmodule_lua.inl"
namespace {
constexpr const char* KeyHttpSynchronizationRepositories =
"HttpSynchronizationRepositories";
@@ -140,4 +143,33 @@ std::vector<documentation::Documentation> SyncModule::documentations() const {
};
}
scripting::LuaLibrary SyncModule::luaLibrary() const {
scripting::LuaLibrary res;
res.name = "sync";
res.functions = {
{
"syncResource",
&luascriptfunctions::syncResource,
{},
"string, number",
"Synchronizes the http resource identified by the name passed as the "
"first parameter and the version provided as the second parameter. The "
"application will hang while the data is being downloaded"
},
{
"unsyncResource",
&luascriptfunctions::unsyncResource,
{},
"string [, number]",
"Unsynchronizes the http resources identified by the name passed as the "
"first parameter by removing all data that was downloaded as part of the "
"original synchronization. If the second parameter is provided, is it "
"the version of the resources that is unsynchronized, if the parameter "
"is not provided, all versions for the specified http resource are "
"removed."
}
};
return res;
}
} // namespace openspace