2.0.0-rc (#9)
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_windows/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head There was a failure building this commit
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head There was a failure building this commit
### Issues * \#1 \[bug\] Unable to mount S3 due to 'item_not_found' exception * \#2 Require bucket name for S3 mounts * \#3 \[bug\] File size is not being updated in S3 mount * \#4 Upgrade to libfuse-3.x.x * \#5 Switch to renterd for Sia support * \#6 Switch to cpp-httplib to further reduce dependencies * \#7 Remove global_data and calculate used disk space per provider * \#8 Switch to libcurl for S3 mount support ### Changes from v1.x.x * Added read-only encrypt provider * Pass-through mount point that transparently encrypts source data using `XChaCha20-Poly1305` * Added S3 encryption support via `XChaCha20-Poly1305` * Added replay protection to remote mounts * Added support base64 writes in remote FUSE * Created static linked Linux binaries for `amd64` and `aarch64` using `musl-libc` * Removed legacy Sia renter support * Removed Skynet support * Fixed multiple remote mount WinFSP API issues on \*NIX servers * Implemented chunked read and write * Writes for non-cached files are performed in chunks of 8Mib * Removed `repertory-ui` support * Removed `FreeBSD` support * Switched to `libsodium` over `CryptoPP` * Switched to `XChaCha20-Poly1305` for remote mounts * Updated `GoogleTest` to v1.14.0 * Updated `JSON for Modern C++` to v3.11.2 * Updated `OpenSSL` to v1.1.1w * Updated `RocksDB` to v8.5.3 * Updated `WinFSP` to 2023 * Updated `boost` to v1.78.0 * Updated `cURL` to v8.3.0 * Updated `zlib` to v1.3 * Use `upload_manager` for all providers * Adds a delay to uploads to prevent excessive API calls * Supports re-upload after mount restart for incomplete uploads * NOTE: Uploads for all providers are full file (no resume support) * Multipart upload support is planned for S3 Reviewed-on: #9
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
/*
|
||||
Copyright <2018-2022> <scott.e.graves@protonmail.com>
|
||||
Copyright <2018-2023> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or
|
||||
substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
|
||||
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#include "fixtures/directory_db_fixture.hpp"
|
||||
#include "test_common.hpp"
|
||||
|
||||
#include "fixtures/directory_db_fixture.hpp"
|
||||
|
||||
namespace repertory {
|
||||
static const auto dirs = {"/",
|
||||
"/root",
|
||||
@@ -31,7 +35,7 @@ static const auto dirs = {"/",
|
||||
|
||||
TEST_F(directory_db_test, is_directory) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
for (const auto &dir : dirs) {
|
||||
@@ -41,7 +45,7 @@ TEST_F(directory_db_test, is_directory) {
|
||||
|
||||
TEST_F(directory_db_test, remove_directory) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->remove_directory("/root/sub2/sub2_sub1"));
|
||||
@@ -52,7 +56,7 @@ TEST_F(directory_db_test, remove_directory) {
|
||||
|
||||
TEST_F(directory_db_test, get_sub_directory_count) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(1u, db_->get_sub_directory_count("/"));
|
||||
@@ -66,7 +70,7 @@ TEST_F(directory_db_test, get_sub_directory_count) {
|
||||
|
||||
TEST_F(directory_db_test, populate_sub_directories) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
directory_item_list list{};
|
||||
@@ -79,72 +83,72 @@ TEST_F(directory_db_test, populate_sub_directories) {
|
||||
|
||||
std::cout << "/" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/", [](directory_item &, const bool &) {}, list);
|
||||
"/", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(1u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root", [](directory_item &, const bool &) {}, list);
|
||||
"/root", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(3u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root/sub1" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root/sub1", [](directory_item &, const bool &) {}, list);
|
||||
"/root/sub1", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(0u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root/sub2" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root/sub2", [](directory_item &, const bool &) {}, list);
|
||||
"/root/sub2", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(2u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root/sub2/sub2_sub1" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root/sub2/sub2_sub1", [](directory_item &, const bool &) {}, list);
|
||||
"/root/sub2/sub2_sub1", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(0u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root/sub2/sub2_sub2" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root/sub2/sub2_sub2", [](directory_item &, const bool &) {}, list);
|
||||
"/root/sub2/sub2_sub2", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(1u, list.size());
|
||||
dump_directory_list();
|
||||
|
||||
std::cout << std::endl << "/root/sub3" << std::endl;
|
||||
db_->populate_sub_directories(
|
||||
"/root/sub3", [](directory_item &, const bool &) {}, list);
|
||||
"/root/sub3", [](directory_item &) {}, list);
|
||||
EXPECT_EQ(0u, list.size());
|
||||
dump_directory_list();
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, is_file) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_TRUE(db_->is_file("/cow.txt"));
|
||||
EXPECT_FALSE(db_->is_directory("/cow.txt"));
|
||||
EXPECT_EQ(api_error::file_exists, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::file_exists, db_->create_directory("/cow.txt"));
|
||||
EXPECT_EQ(api_error::item_exists, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::item_exists, db_->create_directory("/cow.txt"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, remove_file) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::item_is_file, db_->remove_directory("/cow.txt"));
|
||||
EXPECT_EQ(api_error::directory_not_found, db_->remove_directory("/cow.txt"));
|
||||
EXPECT_TRUE(db_->remove_file("/cow.txt"));
|
||||
EXPECT_FALSE(db_->is_file("/cow.txt"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, get_directory_item_count) {
|
||||
db_->create_directory("/");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow2.txt"));
|
||||
@@ -153,19 +157,19 @@ TEST_F(directory_db_test, get_directory_item_count) {
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, get_file) {
|
||||
db_->create_directory("/");
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
|
||||
api_file file{};
|
||||
EXPECT_EQ(api_error::success, db_->get_file("/cow.txt", file, [](api_file &file) {
|
||||
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
|
||||
}));
|
||||
EXPECT_EQ(api_error::success,
|
||||
db_->get_file("/cow.txt", file, [](api_file &file) {
|
||||
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
|
||||
}));
|
||||
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, get_file_list) {
|
||||
db_->create_directory("/");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow2.txt"));
|
||||
@@ -186,7 +190,7 @@ TEST_F(directory_db_test, get_file_list) {
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, get_total_item_count) {
|
||||
db_->create_directory("/");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow2.txt"));
|
||||
@@ -198,7 +202,7 @@ TEST_F(directory_db_test, get_total_item_count) {
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, populate_directory_files) {
|
||||
db_->create_directory("/");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow2.txt"));
|
||||
@@ -207,8 +211,8 @@ TEST_F(directory_db_test, populate_directory_files) {
|
||||
int i = 0;
|
||||
db_->populate_directory_files(
|
||||
"/",
|
||||
[&i](directory_item &di, const bool &) {
|
||||
di.meta[META_SIZE] = utils::string::from_int32(i + 1);
|
||||
[&i](directory_item &di) {
|
||||
di.meta[META_SIZE] = std::to_string(i + 1);
|
||||
EXPECT_FALSE(di.directory);
|
||||
if (i++ == 0) {
|
||||
EXPECT_STREQ("/cow.txt", &di.api_path[0]);
|
||||
@@ -229,7 +233,7 @@ TEST_F(directory_db_test, populate_directory_files) {
|
||||
|
||||
TEST_F(directory_db_test, create_directory_fails_if_directory_exists) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::directory_exists, db_->create_file("/root/sub1"));
|
||||
@@ -238,16 +242,16 @@ TEST_F(directory_db_test, create_directory_fails_if_directory_exists) {
|
||||
|
||||
TEST_F(directory_db_test, create_file_fails_if_file_exists) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::file_exists, db_->create_directory("/cow.txt"));
|
||||
EXPECT_EQ(api_error::item_exists, db_->create_directory("/cow.txt"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, create_file_fails_if_parent_does_not_exist) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::directory_not_found, db_->create_file("/moose/cow.txt"));
|
||||
@@ -255,7 +259,7 @@ TEST_F(directory_db_test, create_file_fails_if_parent_does_not_exist) {
|
||||
|
||||
TEST_F(directory_db_test, create_directory_fails_if_parent_does_not_exist) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::directory_not_found, db_->create_file("/cow/moose"));
|
||||
@@ -263,7 +267,7 @@ TEST_F(directory_db_test, create_directory_fails_if_parent_does_not_exist) {
|
||||
|
||||
TEST_F(directory_db_test, remove_file_fails_if_directory_exists) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_FALSE(db_->remove_file("/root/sub1"));
|
||||
@@ -271,17 +275,17 @@ TEST_F(directory_db_test, remove_file_fails_if_directory_exists) {
|
||||
|
||||
TEST_F(directory_db_test, remove_directory_fails_if_file_exists) {
|
||||
for (const auto &dir : dirs) {
|
||||
db_->create_directory(dir);
|
||||
EXPECT_EQ(api_error::success, db_->create_directory(dir));
|
||||
}
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/cow.txt"));
|
||||
EXPECT_EQ(api_error::item_is_file, db_->remove_directory("/cow.txt"));
|
||||
EXPECT_EQ(api_error::directory_not_found, db_->remove_directory("/cow.txt"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, remove_directory_fails_if_sub_directories_exist) {
|
||||
db_->create_directory("/");
|
||||
db_->create_directory("/sub");
|
||||
db_->create_directory("/sub/sub2");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/sub"));
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/sub/sub2"));
|
||||
|
||||
EXPECT_EQ(api_error::directory_not_empty, db_->remove_directory("/sub"));
|
||||
EXPECT_TRUE(db_->is_directory("/sub"));
|
||||
@@ -289,25 +293,27 @@ TEST_F(directory_db_test, remove_directory_fails_if_sub_directories_exist) {
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, remove_directory_fails_if_files_exist) {
|
||||
db_->create_directory("/");
|
||||
db_->create_directory("/sub");
|
||||
db_->create_file("/sub/test.txt");
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/sub"));
|
||||
EXPECT_EQ(api_error::success, db_->create_file("/sub/test.txt"));
|
||||
|
||||
EXPECT_EQ(api_error::directory_not_empty, db_->remove_directory("/sub"));
|
||||
EXPECT_TRUE(db_->is_directory("/sub"));
|
||||
EXPECT_TRUE(db_->is_file("/sub/test.txt"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test, remove_directory_fails_for_root_directory_by_default) {
|
||||
db_->create_directory("/");
|
||||
TEST_F(directory_db_test,
|
||||
remove_directory_fails_for_root_directory_by_default) {
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::access_denied, db_->remove_directory("/"));
|
||||
EXPECT_TRUE(db_->is_directory("/"));
|
||||
}
|
||||
|
||||
TEST_F(directory_db_test,
|
||||
remove_directory_succeeds_for_root_directory_if_allow_remove_root_is_true) {
|
||||
db_->create_directory("/");
|
||||
TEST_F(
|
||||
directory_db_test,
|
||||
remove_directory_succeeds_for_root_directory_if_allow_remove_root_is_true) {
|
||||
EXPECT_EQ(api_error::success, db_->create_directory("/"));
|
||||
|
||||
EXPECT_EQ(api_error::success, db_->remove_directory("/", true));
|
||||
EXPECT_FALSE(db_->is_directory("/"));
|
||||
|
Reference in New Issue
Block a user