Files
dropshell/src/service_versions.cpp
Your Name 76efe77e85 Compiles
2025-04-28 21:12:02 +12:00

70 lines
1.7 KiB
C++

#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 = localpath::service(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