refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-04-23 10:27:53 -05:00
parent b8cb717772
commit 1880c50fd8
7 changed files with 71 additions and 32 deletions

View File

@ -1,28 +1,27 @@
set(BINUTILS_VERSION 2.44)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(BOOST_MAJOR_VERSION 1)
set(BOOST_MINOR_VERSION 88)
set(BOOST_PATCH_VERSION 0)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(CPP_HTTPLIB_VERSION 0.20.0)
set(CURL2_VERSION 8_13_0)
set(CURL_VERSION 8.13.0)
set(EXPAT2_VERSION 2_7_1)
set(CURL2_VERSION 8_13_0)
set(EXPAT_VERSION 2.7.1)
set(EXPAT2_VERSION 2_7_1)
set(GCC_VERSION 14.2.0)
set(GTEST_VERSION 1.16.0)
set(ICU_VERSION 76-1)
set(JSON_VERSION 3.12.0)
set(LIBSODIUM_VERSION 1.0.20)
set(MESA_VERSION 23.3.3)
set(MINGW_VERSION 12.0.0)
set(OPENSSL_VERSION 3.5.0)
set(PKG_CONFIG_VERSION 0.29.2)
set(PUGIXML_VERSION 1.15)
set(ROCKSDB_VERSION 10.0.1)
set(SPDLOG_VERSION 1.15.2)
set(SQLITE2_VERSION 3.49.1)
set(SQLITE_VERSION 3490100)
set(SQLITE2_VERSION 3.49.1)
set(STDUUID_VERSION 1.2.3)
set(ZLIB_VERSION 1.3.1)

View File

@ -1445,4 +1445,4 @@ void fuse_drive::update_accessed_time(const std::string &api_path) {
}
} // namespace repertory
#endif // _WIN32
#endif // !defined(_WIN32)

View File

@ -35,8 +35,8 @@ auto fuse_drive_base::access_impl(std::string api_path, int mask) -> api_error {
return check_access(api_path, mask);
}
auto fuse_drive_base::check_access(const std::string &api_path,
int mask) const -> api_error {
auto fuse_drive_base::check_access(const std::string &api_path, int mask) const
-> api_error {
REPERTORY_USES_FUNCTION_NAME();
api_meta_map meta;
@ -137,8 +137,9 @@ auto fuse_drive_base::check_and_perform(
return action(meta);
}
auto fuse_drive_base::check_open_flags(
int flags, int mask, const api_error &fail_error) -> api_error {
auto fuse_drive_base::check_open_flags(int flags, int mask,
const api_error &fail_error)
-> api_error {
return (((flags & mask) == 0) ? api_error::success : fail_error);
}
@ -195,8 +196,8 @@ auto fuse_drive_base::check_parent_access(const std::string &api_path,
return ret;
}
auto fuse_drive_base::check_readable(int flags,
const api_error &fail_error) -> api_error {
auto fuse_drive_base::check_readable(int flags, const api_error &fail_error)
-> api_error {
auto mode = (flags & O_ACCMODE);
return ((mode == O_WRONLY) ? fail_error : api_error::success);
}
@ -254,13 +255,16 @@ auto fuse_drive_base::get_uid_from_meta(const api_meta_map &meta) -> uid_t {
}
#if defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(
const char *name, const uint32_t &position, std::string &attribute_name,
const std::string &api_path) -> api_error {
auto fuse_drive_base::parse_xattr_parameters(const char *name,
const uint32_t &position,
std::string &attribute_name,
const std::string &api_path)
-> api_error {
#else // !defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(
const char *name, std::string &attribute_name,
const std::string &api_path) -> api_error {
auto fuse_drive_base::parse_xattr_parameters(const char *name,
std::string &attribute_name,
const std::string &api_path)
-> api_error {
#endif // defined(__APPLE__)
auto res = api_path.empty() ? api_error::bad_address : api_error::success;
if (res != api_error::success) {
@ -293,9 +297,11 @@ auto fuse_drive_base::parse_xattr_parameters(
std::string &attribute_name, const std::string &api_path) -> api_error {
auto res = parse_xattr_parameters(name, position, attribute_name, api_path);
#else // !defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(
const char *name, const char *value, size_t size,
std::string &attribute_name, const std::string &api_path) -> api_error {
auto fuse_drive_base::parse_xattr_parameters(const char *name,
const char *value, size_t size,
std::string &attribute_name,
const std::string &api_path)
-> api_error {
auto res = parse_xattr_parameters(name, attribute_name, api_path);
#endif // defined(__APPLE__)
if (res != api_error::success) {
@ -361,4 +367,4 @@ void fuse_drive_base::set_timespec_from_meta(const api_meta_map &meta,
}
} // namespace repertory
#endif // _WIN32
#endif // !defined(_WIN32)

View File

@ -604,4 +604,4 @@ auto remote_fuse_drive::write_impl(std::string api_path, const char *buffer,
}
} // namespace repertory::remote_fuse
#endif // _WIN32
#endif // !defined(_WIN32)

View File

@ -18,7 +18,6 @@ PROJECT_VERSIONS[GTEST]="1.16.0"
PROJECT_VERSIONS[ICU]="76-1"
PROJECT_VERSIONS[JSON]="3.12.0"
PROJECT_VERSIONS[LIBSODIUM]="1.0.20"
PROJECT_VERSIONS[MESA]="23.3.3"
PROJECT_VERSIONS[MINGW]="12.0.0"
PROJECT_VERSIONS[OPENSSL]="3.5.0"
PROJECT_VERSIONS[PKG_CONFIG]="0.29.2"

View File

@ -29,8 +29,8 @@ constexpr const auto file_type_count{3U};
constexpr const auto file_type_count{2U};
#endif
[[nodiscard]] auto create_file(auto idx, auto path,
bool read_only = false) -> auto {
[[nodiscard]] auto create_file(auto idx, auto path, bool read_only = false)
-> auto {
switch (idx) {
case 0U:
return repertory::utils::file::file::open_or_create_file(path, read_only);
@ -47,8 +47,8 @@ constexpr const auto file_type_count{2U};
}
}
[[nodiscard]] auto open_file(auto idx, auto path,
bool read_only = false) -> auto {
[[nodiscard]] auto open_file(auto idx, auto path, bool read_only = false)
-> auto {
switch (idx) {
case 0U:
return repertory::utils::file::file::open_file(path, read_only);
@ -370,6 +370,41 @@ TEST(utils_file, directory_exists_in_path) {
}
}
TEST(utils_file, directory_can_get_empty_directory_count) {
auto &test_dir = test::generate_test_directory();
EXPECT_EQ(0U, test_dir.count());
EXPECT_EQ(0U, test_dir.count(false));
}
TEST(utils_file, directory_can_get_empty_directory_count_recursively) {
auto &test_dir = test::generate_test_directory();
EXPECT_EQ(0U, test_dir.count(true));
}
TEST(utils_file, directory_can_get_non_empty_directory_count) {
auto &test_dir = test::generate_test_directory();
auto sub_dir = test_dir.create_directory("sub_dir");
EXPECT_TRUE(sub_dir != nullptr);
if (sub_dir) {
sub_dir->create_directory("sub_dir");
EXPECT_EQ(1U, test_dir.count());
EXPECT_EQ(1U, test_dir.count(false));
}
}
TEST(utils_file, directory_can_get_non_empty_directory_count_recursively) {
auto &test_dir = test::generate_test_directory();
auto sub_dir = test_dir.create_directory("sub_dir");
EXPECT_TRUE(sub_dir != nullptr);
if (sub_dir) {
sub_dir = sub_dir->create_directory("sub_dir");
EXPECT_TRUE(sub_dir != nullptr);
}
EXPECT_EQ(2U, test_dir.count(true));
}
TEST(utils_file, file_exists_in_path) {
auto &test_dir = test::generate_test_directory();
EXPECT_FALSE(

View File

@ -153,9 +153,9 @@ String getBaseUri() {
String? getSettingDescription(String settingPath) {
switch (settingPath) {
case 'ApiPassword':
return "HTTP basic authentication password";
return "HTTP authentication password";
case 'ApiUser':
return "HTTP basic authentication user";
return "HTTP authentication user";
case 'HostConfig.ApiPassword':
return "RENTERD_API_PASSWORD";
default: