WIP
This commit is contained in:
70
src/service_versions.cpp
Normal file
70
src/service_versions.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
#include "service_runner.hpp"
|
||||
#include "utils/hash.hpp"
|
||||
#include "utils/directories.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "templates.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
service_versions::service_versions(const std::string & server_name, const std::string & service_name)
|
||||
: m_server_name(server_name), m_service_name(service_name)
|
||||
{
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::calculate_version_local_service_template()
|
||||
{
|
||||
template_info tinfo;
|
||||
if (!get_template_info(m_service_name, tinfo)) {
|
||||
return 0;
|
||||
}
|
||||
return hash_directory_recursive(tinfo.local_template_path);
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::calculate_version_local_config()
|
||||
{
|
||||
std::string config_path = get_local_service_path(m_server_name, m_service_name);
|
||||
if (config_path.empty() || !fs::exists(config_path)) {
|
||||
return 0;
|
||||
}
|
||||
return hash_directory_recursive(config_path);
|
||||
}
|
||||
|
||||
void service_versions::update_stored_remote_versions()
|
||||
{
|
||||
XXH64_hash_t template_hash = calculate_version_remote_service_template();
|
||||
XXH64_hash_t config_hash = calculate_version_remote_config();
|
||||
|
||||
// TODO - actually update things!
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::get_version_remote_config()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::get_version_remote_service_template()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::calculate_version_remote_service_template()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
XXH64_hash_t service_versions::calculate_version_remote_config()
|
||||
{
|
||||
// TODO - actually get the version!
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace dropshell
|
Reference in New Issue
Block a user