Compare commits

..

No commits in common. "7605be809c0da9e52437616ddf71e97d5c94e39d" and "69c574b9062b0c4c45514ba0556aad6c4df03ac0" have entirely different histories.

3 changed files with 7 additions and 28 deletions

View File

@ -23,7 +23,6 @@
#define REPERTORY_INCLUDE_UI_HANDLERS_HPP_
#include "events/consumers/console_consumer.hpp"
#include <unordered_map>
namespace repertory::ui {
class mgmt_app_config;
@ -49,11 +48,11 @@ private:
private:
console_consumer console;
mutable std::mutex mtx_;
mutable std::unordered_map<std::string, std::recursive_mutex> mtx_lookup_;
private:
[[nodiscard]] auto data_directory_exists(provider_type prov,
std::string_view name) const -> bool;
[[nodiscard]] static auto data_directory_exists(provider_type prov,
std::string_view name)
-> bool;
void handle_get_mount(auto &&req, auto &&res) const;

View File

@ -150,23 +150,14 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
handlers::~handlers() { event_system::instance().stop(); }
auto handlers::data_directory_exists(provider_type prov,
std::string_view name) const -> bool {
auto handlers::data_directory_exists(provider_type prov, std::string_view name)
-> bool {
auto data_dir = utils::path::combine(app_config::get_root_data_directory(),
{
app_config::get_provider_name(prov),
name,
});
auto ret = utils::file::directory{data_dir}.exists();
if (ret) {
return ret;
}
unique_mutex_lock lock(mtx_);
mtx_lookup_.erase(
fmt::format("{}-{}", name, app_config::get_provider_name(prov)));
lock.unlock();
return ret;
return utils::file::directory{data_dir}.exists();
}
void handlers::handle_get_mount(auto &&req, auto &&res) const {
@ -332,10 +323,6 @@ void handlers::handle_post_mount(auto &&req, auto &&res) const {
if (unmount) {
launch_process(prov, name, "-unmount");
} else {
if (not utils::file::directory{location}.exists()) {
res.status = http_error_codes::internal_error;
}
launch_process(prov, name, fmt::format(R"("{}")", location), true);
}
@ -401,12 +388,7 @@ auto handlers::launch_process(provider_type prov, std::string_view name,
auto cmd_line = fmt::format(R"({} {} {})", repertory_binary_, str_type, args);
unique_mutex_lock lock(mtx_);
auto &inst_mtx = mtx_lookup_[fmt::format(
"{}-{}", name, app_config::get_provider_name(prov))];
lock.unlock();
recur_mutex_lock inst_lock(inst_mtx);
mutex_lock lock(mtx_);
if (background) {
#if defined(_WIN32)
system(fmt::format(R"(start "" /b {})", cmd_line).c_str());

View File

@ -127,8 +127,6 @@ List<Validator> getSettingValidators(String settingPath) {
return createHostNameOrIpValidators();
case 'HostConfig.Protocol':
return [(value) => constants.protocolTypeList.contains(value)];
case 'Path':
return [trimNotEmptyValidator];
case 'RemoteConfig.ApiPort':
return [notEmptyValidator, portIsValid];
case 'RemoteConfig.EncryptionToken':