diff --git a/repertory/librepertory/include/common.hpp b/repertory/librepertory/include/common.hpp index c8948b8f..2c5d6e40 100644 --- a/repertory/librepertory/include/common.hpp +++ b/repertory/librepertory/include/common.hpp @@ -57,7 +57,7 @@ using json = nlohmann::json; inline constexpr const std::string_view REPERTORY = "repertory"; inline constexpr const std::wstring_view REPERTORY_W = L"repertory"; -inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 0ULL; +inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 1ULL; inline constexpr const std::string_view REPERTORY_DATA_NAME = "repertory2"; inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION = "2.0.0"; @@ -221,44 +221,25 @@ using WCHAR = wchar_t; #define MAX_PATH 260 -#define STATUS_SUCCESS \ - std::uint32_t { 0U } -#define STATUS_ACCESS_DENIED \ - std::uint32_t { 0xC0000022L } -#define STATUS_DEVICE_BUSY \ - std::uint32_t { 0x80000011L } -#define STATUS_DEVICE_INSUFFICIENT_RESOURCES \ - std::uint32_t { 0xC0000468L } -#define STATUS_DIRECTORY_NOT_EMPTY \ - std::uint32_t { 0xC0000101L } -#define STATUS_FILE_IS_A_DIRECTORY \ - std::uint32_t { 0xC00000BAL } -#define STATUS_FILE_TOO_LARGE \ - std::uint32_t { 0xC0000904L } -#define STATUS_INSUFFICIENT_RESOURCES \ - std::uint32_t { 0xC000009AL } -#define STATUS_INTERNAL_ERROR \ - std::uint32_t { 0xC00000E5L } -#define STATUS_INVALID_ADDRESS \ - std::uint32_t { 0xC0000141L } -#define STATUS_INVALID_HANDLE \ - std::uint32_t { 0xC0000006L } -#define STATUS_INVALID_IMAGE_FORMAT \ - std::uint32_t { 0xC000007BL } -#define STATUS_INVALID_PARAMETER \ - std::uint32_t { 0xC000000DL } -#define STATUS_NO_MEMORY \ - std::uint32_t { 0xC0000017L } -#define STATUS_NOT_IMPLEMENTED \ - std::uint32_t { 0xC0000002L } -#define STATUS_OBJECT_NAME_EXISTS \ - std::uint32_t { 0x40000000L } -#define STATUS_OBJECT_NAME_NOT_FOUND \ - std::uint32_t { 0xC0000034L } -#define STATUS_OBJECT_PATH_INVALID \ - std::uint32_t { 0xC0000039L } -#define STATUS_UNEXPECTED_IO_ERROR \ - std::uint32_t { 0xC00000E9L } +#define STATUS_SUCCESS std::uint32_t{0U} +#define STATUS_ACCESS_DENIED std::uint32_t{0xC0000022L} +#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L} +#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L} +#define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L} +#define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL} +#define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L} +#define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL} +#define STATUS_INTERNAL_ERROR std::uint32_t{0xC00000E5L} +#define STATUS_INVALID_ADDRESS std::uint32_t{0xC0000141L} +#define STATUS_INVALID_HANDLE std::uint32_t{0xC0000006L} +#define STATUS_INVALID_IMAGE_FORMAT std::uint32_t{0xC000007BL} +#define STATUS_INVALID_PARAMETER std::uint32_t{0xC000000DL} +#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L} +#define STATUS_NOT_IMPLEMENTED std::uint32_t{0xC0000002L} +#define STATUS_OBJECT_NAME_EXISTS std::uint32_t{0x40000000L} +#define STATUS_OBJECT_NAME_NOT_FOUND std::uint32_t{0xC0000034L} +#define STATUS_OBJECT_PATH_INVALID std::uint32_t{0xC0000039L} +#define STATUS_UNEXPECTED_IO_ERROR std::uint32_t{0xC00000E9L} #define CONVERT_STATUS_NOT_IMPLEMENTED(e) \ ((std::uint32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e) diff --git a/repertory/librepertory/include/types/repertory.hpp b/repertory/librepertory/include/types/repertory.hpp index 7a9d99e7..feeb41e1 100644 --- a/repertory/librepertory/include/types/repertory.hpp +++ b/repertory/librepertory/include/types/repertory.hpp @@ -27,7 +27,7 @@ constexpr const auto default_api_auth_size{48U}; constexpr const auto default_download_timeout_ces{30U}; constexpr const auto default_eviction_delay_mins{1U}; constexpr const auto default_high_freq_interval_secs{30U}; -constexpr const auto default_low_freq_interval_secs{0U * 60U}; +constexpr const auto default_low_freq_interval_secs{60U * 60U}; constexpr const auto default_max_cache_size_bytes{ std::uint64_t(20UL * 1024UL * 1024UL * 1024UL), }; diff --git a/repertory/librepertory/src/app_config.cpp b/repertory/librepertory/src/app_config.cpp index 8ee5208c..6f0f3b22 100644 --- a/repertory/librepertory/src/app_config.cpp +++ b/repertory/librepertory/src/app_config.cpp @@ -1072,7 +1072,11 @@ auto app_config::load() -> bool { // Handle configuration defaults for new config versions if (version != REPERTORY_CONFIG_VERSION) { version_ = REPERTORY_CONFIG_VERSION; - // TODO upgrade future version + if (version_ == 1U) { + if (low_freq_interval_secs_ == 0UL) { + set_value(low_freq_interval_secs_, default_low_freq_interval_secs); + } + } found = false; } diff --git a/repertory/librepertory/src/providers/base_provider.cpp b/repertory/librepertory/src/providers/base_provider.cpp index 4ca50567..1819dae3 100644 --- a/repertory/librepertory/src/providers/base_provider.cpp +++ b/repertory/librepertory/src/providers/base_provider.cpp @@ -69,8 +69,8 @@ void base_provider::add_all_items(stop_type &stop_requested) { } auto base_provider::create_api_file(std::string path, std::string key, - std::uint64_t size, - std::uint64_t file_time) -> api_file { + std::uint64_t size, std::uint64_t file_time) + -> api_file { api_file file{}; file.api_path = utils::path::create_api_path(path); file.api_parent = utils::path::get_parent_api_path(file.api_path); @@ -102,8 +102,8 @@ auto base_provider::create_api_file(std::string path, std::uint64_t size, } auto base_provider::create_directory_clone_source_meta( - const std::string &source_api_path, - const std::string &api_path) -> api_error { + const std::string &source_api_path, const std::string &api_path) + -> api_error { REPERTORY_USES_FUNCTION_NAME(); bool exists{}; @@ -201,8 +201,8 @@ auto base_provider::create_directory(const std::string &api_path, return api_error::error; } -auto base_provider::create_file(const std::string &api_path, - api_meta_map &meta) -> api_error { +auto base_provider::create_file(const std::string &api_path, api_meta_map &meta) + -> api_error { REPERTORY_USES_FUNCTION_NAME(); try { @@ -259,8 +259,9 @@ auto base_provider::create_file(const std::string &api_path, return api_error::error; } -auto base_provider::get_api_path_from_source( - const std::string &source_path, std::string &api_path) const -> api_error { +auto base_provider::get_api_path_from_source(const std::string &source_path, + std::string &api_path) const + -> api_error { REPERTORY_USES_FUNCTION_NAME(); if (source_path.empty()) { @@ -273,8 +274,9 @@ auto base_provider::get_api_path_from_source( return db3_->get_api_path(source_path, api_path); } -auto base_provider::get_directory_items( - const std::string &api_path, directory_item_list &list) const -> api_error { +auto base_provider::get_directory_items(const std::string &api_path, + directory_item_list &list) const + -> api_error { REPERTORY_USES_FUNCTION_NAME(); try { @@ -342,9 +344,10 @@ auto base_provider::get_file_size(const std::string &api_path, return api_error::success; } -auto base_provider::get_filesystem_item( - const std::string &api_path, bool directory, - filesystem_item &fsi) const -> api_error { +auto base_provider::get_filesystem_item(const std::string &api_path, + bool directory, + filesystem_item &fsi) const + -> api_error { bool exists{}; auto res = is_directory(api_path, exists); if (res != api_error::success) { @@ -377,9 +380,10 @@ auto base_provider::get_filesystem_item( return api_error::success; } -auto base_provider::get_filesystem_item_and_file( - const std::string &api_path, api_file &file, - filesystem_item &fsi) const -> api_error { +auto base_provider::get_filesystem_item_and_file(const std::string &api_path, + api_file &file, + filesystem_item &fsi) const + -> api_error { auto res = get_file(api_path, file); if (res != api_error::success) { return res;