Implement secure key via KDF for transparent data encryption/decryption #60
This commit is contained in:
@@ -1268,11 +1268,12 @@ auto s3_provider::read_file_bytes(const std::string &api_path, std::size_t size,
|
||||
for (std::uint32_t retry{0U};
|
||||
not(stop_requested || app_config::get_stop_requested()) &&
|
||||
res != api_error::success &&
|
||||
retry < get_config().get_retry_read_count() + 1U;
|
||||
retry < (static_cast<std::uint32_t>(
|
||||
get_config().get_retry_read_count()) +
|
||||
1U);
|
||||
++retry) {
|
||||
if (retry > 0U) {
|
||||
read_buffer.clear();
|
||||
|
||||
std::this_thread::sleep_for(1s);
|
||||
}
|
||||
|
||||
|
@@ -661,7 +661,7 @@ void sia_provider::iterate_objects(
|
||||
|
||||
auto sia_provider::read_file_bytes(const std::string &api_path,
|
||||
std::size_t size, std::uint64_t offset,
|
||||
data_buffer &buffer,
|
||||
data_buffer &read_buffer,
|
||||
stop_type &stop_requested) -> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
@@ -674,26 +674,29 @@ auto sia_provider::read_file_bytes(const std::string &api_path,
|
||||
.begin = offset,
|
||||
.end = offset + size - 1U,
|
||||
}};
|
||||
get.response_handler = [&buffer](auto &&data, long /* response_code */) {
|
||||
buffer = data;
|
||||
get.response_handler = [&read_buffer](auto &&data,
|
||||
long /* response_code */) {
|
||||
read_buffer = data;
|
||||
};
|
||||
|
||||
auto res{api_error::comm_error};
|
||||
for (std::uint32_t idx = 0U;
|
||||
for (std::uint32_t retry{0U};
|
||||
not(stop_requested || app_config::get_stop_requested()) &&
|
||||
res != api_error::success &&
|
||||
idx < get_config().get_retry_read_count() + 1U;
|
||||
++idx) {
|
||||
if (idx > 0U) {
|
||||
buffer.clear();
|
||||
retry <
|
||||
(static_cast<std::uint32_t>(get_config().get_retry_read_count()) +
|
||||
1U);
|
||||
++retry) {
|
||||
if (retry > 0U) {
|
||||
read_buffer.clear();
|
||||
std::this_thread::sleep_for(1s);
|
||||
}
|
||||
|
||||
const auto notify_retry = [=](long response_code) {
|
||||
const auto notify_retry = [&](long response_code) {
|
||||
auto msg =
|
||||
fmt::format("read file bytes failed|offset|{}|size|{}|retry|{}",
|
||||
std::to_string(offset), std::to_string(size),
|
||||
std::to_string(idx + 1U));
|
||||
std::to_string(retry + 1U));
|
||||
if (response_code == 0) {
|
||||
utils::error::raise_api_path_error(function_name, api_path,
|
||||
api_error::comm_error, msg);
|
||||
|
Reference in New Issue
Block a user