refactor app config
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
parent
f14b1c7168
commit
d2a8aef843
@ -106,28 +106,6 @@ private:
|
|||||||
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
|
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename dest>
|
|
||||||
auto get_value(const json &data, const std::string &name, dest &dst,
|
|
||||||
bool &found) -> bool {
|
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (data.find(name) == data.end()) {
|
|
||||||
found = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.at(name).get_to(dst);
|
|
||||||
return true;
|
|
||||||
} catch (const std::exception &ex) {
|
|
||||||
utils::error::raise_error(
|
|
||||||
function_name, ex, fmt::format("failed to get value|name|{}", name));
|
|
||||||
}
|
|
||||||
|
|
||||||
found = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] auto load() -> bool;
|
[[nodiscard]] auto load() -> bool;
|
||||||
|
|
||||||
template <typename dest, typename source>
|
template <typename dest, typename source>
|
||||||
|
@ -53,6 +53,28 @@ constexpr const auto default_retry_read_count{6U};
|
|||||||
constexpr const auto default_ring_buffer_file_size{512U};
|
constexpr const auto default_ring_buffer_file_size{512U};
|
||||||
constexpr const auto default_task_wait_ms{100U};
|
constexpr const auto default_task_wait_ms{100U};
|
||||||
constexpr const auto min_cache_size_bytes{100ULL * 1024ULL * 1024ULL};
|
constexpr const auto min_cache_size_bytes{100ULL * 1024ULL * 1024ULL};
|
||||||
|
|
||||||
|
template <typename dest>
|
||||||
|
auto get_value(const json &data, const std::string &name, dest &dst,
|
||||||
|
bool &found) -> bool {
|
||||||
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (data.find(name) == data.end()) {
|
||||||
|
found = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.at(name).get_to(dst);
|
||||||
|
return true;
|
||||||
|
} catch (const std::exception &ex) {
|
||||||
|
repertory::utils::error::raise_error(
|
||||||
|
function_name, ex, fmt::format("failed to get value|name|{}", name));
|
||||||
|
}
|
||||||
|
|
||||||
|
found = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user