refactor s3 provider

This commit is contained in:
2023-11-11 15:35:35 -06:00
parent f88239a13e
commit b87e1df140
4 changed files with 221 additions and 46 deletions

View File

@@ -172,7 +172,7 @@ encrypting_reader::encrypting_reader(
: key_(utils::encryption::generate_key(token)),
stop_requested_(stop_requested),
error_return_(error_return) {
const auto res = native_file::open(
const auto res = native_file::create_or_open(
source_path, not relative_parent_path.has_value(), source_file_);
if (res != api_error::success) {
throw std::runtime_error("file open failed|src|" + source_path + '|' +
@@ -225,7 +225,8 @@ encrypting_reader::encrypting_reader(const std::string &encrypted_file_path,
: key_(utils::encryption::generate_key(token)),
stop_requested_(stop_requested),
error_return_(error_return) {
const auto res = native_file::open(source_path, false, source_file_);
const auto res =
native_file::create_or_open(source_path, false, source_file_);
if (res != api_error::success) {
throw std::runtime_error("file open failed|src|" + source_path + '|' +
api_error_to_string(res));
@@ -266,7 +267,8 @@ encrypting_reader::encrypting_reader(
: key_(utils::encryption::generate_key(token)),
stop_requested_(stop_requested),
error_return_(error_return) {
const auto res = native_file::open(source_path, false, source_file_);
const auto res =
native_file::create_or_open(source_path, false, source_file_);
if (res != api_error::success) {
throw std::runtime_error("file open failed|src|" + source_path + '|' +
api_error_to_string(res));