From 5a054cc9ca7e03cda1ea4a9afd42c4f664f73397 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 20 Dec 2024 19:12:23 -0600 Subject: [PATCH] refactor app config --- repertory/librepertory/include/app_config.hpp | 5 ---- .../librepertory/include/types/repertory.hpp | 2 -- repertory/librepertory/src/app_config.cpp | 23 ------------------- repertory/repertory_test/src/config_test.cpp | 16 +------------ 4 files changed, 1 insertion(+), 45 deletions(-) diff --git a/repertory/librepertory/include/app_config.hpp b/repertory/librepertory/include/app_config.hpp index 80b71e78..664fc3ba 100644 --- a/repertory/librepertory/include/app_config.hpp +++ b/repertory/librepertory/include/app_config.hpp @@ -73,7 +73,6 @@ private: std::atomic db_type_{database_type::rocksdb}; std::atomic download_timeout_secs_; std::atomic enable_download_timeout_; - std::atomic enable_comm_duration_events_; std::atomic enable_drive_events_; #if defined(_WIN32) std::atomic enable_mount_manager_; @@ -134,8 +133,6 @@ public: [[nodiscard]] auto get_download_timeout_secs() const -> std::uint8_t; - [[nodiscard]] auto get_enable_comm_duration_events() const -> bool; - [[nodiscard]] auto get_enable_download_timeout() const -> bool; [[nodiscard]] auto get_enable_drive_events() const -> bool; @@ -207,8 +204,6 @@ public: void set_database_type(const database_type &value); - void set_enable_comm_duration_events(bool value); - void set_enable_download_timeout(bool value); void set_enable_drive_events(bool value); diff --git a/repertory/librepertory/include/types/repertory.hpp b/repertory/librepertory/include/types/repertory.hpp index d0b8cddd..b78c0483 100644 --- a/repertory/librepertory/include/types/repertory.hpp +++ b/repertory/librepertory/include/types/repertory.hpp @@ -443,8 +443,6 @@ inline constexpr const auto JSON_DATABASE_TYPE{"DatabaseType"}; inline constexpr const auto JSON_DIRECTORY{"Directory"}; inline constexpr const auto JSON_DOWNLOAD_TIMEOUT_SECS{ "DownloadTimeoutSeconds"}; -inline constexpr const auto JSON_ENABLE_COMM_DURATION_EVENTS{ - "EnableCommDurationEvents"}; inline constexpr const auto JSON_ENABLE_DRIVE_EVENTS{"EnableDriveEvents"}; inline constexpr const auto JSON_ENABLE_DOWNLOAD_TIMEOUT{ "EnableDownloadTimeout"}; diff --git a/repertory/librepertory/src/app_config.cpp b/repertory/librepertory/src/app_config.cpp index 00eebf6f..c0c464d6 100644 --- a/repertory/librepertory/src/app_config.cpp +++ b/repertory/librepertory/src/app_config.cpp @@ -63,7 +63,6 @@ app_config::app_config(const provider_type &prov, config_changed_(false), download_timeout_secs_(default_download_timeout_ces), enable_download_timeout_(true), - enable_comm_duration_events_(false), enable_drive_events_(false), #if defined(_WIN32) enable_mount_manager_(false), @@ -124,10 +123,6 @@ app_config::app_config(const provider_type &prov, [this]() { return database_type_to_string(get_database_type()); }}, {JSON_DOWNLOAD_TIMEOUT_SECS, [this]() { return std::to_string(get_download_timeout_secs()); }}, - {JSON_ENABLE_COMM_DURATION_EVENTS, - [this]() { - return utils::string::from_bool(get_enable_comm_duration_events()); - }}, {JSON_ENABLE_DOWNLOAD_TIMEOUT, [this]() { return utils::string::from_bool(get_enable_download_timeout()); @@ -280,13 +275,6 @@ app_config::app_config(const provider_type &prov, return std::to_string(get_download_timeout_secs()); }, }, - { - JSON_ENABLE_COMM_DURATION_EVENTS, - [this](const std::string &value) { - set_enable_comm_duration_events(utils::string::to_bool(value)); - return utils::string::from_bool(get_enable_comm_duration_events()); - }, - }, { JSON_ENABLE_DOWNLOAD_TIMEOUT, [this](const std::string &value) { @@ -757,10 +745,6 @@ auto app_config::get_download_timeout_secs() const -> std::uint8_t { return std::max(min_download_timeout_secs, download_timeout_secs_.load()); } -auto app_config::get_enable_comm_duration_events() const -> bool { - return enable_comm_duration_events_; -} - auto app_config::get_enable_download_timeout() const -> bool { return enable_download_timeout_; } @@ -804,7 +788,6 @@ auto app_config::get_json() const -> json { {JSON_DOWNLOAD_TIMEOUT_SECS, download_timeout_secs_}, {JSON_DATABASE_TYPE, db_type_}, {JSON_ENABLE_DOWNLOAD_TIMEOUT, enable_download_timeout_}, - {JSON_ENABLE_COMM_DURATION_EVENTS, enable_comm_duration_events_}, {JSON_ENABLE_DRIVE_EVENTS, enable_drive_events_}, #if defined(_WIN32) {JSON_ENABLE_MOUNT_MANAGER, enable_mount_manager_}, @@ -1037,8 +1020,6 @@ auto app_config::load() -> bool { found); get_value(json_document, JSON_ENABLE_DOWNLOAD_TIMEOUT, enable_download_timeout_, found); - get_value(json_document, JSON_ENABLE_COMM_DURATION_EVENTS, - enable_comm_duration_events_, found); get_value(json_document, JSON_ENABLE_DRIVE_EVENTS, enable_drive_events_, found); #if defined(_WIN32) @@ -1145,10 +1126,6 @@ void app_config::set_enable_download_timeout(bool value) { set_value(enable_download_timeout_, value); } -void app_config::set_enable_comm_duration_events(bool value) { - set_value(enable_comm_duration_events_, value); -} - void app_config::set_enable_drive_events(bool value) { set_value(enable_drive_events_, value); } diff --git a/repertory/repertory_test/src/config_test.cpp b/repertory/repertory_test/src/config_test.cpp index 2b5f826b..446dafd5 100644 --- a/repertory/repertory_test/src/config_test.cpp +++ b/repertory/repertory_test/src/config_test.cpp @@ -1,5 +1,5 @@ /* - Copyright <2018-2024> + Copyright <2018-2024> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -138,20 +138,6 @@ TEST_F(config_test, enable_download_timeout) { } } -TEST_F(config_test, enable_comm_duration_events) { - bool original_value{}; - { - app_config config(provider_type::sia, sia_directory); - original_value = config.get_enable_comm_duration_events(); - config.set_enable_comm_duration_events(not original_value); - EXPECT_EQ(not original_value, config.get_enable_comm_duration_events()); - } - { - app_config config(provider_type::sia, sia_directory); - EXPECT_EQ(not original_value, config.get_enable_comm_duration_events()); - } -} - TEST_F(config_test, enable_drive_events) { bool original_value{}; {