updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2024-08-20 15:02:13 -05:00
parent aa9c7d1ec1
commit 1236bf1829
9 changed files with 369 additions and 41 deletions

View File

@ -42,11 +42,33 @@ protected:
i_exception_handler() = default;
};
struct iostream_exception_handler final : i_exception_handler {
void handle_exception(std::string_view function_name) const override {
std::cerr << function_name << "|exception|unknown" << std::endl;
}
void handle_exception(std::string_view function_name,
const std::exception &ex) const override {
std::cerr << function_name << "|exception|"
<< (ex.what() == nullptr ? "unknown" : ex.what()) << std::endl;
}
};
inline const iostream_exception_handler default_exception_handler{};
extern std::atomic<const i_exception_handler *> exception_handler;
#if defined(PROJECT_ENABLE_TESTING)
[[nodiscard]] inline auto
get_exception_handler() -> const i_exception_handler * {
return exception_handler;
}
#endif // defined(PROJECT_ENABLE_TESTING)
void handle_exception(std::string_view function_name);
void handle_exception(std::string_view function_name, const std::exception &ex);
void set_exception_handler(i_exception_handler *handler);
void set_exception_handler(const i_exception_handler *handler);
} // namespace repertory::utils::error
#endif // REPERTORY_INCLUDE_UTILS_ERROR_HPP_

View File

@ -295,6 +295,89 @@ public:
[[nodiscard]] operator bool() const override { return file_ != nullptr; }
};
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
class enc_file final : public i_file {
public:
[[nodiscard]] static auto attach_file(fs_file_t file) -> fs_file_t;
public:
enc_file() noexcept = default;
protected:
enc_file(fs_file_t file);
public:
enc_file(const enc_file &) = delete;
enc_file(enc_file &&move_file) noexcept : file_(std::move(move_file.file_)) {}
~enc_file() override { close(); }
private:
fs_file_t file_;
public:
void close() override;
[[nodiscard]] auto exists() const -> bool override { return file_->exists(); }
void flush() const override;
[[nodiscard]] auto get_handle() const -> native_handle override {
return file_->get_handle();
}
[[nodiscard]] auto get_path() const -> std::string override {
return file_->get_path();
}
[[nodiscard]] auto get_read_buffer_size() const -> std::uint32_t override {
return file_->get_read_buffer_size();
}
[[nodiscard]] auto get_time(time_types type) const -> std::uint64_t override;
[[nodiscard]] auto is_read_only() const -> bool override {
return file_->is_read_only();
};
[[nodiscard]] auto move_to(std::string_view new_path) -> bool override;
[[nodiscard]] auto read(unsigned char *data, std::size_t to_read,
std::uint64_t offset,
std::size_t *total_read = nullptr) -> bool override;
[[nodiscard]] auto remove() -> bool override;
auto set_read_buffer_size(std::uint32_t size) -> std::uint32_t override {
return file_->set_read_buffer_size(size);
}
[[nodiscard]] auto size() const -> std::uint64_t override;
[[nodiscard]] auto truncate(std::size_t size) -> bool override;
[[nodiscard]] auto
write(const unsigned char *data, std::size_t to_write, std::size_t offset,
std::size_t *total_written = nullptr) -> bool override;
public:
[[nodiscard]] operator bool() const override {
return static_cast<bool>(*file_);
}
auto operator=(const file &) noexcept -> enc_file & = delete;
auto operator=(enc_file &&move_file) noexcept -> enc_file & {
if (&move_file != this) {
file_ = std::move(move_file.file_);
}
return *this;
}
};
#endif // defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
class thread_file final : public i_file {
public:
// [[nodiscard]] static auto

View File

@ -192,6 +192,10 @@ combine(std::string_view path,
combine(std::wstring_view path,
const std::vector<std::wstring_view> &paths) -> std::wstring;
[[nodiscard]] auto contains_trash_directory(std::string_view path) -> bool;
[[nodiscard]] auto contains_trash_directory(std::wstring_view path) -> bool;
[[nodiscard]] auto inline create_api_path(std::string_view path) -> std::string;
[[nodiscard]] auto inline create_api_path(std::wstring_view path)
@ -224,10 +228,6 @@ get_parent_api_path(std::wstring_view path) -> std::wstring;
[[nodiscard]] auto get_parent_directory(std::wstring_view path) -> std::wstring;
[[nodiscard]] auto is_trash_directory(std::string_view path) -> bool;
[[nodiscard]] auto is_trash_directory(std::wstring_view path) -> bool;
[[nodiscard]] auto make_file_uri(std::string_view path) -> std::string;
[[nodiscard]] auto make_file_uri(std::wstring_view path) -> std::wstring;