updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user