prefer std::string_view

This commit is contained in:
2025-09-30 20:38:46 -05:00
parent 6b92989f81
commit f45c027f66
192 changed files with 2062 additions and 2076 deletions

View File

@@ -57,7 +57,7 @@ public:
static void set_stop_requested();
public:
app_config(provider_type prov, std::string_view data_directory = "");
app_config(provider_type prov, std::string_view data_directory);
app_config() = delete;
app_config(app_config &&) = delete;
@@ -73,7 +73,9 @@ private:
utils::atomic<std::string> api_password_;
std::atomic<std::uint16_t> api_port_;
utils::atomic<std::string> api_user_;
std::string cache_directory_;
std::atomic<bool> config_changed_;
std::string data_directory_;
std::atomic<database_type> db_type_{database_type::rocksdb};
std::atomic<std::uint8_t> download_timeout_secs_;
std::atomic<bool> enable_download_timeout_;
@@ -85,6 +87,7 @@ private:
std::atomic<std::uint32_t> eviction_delay_mins_;
std::atomic<bool> eviction_uses_accessed_time_;
std::atomic<std::uint16_t> high_freq_interval_secs_;
std::string log_directory_;
std::atomic<std::uint16_t> low_freq_interval_secs_;
std::atomic<std::uint64_t> max_cache_size_bytes_;
std::atomic<std::uint8_t> max_upload_count_;
@@ -96,11 +99,8 @@ private:
std::atomic<std::uint16_t> task_wait_ms_;
private:
std::string cache_directory_;
std::string data_directory_;
utils::atomic<encrypt_config> encrypt_config_;
utils::atomic<host_config> host_config_;
std::string log_directory_;
mutable std::recursive_mutex read_write_mutex_;
utils::atomic<remote::remote_config> remote_config_;
utils::atomic<remote::remote_mount> remote_mount_;
@@ -108,8 +108,7 @@ private:
utils::atomic<sia_config> sia_config_;
std::unordered_map<std::string, std::function<std::string()>>
value_get_lookup_;
std::unordered_map<std::string,
std::function<std::string(const std::string &)>>
std::unordered_map<std::string, std::function<std::string(std::string_view)>>
value_set_lookup_;
std::uint64_t version_{REPERTORY_CONFIG_VERSION};
@@ -119,6 +118,8 @@ private:
template <typename dest, typename source>
auto set_value(dest &dst, const source &src) -> bool;
auto set_value(utils::atomic<std::string> &dst, std::string_view src) -> bool;
public:
[[nodiscard]] auto get_api_password() const -> std::string;
@@ -188,21 +189,21 @@ public:
[[nodiscard]] auto get_task_wait_ms() const -> std::uint16_t;
[[nodiscard]] auto get_value_by_name(const std::string &name) const
[[nodiscard]] auto get_value_by_name(std::string_view name) const
-> std::string;
[[nodiscard]] auto get_raw_value_by_name(const std::string &name) const
[[nodiscard]] auto get_raw_value_by_name(std::string_view name) const
-> std::string;
[[nodiscard]] auto get_version() const -> std::uint64_t;
void save();
void set_api_password(const std::string &value);
void set_api_password(std::string_view value);
void set_api_port(std::uint16_t value);
void set_api_user(const std::string &value);
void set_api_user(std::string_view value);
void set_download_timeout_secs(std::uint8_t value);
@@ -254,8 +255,8 @@ public:
void set_task_wait_ms(std::uint16_t value);
[[nodiscard]] auto set_value_by_name(const std::string &name,
const std::string &value) -> std::string;
[[nodiscard]] auto set_value_by_name(std::string_view name,
std::string_view value) -> std::string;
};
} // namespace repertory

View File

@@ -62,14 +62,14 @@ public:
public:
[[nodiscard]] static auto construct_url(CURL *curl,
const std::string &relative_path,
std::string_view relative_path,
const host_config &cfg)
-> std::string;
[[nodiscard]] static auto create_host_config(const s3_config &cfg)
-> host_config;
[[nodiscard]] static auto url_encode(CURL *curl, const std::string &data,
[[nodiscard]] static auto url_encode(CURL *curl, std::string_view data,
bool allow_slash) -> std::string;
template <typename request_type>
@@ -97,14 +97,15 @@ public:
request.decryption_token.value());
if (not utils::encryption::read_encrypted_range(
request.range.value(), key,
[&](data_buffer &ct, std::uint64_t start_offset,
[&](data_buffer &buffer, std::uint64_t start_offset,
std::uint64_t end_offset) -> bool {
auto encrypted_request = request;
encrypted_request.decryption_token = std::nullopt;
encrypted_request.range = {{start_offset, end_offset}};
encrypted_request.response_handler =
[&ct](const auto &encrypted_data, long /*response_code*/) {
ct = encrypted_data;
[&buffer](const auto &encrypted_data,
long /*response_code*/) {
buffer = encrypted_data;
};
encrypted_request.total_size = std::nullopt;

View File

@@ -97,11 +97,11 @@ private:
static constexpr auto min_pool_size = 10U;
public:
void execute(const std::string &client_id, std::uint64_t thread_id,
void execute(std::string_view client_id, std::uint64_t thread_id,
const worker_callback &worker,
const worker_complete_callback &worker_complete);
void remove_client(const std::string &client_id);
void remove_client(std::string_view client_id);
void shutdown();
};

View File

@@ -49,12 +49,11 @@ private:
};
template <class op_t>
inline void run_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock,
op_t operation,
inline void
run_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock, op_t operation,
std::chrono::milliseconds deadline,
const std::string &event_name,
const std::string &function_name);
std::string_view event_name, std::string_view function_name);
void apply_common_socket_properties(boost::asio::ip::tcp::socket &sock);
@@ -78,12 +77,11 @@ void write_all_with_deadline(boost::asio::io_context &io_ctx,
std::chrono::milliseconds deadline);
template <class op_t>
inline void run_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock,
op_t operation,
inline void
run_with_deadline(boost::asio::io_context &io_ctx,
boost::asio::ip::tcp::socket &sock, op_t operation,
std::chrono::milliseconds deadline,
const std::string &event_name,
const std::string &function_name) {
std::string_view event_name, std::string_view function_name) {
deadline = std::max(deadline, std::chrono::milliseconds{250});
struct request_state final {
@@ -118,12 +116,12 @@ inline void run_with_deadline(boost::asio::io_context &io_ctx,
if (state->timed_out) {
repertory::event_system::instance().raise<repertory::packet_client_timeout>(
std::string(event_name), std::string(function_name));
throw std::runtime_error(event_name + " timed-out");
event_name, function_name);
throw std::runtime_error(std::string{event_name} + " timed-out");
}
if (state->err) {
throw std::runtime_error(event_name + " failed|err|" +
throw std::runtime_error(std::string{event_name} + " failed|err|" +
state->err.message());
}
}

View File

@@ -32,10 +32,10 @@ using boost::asio::ip::tcp;
namespace repertory {
class packet_server final {
public:
using closed_callback = std::function<void(const std::string &)>;
using closed_callback = std::function<void(std::string_view)>;
using message_complete_callback = client_pool::worker_complete_callback;
using message_handler_callback = std::function<void(
std::uint32_t, const std::string &, std::uint64_t, const std::string &,
std::uint32_t, std::string_view, std::uint64_t, std::string_view,
packet *, packet &, message_complete_callback)>;
public:
@@ -78,7 +78,7 @@ private:
std::unordered_map<std::string, std::uint32_t> connection_lookup_;
private:
void add_client(connection &conn, const std::string &client_id);
void add_client(connection &conn, std::string_view client_id);
[[nodiscard]] auto handshake(std::shared_ptr<connection> conn) const -> bool;

View File

@@ -68,43 +68,43 @@ public:
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
stop_type_callback stop_requested_cb) const = 0;
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
[[nodiscard]] virtual auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error = 0;
[[nodiscard]] virtual auto
get_directory_api_path(const std::string &source_path,
get_directory_api_path(std::string_view source_path,
std::string &api_path) const -> api_error = 0;
[[nodiscard]] virtual auto get_directory_data(const std::string &api_path,
[[nodiscard]] virtual auto get_directory_data(std::string_view api_path,
directory_data &data) const
-> api_error = 0;
[[nodiscard]] virtual auto
get_directory_source_path(const std::string &api_path,
get_directory_source_path(std::string_view api_path,
std::string &source_path) const -> api_error = 0;
[[nodiscard]] virtual auto get_file_api_path(const std::string &source_path,
[[nodiscard]] virtual auto get_file_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error = 0;
[[nodiscard]] virtual auto get_file_data(const std::string &api_path,
[[nodiscard]] virtual auto get_file_data(std::string_view api_path,
file_data &data) const
-> api_error = 0;
[[nodiscard]] virtual auto
get_file_source_path(const std::string &api_path,
get_file_source_path(std::string_view api_path,
std::string &source_path) const -> api_error = 0;
[[nodiscard]] virtual auto
get_item_list(stop_type_callback stop_requested_cb) const
-> std::vector<file_info> = 0;
[[nodiscard]] virtual auto get_source_path(const std::string &api_path,
[[nodiscard]] virtual auto get_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error = 0;
[[nodiscard]] virtual auto remove_item(const std::string &api_path)
[[nodiscard]] virtual auto remove_item(std::string_view api_path)
-> api_error = 0;
};
} // namespace repertory

View File

@@ -59,23 +59,23 @@ public:
[[nodiscard]] virtual auto get_resume_list() const
-> std::vector<resume_entry> = 0;
[[nodiscard]] virtual auto get_upload(const std::string &api_path) const
[[nodiscard]] virtual auto get_upload(std::string_view api_path) const
-> std::optional<upload_entry> = 0;
[[nodiscard]] virtual auto get_upload_active_list() const
-> std::vector<upload_active_entry> = 0;
[[nodiscard]] virtual auto remove_resume(const std::string &api_path)
[[nodiscard]] virtual auto remove_resume(std::string_view api_path)
-> bool = 0;
[[nodiscard]] virtual auto remove_upload(const std::string &api_path)
[[nodiscard]] virtual auto remove_upload(std::string_view api_path)
-> bool = 0;
[[nodiscard]] virtual auto remove_upload_active(const std::string &api_path)
[[nodiscard]] virtual auto remove_upload_active(std::string_view api_path)
-> bool = 0;
[[nodiscard]] virtual auto rename_resume(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] virtual auto rename_resume(std::string_view from_api_path,
std::string_view to_api_path)
-> bool = 0;
};
} // namespace repertory

View File

@@ -35,19 +35,19 @@ public:
std::function<void(const std::vector<std::string> &)> callback,
stop_type_callback stop_requested_cb) const = 0;
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
[[nodiscard]] virtual auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error = 0;
[[nodiscard]] virtual auto get_api_path_list() const
-> std::vector<std::string> = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
const std::string &key,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
std::string_view key,
std::string &value) const
-> api_error = 0;
@@ -58,22 +58,22 @@ public:
[[nodiscard]] virtual auto get_total_size() const -> std::uint64_t = 0;
virtual void remove_api_path(const std::string &api_path) = 0;
virtual void remove_api_path(std::string_view api_path) = 0;
[[nodiscard]] virtual auto remove_item_meta(const std::string &api_path,
const std::string &key)
[[nodiscard]] virtual auto remove_item_meta(std::string_view api_path,
std::string_view key)
-> api_error = 0;
[[nodiscard]] virtual auto rename_item_meta(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] virtual auto rename_item_meta(std::string_view from_api_path,
std::string_view to_api_path)
-> api_error = 0;
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path,
const std::string &key,
const std::string &value)
[[nodiscard]] virtual auto set_item_meta(std::string_view api_path,
std::string_view key,
std::string_view value)
-> api_error = 0;
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path,
[[nodiscard]] virtual auto set_item_meta(std::string_view api_path,
const api_meta_map &meta)
-> api_error = 0;
};

View File

@@ -62,8 +62,8 @@ private:
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action)
-> api_error;
[[nodiscard]] auto remove_item(const std::string &api_path,
const std::string &source_path,
[[nodiscard]] auto remove_item(std::string_view api_path,
std::string_view source_path,
rocksdb::Transaction *txn) -> rocksdb::Status;
public:
@@ -81,42 +81,42 @@ public:
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
stop_type_callback stop_requested_cb) const override;
[[nodiscard]] auto get_api_path(const std::string &source_path,
[[nodiscard]] auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_directory_api_path(const std::string &source_path,
[[nodiscard]] auto get_directory_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_directory_data(const std::string &api_path,
[[nodiscard]] auto get_directory_data(std::string_view api_path,
i_file_db::directory_data &data) const
-> api_error override;
[[nodiscard]] auto get_directory_source_path(const std::string &api_path,
[[nodiscard]] auto get_directory_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto get_file_api_path(const std::string &source_path,
[[nodiscard]] auto get_file_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_file_data(const std::string &api_path,
[[nodiscard]] auto get_file_data(std::string_view api_path,
i_file_db::file_data &data) const
-> api_error override;
[[nodiscard]] auto get_file_source_path(const std::string &api_path,
[[nodiscard]] auto get_file_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto get_item_list(stop_type_callback stop_requested_cb) const
-> std::vector<i_file_db::file_info> override;
[[nodiscard]] auto get_source_path(const std::string &api_path,
[[nodiscard]] auto get_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto remove_item(const std::string &api_path)
[[nodiscard]] auto remove_item(std::string_view api_path)
-> api_error override;
};
} // namespace repertory

View File

@@ -61,7 +61,7 @@ private:
std::string_view function_name,
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action) -> bool;
[[nodiscard]] auto remove_resume(const std::string &api_path,
[[nodiscard]] auto remove_resume(std::string_view api_path,
rocksdb::Transaction *txn)
-> rocksdb::Status;
@@ -84,23 +84,21 @@ public:
[[nodiscard]] auto get_resume_list() const
-> std::vector<resume_entry> override;
[[nodiscard]] auto get_upload(const std::string &api_path) const
[[nodiscard]] auto get_upload(std::string_view api_path) const
-> std::optional<upload_entry> override;
[[nodiscard]] auto get_upload_active_list() const
-> std::vector<upload_active_entry> override;
[[nodiscard]] auto remove_resume(const std::string &api_path)
[[nodiscard]] auto remove_resume(std::string_view api_path) -> bool override;
[[nodiscard]] auto remove_upload(std::string_view api_path) -> bool override;
[[nodiscard]] auto remove_upload_active(std::string_view api_path)
-> bool override;
[[nodiscard]] auto remove_upload(const std::string &api_path)
-> bool override;
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
-> bool override;
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_resume(std::string_view from_api_path,
std::string_view to_api_path)
-> bool override;
};

View File

@@ -54,7 +54,7 @@ private:
void create_or_open(bool clear);
[[nodiscard]] auto get_item_meta_json(const std::string &api_path,
[[nodiscard]] auto get_item_meta_json(std::string_view api_path,
json &json_data) const -> api_error;
[[nodiscard]] static auto
@@ -66,13 +66,12 @@ private:
std::function<rocksdb::Status(rocksdb::Transaction *txn)> action)
-> api_error;
[[nodiscard]] auto remove_api_path(const std::string &api_path,
const std::string &source_path,
[[nodiscard]] auto remove_api_path(std::string_view api_path,
std::string_view source_path,
rocksdb::Transaction *txn)
-> rocksdb::Status;
[[nodiscard]] auto update_item_meta(const std::string &api_path,
json json_data,
[[nodiscard]] auto update_item_meta(std::string_view api_path, json json_data,
rocksdb::Transaction *base_txn = nullptr,
rocksdb::Status *status = nullptr)
-> api_error;
@@ -84,19 +83,19 @@ public:
std::function<void(const std::vector<std::string> &)> callback,
stop_type_callback stop_requested_cb) const override;
[[nodiscard]] auto get_api_path(const std::string &source_path,
[[nodiscard]] auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_api_path_list() const
-> std::vector<std::string> override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
const std::string &key,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
std::string_view key,
std::string &value) const
-> api_error override;
@@ -107,22 +106,21 @@ public:
[[nodiscard]] auto get_total_size() const -> std::uint64_t override;
void remove_api_path(const std::string &api_path) override;
void remove_api_path(std::string_view api_path) override;
[[nodiscard]] auto remove_item_meta(const std::string &api_path,
const std::string &key)
[[nodiscard]] auto remove_item_meta(std::string_view api_path,
std::string_view key)
-> api_error override;
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_item_meta(std::string_view from_api_path,
std::string_view to_api_path)
-> api_error override;
[[nodiscard]] auto set_item_meta(const std::string &api_path,
const std::string &key,
const std::string &value)
[[nodiscard]] auto set_item_meta(std::string_view api_path,
std::string_view key, std::string_view value)
-> api_error override;
[[nodiscard]] auto set_item_meta(const std::string &api_path,
[[nodiscard]] auto set_item_meta(std::string_view api_path,
const api_meta_map &meta)
-> api_error override;
};

View File

@@ -57,42 +57,42 @@ public:
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
stop_type_callback stop_requested_cb) const override;
[[nodiscard]] auto get_api_path(const std::string &source_path,
[[nodiscard]] auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_directory_api_path(const std::string &source_path,
[[nodiscard]] auto get_directory_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_directory_data(const std::string &api_path,
[[nodiscard]] auto get_directory_data(std::string_view api_path,
i_file_db::directory_data &data) const
-> api_error override;
[[nodiscard]] auto get_directory_source_path(const std::string &api_path,
[[nodiscard]] auto get_directory_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto get_file_api_path(const std::string &source_path,
[[nodiscard]] auto get_file_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_file_data(const std::string &api_path,
[[nodiscard]] auto get_file_data(std::string_view api_path,
i_file_db::file_data &data) const
-> api_error override;
[[nodiscard]] auto get_file_source_path(const std::string &api_path,
[[nodiscard]] auto get_file_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto get_item_list(stop_type_callback stop_requested_cb) const
-> std::vector<i_file_db::file_info> override;
[[nodiscard]] auto get_source_path(const std::string &api_path,
[[nodiscard]] auto get_source_path(std::string_view api_path,
std::string &source_path) const
-> api_error override;
[[nodiscard]] auto remove_item(const std::string &api_path)
[[nodiscard]] auto remove_item(std::string_view api_path)
-> api_error override;
};
} // namespace repertory

View File

@@ -57,23 +57,21 @@ public:
[[nodiscard]] auto get_resume_list() const
-> std::vector<resume_entry> override;
[[nodiscard]] auto get_upload(const std::string &api_path) const
[[nodiscard]] auto get_upload(std::string_view api_path) const
-> std::optional<upload_entry> override;
[[nodiscard]] auto get_upload_active_list() const
-> std::vector<upload_active_entry> override;
[[nodiscard]] auto remove_resume(const std::string &api_path)
[[nodiscard]] auto remove_resume(std::string_view api_path) -> bool override;
[[nodiscard]] auto remove_upload(std::string_view api_path) -> bool override;
[[nodiscard]] auto remove_upload_active(std::string_view api_path)
-> bool override;
[[nodiscard]] auto remove_upload(const std::string &api_path)
-> bool override;
[[nodiscard]] auto remove_upload_active(const std::string &api_path)
-> bool override;
[[nodiscard]] auto rename_resume(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_resume(std::string_view from_api_path,
std::string_view to_api_path)
-> bool override;
};

View File

@@ -44,7 +44,7 @@ private:
constexpr static const auto table_name = "meta";
private:
[[nodiscard]] auto update_item_meta(const std::string &api_path,
[[nodiscard]] auto update_item_meta(std::string_view api_path,
api_meta_map meta) -> api_error;
public:
@@ -54,19 +54,19 @@ public:
std::function<void(const std::vector<std::string> &)> callback,
stop_type_callback stop_requested_cb) const override;
[[nodiscard]] auto get_api_path(const std::string &source_path,
[[nodiscard]] auto get_api_path(std::string_view source_path,
std::string &api_path) const
-> api_error override;
[[nodiscard]] auto get_api_path_list() const
-> std::vector<std::string> override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
const std::string &key,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
std::string_view key,
std::string &value) const
-> api_error override;
@@ -77,22 +77,21 @@ public:
[[nodiscard]] auto get_total_size() const -> std::uint64_t override;
void remove_api_path(const std::string &api_path) override;
void remove_api_path(std::string_view api_path) override;
[[nodiscard]] auto remove_item_meta(const std::string &api_path,
const std::string &key)
[[nodiscard]] auto remove_item_meta(std::string_view api_path,
std::string_view key)
-> api_error override;
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_item_meta(std::string_view from_api_path,
std::string_view to_api_path)
-> api_error override;
[[nodiscard]] auto set_item_meta(const std::string &api_path,
const std::string &key,
const std::string &value)
[[nodiscard]] auto set_item_meta(std::string_view api_path,
std::string_view key, std::string_view value)
-> api_error override;
[[nodiscard]] auto set_item_meta(const std::string &api_path,
[[nodiscard]] auto set_item_meta(std::string_view api_path,
const api_meta_map &meta)
-> api_error override;
};

View File

@@ -49,18 +49,18 @@ private:
std::recursive_mutex directory_mutex_;
public:
void execute_action(const std::string &api_path,
void execute_action(std::string_view api_path,
const execute_callback &execute);
[[nodiscard]] auto get_directory(std::uint64_t handle)
-> std::shared_ptr<directory_iterator>;
auto remove_directory(const std::string &api_path)
auto remove_directory(std::string_view api_path)
-> std::shared_ptr<directory_iterator>;
void remove_directory(std::uint64_t handle);
void set_directory(const std::string &api_path, std::uint64_t handle,
void set_directory(std::string_view api_path, std::uint64_t handle,
std::shared_ptr<directory_iterator> iterator);
};
} // namespace repertory

View File

@@ -30,8 +30,8 @@ class directory_iterator final {
public:
#if !defined(_WIN32)
using populate_stat_callback =
std::function<void(const std::string &, std::uint64_t,
const api_meta_map &, bool, struct stat *)>;
std::function<void(std::string_view, std::uint64_t, const api_meta_map &,
bool, struct stat *)>;
#endif
public:
explicit directory_iterator(directory_item_list list)
@@ -59,13 +59,13 @@ public:
[[nodiscard]] auto get_directory_item(std::size_t offset, directory_item &di)
-> api_error;
[[nodiscard]] auto get_directory_item(const std::string &api_path,
[[nodiscard]] auto get_directory_item(std::string_view api_path,
directory_item &di) -> api_error;
[[nodiscard]] auto get_json(std::size_t offset, json &item) -> int;
[[nodiscard]] auto
get_next_directory_offset(const std::string &api_path) const -> std::size_t;
[[nodiscard]] auto get_next_directory_offset(std::string_view api_path) const
-> std::size_t;
public:
auto operator=(const directory_iterator &iterator) noexcept

View File

@@ -46,7 +46,7 @@ private:
i_provider &provider_;
private:
[[nodiscard]] auto check_minimum_requirements(const std::string &file_path)
[[nodiscard]] auto check_minimum_requirements(std::string_view file_path)
-> bool;
[[nodiscard]] auto get_filtered_cached_files() -> std::deque<std::string>;

View File

@@ -622,7 +622,7 @@ public:
static void display_version_information(std::vector<const char *> args);
auto unmount(const std::string &mount_location) -> int;
auto unmount(std::string_view mount_location) -> int;
[[nodiscard]] auto get_mount_location() const -> std::string {
return mount_location_;

View File

@@ -67,7 +67,7 @@ private:
bool was_mounted_{false};
private:
void update_accessed_time(const std::string &api_path);
void update_accessed_time(std::string_view api_path);
void stop_all();
@@ -293,21 +293,21 @@ protected:
-> api_error override;
public:
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
[[nodiscard]] auto get_directory_item_count(std::string_view api_path) const
-> std::uint64_t override;
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
[[nodiscard]] auto get_directory_items(std::string_view api_path) const
-> directory_item_list override;
[[nodiscard]] auto get_file_size(const std::string &api_path) const
[[nodiscard]] auto get_file_size(std::string_view api_path) const
-> std::uint64_t override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
const std::string &name,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
std::string_view name,
std::string &value) const
-> api_error override;
@@ -324,21 +324,21 @@ public:
void get_volume_info(UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) const override;
[[nodiscard]] auto is_processing(const std::string &api_path) const
[[nodiscard]] auto is_processing(std::string_view api_path) const
-> bool override;
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_directory(std::string_view from_api_path,
std::string_view to_api_path)
-> int override;
[[nodiscard]] auto rename_file(const std::string &from_api_path,
const std::string &to_api_path, bool overwrite)
[[nodiscard]] auto rename_file(std::string_view from_api_path,
std::string_view to_api_path, bool overwrite)
-> int override;
void set_item_meta(const std::string &api_path, const std::string &key,
const std::string &value) override;
void set_item_meta(std::string_view api_path, std::string_view key,
std::string_view value) override;
void set_item_meta(const std::string &api_path,
void set_item_meta(std::string_view api_path,
const api_meta_map &meta) override;
};
} // namespace repertory

View File

@@ -47,11 +47,11 @@ protected:
-> api_error override;
protected:
[[nodiscard]] auto check_access(const std::string &api_path, int mask) const
[[nodiscard]] auto check_access(std::string_view api_path, int mask) const
-> api_error;
[[nodiscard]] auto
check_and_perform(const std::string &api_path, int parent_mask,
check_and_perform(std::string_view api_path, int parent_mask,
const std::function<api_error(api_meta_map &meta)> &action)
-> api_error;
@@ -86,22 +86,21 @@ protected:
-> mode_t;
static void get_timespec_from_meta(const api_meta_map &meta,
const std::string &name,
std::string_view name,
struct timespec &ts);
[[nodiscard]] static auto get_uid_from_meta(const api_meta_map &meta)
-> uid_t;
#if defined(__APPLE__)
[[nodiscard]] auto parse_xattr_parameters(const char *name,
const uint32_t &position,
std::string &attribute_name,
const std::string &api_path)
[[nodiscard]] auto
parse_xattr_parameters(const char *name, const uint32_t &position,
std::string &attribute_name, std::string_view api_path)
-> api_error;
#else // !defined(__APPLE__)
[[nodiscard]] auto parse_xattr_parameters(const char *name,
std::string &attribute_name,
const std::string &api_path)
std::string_view api_path)
-> api_error;
#endif // defined(__APPLE__)
@@ -109,29 +108,28 @@ protected:
[[nodiscard]] auto
parse_xattr_parameters(const char *name, const char *value, size_t size,
const uint32_t &position, std::string &attribute_name,
const std::string &api_path) -> api_error;
std::string_view api_path) -> api_error;
#else // !defined(__APPLE__)
[[nodiscard]] auto parse_xattr_parameters(const char *name, const char *value,
size_t size,
std::string &attribute_name,
const std::string &api_path)
[[nodiscard]] auto
parse_xattr_parameters(const char *name, const char *value, size_t size,
std::string &attribute_name, std::string_view api_path)
-> api_error;
#endif // defined(__APPLE__)
static void populate_stat(const std::string &api_path,
static void populate_stat(std::string_view api_path,
std::uint64_t size_or_count,
const api_meta_map &meta, bool directory,
i_provider &provider, struct stat *u_stat);
static void set_timespec_from_meta(const api_meta_map &meta,
const std::string &name,
std::string_view name,
struct timespec &ts);
public:
[[nodiscard]] auto check_owner(const std::string &api_path) const
[[nodiscard]] auto check_owner(std::string_view api_path) const
-> api_error override;
[[nodiscard]] auto check_parent_access(const std::string &api_path,
[[nodiscard]] auto check_parent_access(std::string_view api_path,
int mask) const -> api_error override;
[[nodiscard]] static auto validate_timespec(const timespec &spec) -> bool;

View File

@@ -32,30 +32,30 @@ class i_fuse_drive {
INTERFACE_SETUP(i_fuse_drive);
public:
[[nodiscard]] virtual auto check_owner(const std::string &api_path) const
[[nodiscard]] virtual auto check_owner(std::string_view api_path) const
-> api_error = 0;
[[nodiscard]] virtual auto check_parent_access(const std::string &api_path,
[[nodiscard]] virtual auto check_parent_access(std::string_view api_path,
int mask) const
-> api_error = 0;
[[nodiscard]] virtual auto
get_directory_item_count(const std::string &api_path) const
get_directory_item_count(std::string_view api_path) const
-> std::uint64_t = 0;
[[nodiscard]] virtual auto
get_directory_items(const std::string &api_path) const
get_directory_items(std::string_view api_path) const
-> directory_item_list = 0;
[[nodiscard]] virtual auto get_file_size(const std::string &api_path) const
[[nodiscard]] virtual auto get_file_size(std::string_view api_path) const
-> std::uint64_t = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
const std::string &name,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
std::string_view name,
std::string &value) const
-> api_error = 0;
@@ -72,22 +72,21 @@ public:
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) const = 0;
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const
[[nodiscard]] virtual auto is_processing(std::string_view api_path) const
-> bool = 0;
[[nodiscard]] virtual auto rename_directory(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] virtual auto rename_directory(std::string_view from_api_path,
std::string_view to_api_path)
-> int = 0;
[[nodiscard]] virtual auto rename_file(const std::string &from_api_path,
const std::string &to_api_path,
[[nodiscard]] virtual auto rename_file(std::string_view from_api_path,
std::string_view to_api_path,
bool overwrite) -> int = 0;
virtual void set_item_meta(const std::string &api_path,
const std::string &key,
const std::string &value) = 0;
virtual void set_item_meta(std::string_view api_path, std::string_view key,
std::string_view value) = 0;
virtual void set_item_meta(const std::string &api_path,
virtual void set_item_meta(std::string_view api_path,
const api_meta_map &meta) = 0;
};
} // namespace repertory

View File

@@ -198,17 +198,17 @@ public:
remote::file_handle handle)
-> packet::error_type override;
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_create_directory_snapshot(std::string_view path,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_read_directory_snapshot(std::string_view path,
remote::file_handle handle,
std::uint32_t page,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_release_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_release_directory_snapshot(std::string_view path,
remote::file_handle handle)
-> packet::error_type override;

View File

@@ -34,31 +34,31 @@ namespace remote_fuse {
class remote_server final : public virtual remote_server_base<i_fuse_drive> {
public:
remote_server(app_config &config, i_fuse_drive &drive,
const std::string &mount_location);
std::string_view mount_location);
private:
directory_cache directory_cache_;
std::atomic<std::uint64_t> next_handle_{0U};
private:
[[nodiscard]] auto construct_path(std::string path) -> std::string;
[[nodiscard]] auto construct_path(std::string_view path) -> std::string;
[[nodiscard]] auto construct_path(const std::wstring &path) -> std::string;
[[nodiscard]] auto construct_path(std::wstring_view path) -> std::string;
[[nodiscard]] static auto empty_as_zero(const json &data) -> std::string;
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
[[nodiscard]] auto populate_file_info(const std::string &api_path,
[[nodiscard]] auto populate_file_info(std::string_view api_path,
remote::file_info &r_info)
-> packet::error_type;
void populate_file_info(const std::string &api_path, UINT64 file_size,
void populate_file_info(std::string_view api_path, UINT64 file_size,
UINT32 attributes, remote::file_info &r_info);
static void populate_stat(const struct stat64 &u_stat, remote::stat &r_stat);
[[nodiscard]] auto update_to_windows_format(const std::string &root_api_path,
[[nodiscard]] auto update_to_windows_format(std::string_view root_api_path,
json &item) -> json &;
public:
@@ -228,17 +228,17 @@ public:
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
}
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_create_directory_snapshot(std::string_view path,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_read_directory_snapshot(std::string_view path,
remote::file_handle handle,
std::uint32_t page,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_release_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_release_directory_snapshot(std::string_view path,
remote::file_handle handle)
-> packet::error_type override;
@@ -277,7 +277,7 @@ public:
std::string &volume_label)
-> packet::error_type override;
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
[[nodiscard]] auto winfsp_mounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
@@ -315,7 +315,7 @@ public:
remote::file_info *r_info)
-> packet::error_type override;
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
[[nodiscard]] auto winfsp_unmounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto

View File

@@ -30,16 +30,18 @@ class i_remote_json {
public:
[[nodiscard]] virtual auto
json_create_directory_snapshot(const std::string &path,
json_create_directory_snapshot(std::string_view path, json &json_data)
-> packet::error_type = 0;
[[nodiscard]] virtual auto
json_read_directory_snapshot(std::string_view path,
remote::file_handle handle, std::uint32_t page,
json &json_data) -> packet::error_type = 0;
[[nodiscard]] virtual auto json_read_directory_snapshot(
const std::string &path, remote::file_handle handle,
std::uint32_t page, json &json_data) -> packet::error_type = 0;
[[nodiscard]] virtual auto json_release_directory_snapshot(
const std::string &path,
remote::file_handle handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto
json_release_directory_snapshot(std::string_view path,
remote::file_handle handle)
-> packet::error_type = 0;
};
} // namespace repertory

View File

@@ -62,9 +62,9 @@ private:
mutable std::recursive_mutex file_mutex_;
protected:
void add_directory(const std::string &client_id, std::uint64_t handle);
void add_directory(std::string_view client_id, std::uint64_t handle);
void close_all(const std::string &client_id);
void close_all(std::string_view client_id);
#if defined(_WIN32)
[[nodiscard]] auto get_directory_buffer(const native_handle &handle,
@@ -77,7 +77,7 @@ protected:
[[nodiscard]] auto get_open_info(const native_handle &handle, open_info &oi)
-> bool;
[[nodiscard]] auto has_open_directory(const std::string &client_id,
[[nodiscard]] auto has_open_directory(std::string_view client_id,
std::uint64_t handle) -> bool;
[[nodiscard]] auto has_compat_open_info(remote::file_handle handle,
@@ -91,29 +91,29 @@ protected:
return handle_lookup_.contains(handle) ? 0 : error_return;
}
void remove_all(const std::string &file_path);
void remove_all(std::string_view file_path);
void remove_and_close_all(const native_handle &handle);
void remove_compat_open_info(remote::file_handle handle);
auto remove_directory(const std::string &client_id, std::uint64_t handle)
auto remove_directory(std::string_view client_id, std::uint64_t handle)
-> bool;
void remove_open_info(const native_handle &handle);
void set_client_id(const native_handle &handle, const std::string &client_id);
void set_client_id(const native_handle &handle, std::string_view client_id);
void set_compat_client_id(remote::file_handle handle,
const std::string &client_id);
std::string_view client_id);
void set_compat_open_info(remote::file_handle handle,
const std::string &file_path);
std::string_view file_path);
void set_open_info(const native_handle &handle, open_info op_info);
public:
[[nodiscard]] auto get_open_file_count(const std::string &file_path) const
[[nodiscard]] auto get_open_file_count(std::string_view file_path) const
-> std::size_t;
};
} // namespace repertory

View File

@@ -46,7 +46,7 @@ class remote_server_base : public remote_open_file_table,
public virtual remote_fuse::i_remote_instance {
public:
using handler_callback = std::function<packet::error_type(
std::uint32_t, const std::string &, std::uint64_t, const std::string &,
std::uint32_t, std::string_view, std::uint64_t, std::string_view,
packet *, packet &)>;
public:
@@ -56,10 +56,11 @@ public:
auto operator=(remote_server_base &&) -> remote_server_base & = delete;
public:
remote_server_base(app_config &config, drive &drv, std::string mount_location)
remote_server_base(app_config &config, drive &drv,
std::string_view mount_location)
: config_(config),
drive_(drv),
mount_location_(std::move(mount_location)),
mount_location_(std::string(mount_location)),
client_pool_(config.get_remote_mount().client_pool_size) {
REPERTORY_USES_FUNCTION_NAME();
@@ -102,7 +103,8 @@ private:
std::unique_ptr<packet_server> packet_server_;
private:
const std::unordered_map<std::string, handler_callback> handler_lookup_ = {
const std::unordered_map<std::string_view, handler_callback> handler_lookup_ =
{
{
"::check",
[this](auto && /* service_flags */, auto && /* client_id */,
@@ -113,40 +115,40 @@ private:
{
"::fuse_access",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_access(request);
},
},
{
"::fuse_chflags",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_chflags(request);
},
},
{
"::fuse_chmod",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_chmod(request);
},
},
{
"::fuse_chown",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_chown(request);
},
},
{
"::fuse_create",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_create(client_id, request, response);
},
},
@@ -161,48 +163,48 @@ private:
{
"::fuse_fgetattr",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_fgetattr(request, response);
},
},
{
"::fuse_fsetattr_x",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_fsetattr_x(request);
},
},
{
"::fuse_fsync",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_fsync(request);
},
},
{
"::fuse_ftruncate",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_ftruncate(request);
},
},
{
"::fuse_getattr",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_getattr(request, response);
},
},
{
"::fuse_getxtimes",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_getxtimes(request, response);
},
},
@@ -217,176 +219,176 @@ private:
{
"::fuse_mkdir",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_mkdir(request);
},
},
{
"::fuse_open",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_open(client_id, request, response);
},
},
{
"::fuse_opendir",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_opendir(client_id, request, response);
},
},
{
"::fuse_read",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_read(request, response);
},
},
{
"::fuse_readdir",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_readdir(client_id, request, response);
},
},
{
"::fuse_release",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_release(request);
},
},
{
"::fuse_releasedir",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_releasedir(client_id, request);
},
},
{
"::fuse_rename",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_rename(request);
},
},
{
"::fuse_rmdir",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_rmdir(request);
},
},
{
"::fuse_setattr_x",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_setattr_x(request);
},
},
{
"::fuse_setbkuptime",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_setbkuptime(request);
},
},
{
"::fuse_setchgtime",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_setchgtime(request);
},
},
{
"::fuse_setcrtime",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_setcrtime(request);
},
},
{
"::fuse_setvolname",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_setvolname(request);
},
},
{
"::fuse_statfs",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_statfs(request, response);
},
},
{
"::fuse_statfs_x",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_fuse_statfs_x(request, response);
},
},
{
"::fuse_truncate",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_truncate(request);
},
},
{
"::fuse_unlink",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_unlink(request);
},
},
{
"::fuse_utimens",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_utimens(request);
},
},
{
"::fuse_write",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_write(request);
},
},
{
"::fuse_write_base64",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_fuse_write_base64(request);
},
},
{
"::json_create_directory_snapshot",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_json_create_directory_snapshot(
client_id, request, response);
},
@@ -394,17 +396,17 @@ private:
{
"::json_read_directory_snapshot",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
return this->handle_json_read_directory_snapshot(client_id, request,
response);
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_json_read_directory_snapshot(
client_id, request, response);
},
},
{
"::json_release_directory_snapshot",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_json_release_directory_snapshot(client_id,
request);
},
@@ -412,57 +414,58 @@ private:
{
"::winfsp_can_delete",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_winfsp_can_delete(request);
},
},
{
"::winfsp_cleanup",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_cleanup(request, response);
},
},
{
"::winfsp_close",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_winfsp_close(request);
},
},
{
"::winfsp_create",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_create(client_id, request, response);
},
},
{
"::winfsp_flush",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_flush(request, response);
},
},
{
"::winfsp_get_file_info",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_get_file_info(request, response);
},
},
{
"::winfsp_get_security_by_name",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
return this->handle_winfsp_get_security_by_name(request, response);
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_get_security_by_name(request,
response);
},
},
{
@@ -476,87 +479,87 @@ private:
{
"::winfsp_mounted",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_winfsp_mounted(request);
},
},
{
"::winfsp_open",
[this](auto && /* service_flags */, auto &&client_id,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_open(client_id, request, response);
},
},
{
"::winfsp_overwrite",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_overwrite(request, response);
},
},
{
"::winfsp_read",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_read(request, response);
},
},
{
"::winfsp_read_directory",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_read_directory(request, response);
},
},
{
"::winfsp_rename",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_winfsp_rename(request);
},
},
{
"::winfsp_set_basic_info",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_set_basic_info(request, response);
},
},
{
"::winfsp_set_file_size",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_set_file_size(request, response);
},
},
{
"::winfsp_unmounted",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto && /* response */) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto && /* response */) -> auto {
return this->handle_winfsp_unmounted(request);
},
},
{
"::winfsp_write",
[this](auto && /* service_flags */, auto && /* client_id */,
auto && /* thread_id */, auto && /* method */, auto &&request,
auto &&response) -> auto {
auto && /* thread_id */, auto && /* method */,
auto &&request, auto &&response) -> auto {
return this->handle_winfsp_write(request, response);
},
},
};
private:
void closed_handler(const std::string &client_id) {
void closed_handler(std::string_view client_id) {
client_pool_.remove_client(client_id);
close_all(client_id);
}
@@ -613,7 +616,7 @@ private:
return this->fuse_chown(path.c_str(), uid, gid);
}
[[nodiscard]] auto handle_fuse_create(const std::string &client_id,
[[nodiscard]] auto handle_fuse_create(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret{0};
@@ -779,7 +782,7 @@ private:
return this->fuse_mkdir(path.c_str(), mode);
}
[[nodiscard]] auto handle_fuse_open(const std::string &client_id,
[[nodiscard]] auto handle_fuse_open(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret{0};
@@ -803,7 +806,7 @@ private:
return ret;
}
[[nodiscard]] auto handle_fuse_opendir(const std::string &client_id,
[[nodiscard]] auto handle_fuse_opendir(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret{0};
@@ -846,7 +849,7 @@ private:
return ret;
}
[[nodiscard]] auto handle_fuse_readdir(const std::string &client_id,
[[nodiscard]] auto handle_fuse_readdir(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret{0};
@@ -886,7 +889,7 @@ private:
return this->fuse_release(path.c_str(), handle);
}
[[nodiscard]] auto handle_fuse_releasedir(const std::string &client_id,
[[nodiscard]] auto handle_fuse_releasedir(std::string_view client_id,
packet *request)
-> packet::error_type {
auto ret{0};
@@ -1131,7 +1134,7 @@ private:
}
[[nodiscard]] auto
handle_json_create_directory_snapshot(const std::string &client_id,
handle_json_create_directory_snapshot(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
std::int32_t ret{};
@@ -1152,7 +1155,7 @@ private:
}
[[nodiscard]] auto
handle_json_read_directory_snapshot(const std::string &client_id,
handle_json_read_directory_snapshot(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
std::int32_t ret{0};
@@ -1181,7 +1184,7 @@ private:
}
[[nodiscard]] auto handle_json_release_directory_snapshot(
const std::string &client_id, packet *request) -> packet::error_type {
std::string_view client_id, packet *request) -> packet::error_type {
std::int32_t ret{0};
std::string path;
@@ -1240,7 +1243,7 @@ private:
return this->winfsp_close(file_desc);
}
[[nodiscard]] auto handle_winfsp_create(const std::string &client_id,
[[nodiscard]] auto handle_winfsp_create(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret = static_cast<packet::error_type>(STATUS_SUCCESS);
@@ -1380,7 +1383,7 @@ private:
return ret;
}
[[nodiscard]] auto handle_winfsp_open(const std::string &client_id,
[[nodiscard]] auto handle_winfsp_open(std::string_view client_id,
packet *request, packet &response)
-> packet::error_type {
auto ret = static_cast<packet::error_type>(STATUS_SUCCESS);
@@ -1612,13 +1615,14 @@ private:
}
void
message_handler(std::uint32_t service_flags, const std::string &client_id,
std::uint64_t thread_id, const std::string &method,
message_handler(std::uint32_t service_flags, std::string_view client_id,
std::uint64_t thread_id, std::string_view method,
packet *request, packet &response,
packet_server::message_complete_callback message_complete) {
auto idx{method.find_last_of("::")};
auto lookup_method_name{
((idx == std::string::npos) ? "::" + method : method.substr(idx - 1)),
((idx == std::string::npos) ? "::" + std::string{method}
: method.substr(idx - 1)),
};
if (handler_lookup_.find(lookup_method_name) == handler_lookup_.end()) {
message_complete(static_cast<packet::error_type>(STATUS_NOT_IMPLEMENTED));

View File

@@ -32,22 +32,22 @@ class i_winfsp_drive {
public:
[[nodiscard]] virtual auto
get_directory_item_count(const std::string &api_path) const
get_directory_item_count(std::string_view api_path) const
-> std::uint64_t = 0;
[[nodiscard]] virtual auto
get_directory_items(const std::string &api_path) const
get_directory_items(std::string_view api_path) const
-> directory_item_list = 0;
[[nodiscard]] virtual auto get_file_size(const std::string &api_path) const
[[nodiscard]] virtual auto get_file_size(std::string_view api_path) const
-> std::uint64_t = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
const std::string &name,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
std::string_view name,
std::string &value) const
-> api_error = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path,
[[nodiscard]] virtual auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error = 0;
@@ -65,7 +65,7 @@ public:
virtual void get_volume_info(UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) const = 0;
[[nodiscard]] virtual auto populate_file_info(const std::string &api_path,
[[nodiscard]] virtual auto populate_file_info(std::string_view api_path,
remote::file_info &r_info) const
-> api_error = 0;
};

View File

@@ -68,7 +68,7 @@ public:
std::string &volume_label)
-> packet::error_type = 0;
[[nodiscard]] virtual auto winfsp_mounted(const std::wstring &location)
[[nodiscard]] virtual auto winfsp_mounted(std::wstring_view location)
-> packet::error_type = 0;
[[nodiscard]] virtual auto
@@ -107,7 +107,7 @@ public:
BOOLEAN set_allocation_size, remote::file_info *r_info)
-> packet::error_type = 0;
[[nodiscard]] virtual auto winfsp_unmounted(const std::wstring &location)
[[nodiscard]] virtual auto winfsp_unmounted(std::wstring_view location)
-> packet::error_type = 0;
[[nodiscard]] virtual auto

View File

@@ -50,16 +50,17 @@ private:
public:
[[nodiscard]] auto check() -> packet::error_type;
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_create_directory_snapshot(std::string_view path,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot(
const std::string &path, remote::file_handle handle,
std::uint32_t page, json &json_data) -> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot(std::string_view path,
remote::file_handle handle,
std::uint32_t page,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto
json_release_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_release_directory_snapshot(std::string_view path,
remote::file_handle handle)
-> packet::error_type override;
@@ -98,7 +99,7 @@ public:
std::string &volume_label)
-> packet::error_type override;
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
[[nodiscard]] auto winfsp_mounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
@@ -136,7 +137,7 @@ public:
remote::file_info *r_info)
-> packet::error_type override;
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
[[nodiscard]] auto winfsp_unmounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto

View File

@@ -36,7 +36,7 @@ namespace remote_winfsp {
class remote_server final : public virtual remote_server_base<i_winfsp_drive> {
public:
remote_server(app_config &config, i_winfsp_drive &drive,
const std::string &mount_location)
std::string_view mount_location)
: remote_server_base(config, drive,
utils::string::to_lower(mount_location)) {}
@@ -49,7 +49,7 @@ private:
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
[[nodiscard]] auto populate_file_info(const std::string &api_path,
[[nodiscard]] auto populate_file_info(std::string_view api_path,
remote::file_info &r_info)
-> packet::error_type;
@@ -215,17 +215,17 @@ public:
remote::group_id /* gid */) override {}
// JSON Layer
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_create_directory_snapshot(std::string_view path,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_read_directory_snapshot(std::string_view path,
remote::file_handle handle,
std::uint32_t page,
json &json_data)
-> packet::error_type override;
[[nodiscard]] auto json_release_directory_snapshot(const std::string &path,
[[nodiscard]] auto json_release_directory_snapshot(std::string_view path,
remote::file_handle handle)
-> packet::error_type override;
@@ -265,7 +265,7 @@ public:
std::string &volume_label)
-> packet::error_type override;
[[nodiscard]] auto winfsp_mounted(const std::wstring &location)
[[nodiscard]] auto winfsp_mounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto winfsp_open(PWSTR file_name, UINT32 create_options,
@@ -303,7 +303,7 @@ public:
remote::file_info *r_info)
-> packet::error_type override;
[[nodiscard]] auto winfsp_unmounted(const std::wstring &location)
[[nodiscard]] auto winfsp_unmounted(std::wstring_view location)
-> packet::error_type override;
[[nodiscard]] auto

View File

@@ -77,15 +77,15 @@ private:
private:
[[nodiscard]] auto handle_error(std::string_view function_name,
const std::string &api_path, api_error error,
std::string_view api_path, api_error error,
FileInfo *f_info, std::uint64_t file_size,
bool raise_on_failure_only = false) const
-> NTSTATUS;
static auto parse_mount_location(const std::wstring &mount_location)
static auto parse_mount_location(std::wstring_view mount_location)
-> std::string;
void populate_file_info(const std::string &api_path, std::uint64_t file_size,
void populate_file_info(std::string_view api_path, std::uint64_t file_size,
const api_meta_map &meta,
FSP_FSCTL_OPEN_FILE_INFO &ofi) const;
@@ -114,24 +114,24 @@ public:
auto Flush(PVOID file_node, PVOID file_desc, FileInfo *f_info)
-> NTSTATUS override;
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
[[nodiscard]] auto get_directory_item_count(std::string_view api_path) const
-> std::uint64_t override;
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
[[nodiscard]] auto get_directory_items(std::string_view api_path) const
-> directory_item_list override;
auto GetFileInfo(PVOID file_node, PVOID file_desc, FileInfo *f_info)
-> NTSTATUS override;
[[nodiscard]] auto get_file_size(const std::string &api_path) const
[[nodiscard]] auto get_file_size(std::string_view api_path) const
-> std::uint64_t override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
api_meta_map &meta) const
-> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
const std::string &name,
[[nodiscard]] auto get_item_meta(std::string_view api_path,
std::string_view name,
std::string &value) const
-> api_error override;
@@ -172,7 +172,7 @@ public:
BOOLEAN replace_attributes, UINT64 allocation_size,
FileInfo *f_info) -> NTSTATUS override;
[[nodiscard]] auto populate_file_info(const std::string &api_path,
[[nodiscard]] auto populate_file_info(std::string_view api_path,
remote::file_info &r_info) const
-> api_error override;

View File

@@ -28,12 +28,9 @@
namespace repertory {
struct curl_error final : public i_event {
curl_error() = default;
curl_error(CURLcode code_, std::string_view function_name_, std::string type_,
std::string url_)
: code(code_),
function_name(std::string{function_name_}),
type(std::move(type_)),
url(std::move(url_)) {}
curl_error(CURLcode code_, std::string_view function_name_,
std::string_view type_, std::string_view url_)
: code(code_), function_name(function_name_), type(type_), url(url_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"curl_error"};

View File

@@ -28,8 +28,8 @@
namespace repertory {
struct debug_log final : public i_event {
debug_log() = default;
debug_log(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
debug_log(std::string_view function_name_, std::string_view msg_)
: function_name(function_name_), msg(msg_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"debug_log"};

View File

@@ -28,11 +28,9 @@
namespace repertory {
struct directory_remove_failed final : public i_event {
directory_remove_failed() = default;
directory_remove_failed(std::string api_path_, api_error error_,
directory_remove_failed(std::string_view api_path_, api_error error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string(function_name_)) {}
: api_path(api_path_), error(error_), function_name(function_name_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"directory_remove_failed"};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct directory_removed final : public i_event {
directory_removed() = default;
directory_removed(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
directory_removed(std::string_view api_path_, std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"directory_removed"};

View File

@@ -28,12 +28,12 @@
namespace repertory {
struct directory_removed_externally final : public i_event {
directory_removed_externally() = default;
directory_removed_externally(std::string api_path_,
directory_removed_externally(std::string_view api_path_,
std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"directory_removed_externally"};

View File

@@ -28,11 +28,11 @@
namespace repertory {
struct download_begin final : public i_event {
download_begin() = default;
download_begin(std::string api_path_, std::string dest_path_,
download_begin(std::string_view api_path_, std::string_view dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"download_begin"};

View File

@@ -28,12 +28,12 @@
namespace repertory {
struct download_end final : public i_event {
download_end() = default;
download_end(std::string api_path_, std::string dest_path_, api_error error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
download_end(std::string_view api_path_, std::string_view dest_path_,
api_error error_, std::string_view function_name_)
: api_path(api_path_),
dest_path(dest_path_),
error(error_),
function_name(std::string(function_name_)) {}
function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"download_end"};

View File

@@ -28,11 +28,11 @@
namespace repertory {
struct download_progress final : public i_event {
download_progress() = default;
download_progress(std::string api_path_, std::string dest_path_,
download_progress(std::string_view api_path_, std::string_view dest_path_,
std::string_view function_name_, double progress_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)),
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_),
progress(progress_) {}
static constexpr event_level level{event_level::info};

View File

@@ -28,12 +28,13 @@
namespace repertory {
struct download_restore_failed final : public i_event {
download_restore_failed() = default;
download_restore_failed(std::string api_path_, std::string dest_path_,
std::string error_, std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)) {}
download_restore_failed(std::string_view api_path_,
std::string_view dest_path_, std::string_view error_,
std::string_view function_name_)
: api_path(api_path_),
dest_path(dest_path_),
error(error_),
function_name(function_name_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"download_restore_failed"};

View File

@@ -28,11 +28,11 @@
namespace repertory {
struct download_restored final : public i_event {
download_restored() = default;
download_restored(std::string api_path_, std::string dest_path_,
download_restored(std::string_view api_path_, std::string_view dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"download_restored"};

View File

@@ -28,13 +28,14 @@
namespace repertory {
struct download_resume_add_failed final : public i_event {
download_resume_add_failed() = default;
download_resume_add_failed(std::string api_path_, std::string dest_path_,
std::string error_,
download_resume_add_failed(std::string_view api_path_,
std::string_view dest_path_,
std::string_view error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)) {}
: api_path(api_path_),
dest_path(dest_path_),
error(error_),
function_name(function_name_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"download_resume_add_failed"};

View File

@@ -28,11 +28,11 @@
namespace repertory {
struct download_resume_added final : public i_event {
download_resume_added() = default;
download_resume_added(std::string api_path_, std::string dest_path_,
download_resume_added(std::string_view api_path_, std::string_view dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"download_resume_added"};

View File

@@ -28,11 +28,12 @@
namespace repertory {
struct download_resume_removed final : public i_event {
download_resume_removed() = default;
download_resume_removed(std::string api_path_, std::string dest_path_,
download_resume_removed(std::string_view api_path_,
std::string_view dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"download_resume_removed"};

View File

@@ -28,11 +28,12 @@
namespace repertory {
struct download_type_selected final : public i_event {
download_type_selected() = default;
download_type_selected(std::string api_path_, std::string dest_path_,
download_type_selected(std::string_view api_path_,
std::string_view dest_path_,
std::string_view function_name_, download_type type_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)),
: api_path(api_path_),
dest_path(dest_path_),
function_name(function_name_),
type(type_) {}
static constexpr event_level level{event_level::debug};

View File

@@ -30,9 +30,9 @@ namespace repertory {
struct drive_mount_failed final : public i_event {
drive_mount_failed() = default;
drive_mount_failed(NTSTATUS error_, std::string_view function_name_,
std::string mount_location_)
std::string_view mount_location_)
: error(error_),
function_name(std::string(function_name_)),
function_name(function_name_),
mount_location(std::move(mount_location_)) {}
static constexpr event_level level{event_level::error};

View File

@@ -29,10 +29,10 @@ namespace repertory {
struct drive_mount_result final : public i_event {
drive_mount_result() = default;
drive_mount_result(std::string_view function_name_,
std::string mount_location_, std::string result_)
: function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)),
result(std::move(result_)) {}
std::string_view mount_location_, std::string result_)
: function_name(function_name_),
mount_location(mount_location_),
result(result_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"drive_mount_result"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct drive_mounted final : public i_event {
drive_mounted() = default;
drive_mounted(std::string_view function_name_, std::string mount_location_)
: function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {}
drive_mounted(std::string_view function_name_,
std::string_view mount_location_)
: function_name(function_name_), mount_location(mount_location_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"drive_mounted"};

View File

@@ -29,7 +29,7 @@ namespace repertory {
struct drive_stop_timed_out final : public i_event {
drive_stop_timed_out() = default;
drive_stop_timed_out(std::string_view function_name_)
: function_name(std::string(function_name_)) {}
: function_name(function_name_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"drive_stop_timed_out"};

View File

@@ -29,9 +29,8 @@ namespace repertory {
struct drive_unmount_pending final : public i_event {
drive_unmount_pending() = default;
drive_unmount_pending(std::string_view function_name_,
std::string mount_location_)
: function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {}
std::string_view mount_location_)
: function_name(function_name_), mount_location(mount_location_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"drive_unmount_pending"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct drive_unmounted final : public i_event {
drive_unmounted() = default;
drive_unmounted(std::string_view function_name_, std::string mount_location_)
: function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {}
drive_unmounted(std::string_view function_name_,
std::string_view mount_location_)
: function_name(function_name_), mount_location(mount_location_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"drive_unmounted"};

View File

@@ -29,7 +29,7 @@ namespace repertory {
struct event_level_changed final : public i_event {
event_level_changed() = default;
event_level_changed(std::string_view function_name_, event_level new_level_)
: function_name(std::string(function_name_)), new_level(new_level_) {}
: function_name(function_name_), new_level(new_level_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"event_level_changed"};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct file_pinned final : public i_event {
file_pinned() = default;
file_pinned(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
file_pinned(std::string_view api_path_, std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"file_pinned"};

View File

@@ -28,11 +28,9 @@
namespace repertory {
struct file_remove_failed final : public i_event {
file_remove_failed() = default;
file_remove_failed(std::string api_path_, api_error error_,
file_remove_failed(std::string_view api_path_, api_error error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string(function_name_)) {}
: api_path(api_path_), error(error_), function_name(function_name_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"file_remove_failed"};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct file_removed final : public i_event {
file_removed() = default;
file_removed(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
file_removed(std::string_view api_path_, std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"file_removed"};

View File

@@ -28,12 +28,12 @@
namespace repertory {
struct file_removed_externally final : public i_event {
file_removed_externally() = default;
file_removed_externally(std::string api_path_,
file_removed_externally(std::string_view api_path_,
std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"file_removed_externally"};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct file_unpinned final : public i_event {
file_unpinned() = default;
file_unpinned(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
file_unpinned(std::string_view api_path_, std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"file_unpinned"};

View File

@@ -28,14 +28,14 @@
namespace repertory {
struct file_upload_completed final : public i_event {
file_upload_completed() = default;
file_upload_completed(std::string api_path_, bool cancelled_,
file_upload_completed(std::string_view api_path_, bool cancelled_,
api_error error_, std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
std::string_view source_path_)
: api_path(api_path_),
cancelled(cancelled_),
error(error_),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"file_upload_completed"};

View File

@@ -28,12 +28,13 @@
namespace repertory {
struct file_upload_failed final : public i_event {
file_upload_failed() = default;
file_upload_failed(std::string api_path_, std::string error_,
std::string_view function_name_, std::string source_path_)
: api_path(std::move(api_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
file_upload_failed(std::string_view api_path_, std::string_view error_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
error(error_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"file_upload_failed"};

View File

@@ -28,11 +28,12 @@
namespace repertory {
struct file_upload_not_found final : public i_event {
file_upload_not_found() = default;
file_upload_not_found(std::string api_path_, std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
file_upload_not_found(std::string_view api_path_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"file_upload_not_found"};

View File

@@ -28,11 +28,12 @@
namespace repertory {
struct file_upload_queued final : public i_event {
file_upload_queued() = default;
file_upload_queued(std::string api_path_, std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
file_upload_queued(std::string_view api_path_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"file_upload_queued"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct file_upload_removed final : public i_event {
file_upload_removed() = default;
file_upload_removed(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
file_upload_removed(std::string_view api_path_,
std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"file_upload_removed"};

View File

@@ -28,12 +28,13 @@
namespace repertory {
struct file_upload_retry final : public i_event {
file_upload_retry() = default;
file_upload_retry(std::string api_path_, api_error error_,
std::string_view function_name_, std::string source_path_)
: api_path(std::move(api_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
file_upload_retry(std::string_view api_path_, api_error error_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
error(error_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"file_upload_retry"};

View File

@@ -28,12 +28,13 @@
namespace repertory {
struct filesystem_item_added final : public i_event {
filesystem_item_added() = default;
filesystem_item_added(std::string api_parent_, std::string api_path_,
bool directory_, std::string_view function_name_)
: api_parent(std::move(api_parent_)),
api_path(std::move(api_path_)),
filesystem_item_added(std::string_view api_parent_,
std::string_view api_path_, bool directory_,
std::string_view function_name_)
: api_parent(api_parent_),
api_path(api_path_),
directory(directory_),
function_name(std::string(function_name_)) {}
function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"filesystem_item_added"};

View File

@@ -28,14 +28,14 @@
namespace repertory {
struct filesystem_item_closed final : public i_event {
filesystem_item_closed() = default;
filesystem_item_closed(std::string api_path_, bool changed_, bool directory_,
std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
filesystem_item_closed(std::string_view api_path_, bool changed_,
bool directory_, std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
changed(changed_),
directory(directory_),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"filesystem_item_closed"};

View File

@@ -28,12 +28,12 @@
namespace repertory {
struct filesystem_item_evicted final : public i_event {
filesystem_item_evicted() = default;
filesystem_item_evicted(std::string api_path_,
filesystem_item_evicted(std::string_view api_path_,
std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"filesystem_item_evicted"};

View File

@@ -28,16 +28,17 @@
namespace repertory {
struct filesystem_item_handle_closed final : public i_event {
filesystem_item_handle_closed() = default;
filesystem_item_handle_closed(std::string api_path_, bool changed_,
filesystem_item_handle_closed(std::string_view api_path_, bool changed_,
bool directory_,
std::string_view function_name_,
std::uint64_t handle_, std::string source_path_)
: api_path(std::move(api_path_)),
std::uint64_t handle_,
std::string_view source_path_)
: api_path(api_path_),
changed(changed_),
directory(directory_),
function_name(std::string(function_name_)),
function_name(function_name_),
handle(handle_),
source_path(std::move(source_path_)) {}
source_path(source_path_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"filesystem_item_handle_closed"};

View File

@@ -28,14 +28,15 @@
namespace repertory {
struct filesystem_item_handle_opened final : public i_event {
filesystem_item_handle_opened() = default;
filesystem_item_handle_opened(std::string api_path_, bool directory_,
filesystem_item_handle_opened(std::string_view api_path_, bool directory_,
std::string_view function_name_,
std::uint64_t handle_, std::string source_path_)
: api_path(std::move(api_path_)),
std::uint64_t handle_,
std::string_view source_path_)
: api_path(api_path_),
directory(directory_),
function_name(std::string(function_name_)),
function_name(function_name_),
handle(handle_),
source_path(std::move(source_path_)) {}
source_path(source_path_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"filesystem_item_handle_opened"};

View File

@@ -28,13 +28,13 @@
namespace repertory {
struct filesystem_item_opened final : public i_event {
filesystem_item_opened() = default;
filesystem_item_opened(std::string api_path_, bool directory_,
filesystem_item_opened(std::string_view api_path_, bool directory_,
std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
std::string_view source_path_)
: api_path(api_path_),
directory(directory_),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"filesystem_item_opened"};

View File

@@ -30,7 +30,7 @@ namespace repertory {
struct fuse_args_parsed final : public i_event {
fuse_args_parsed() = default;
fuse_args_parsed(std::string_view args_, std::string_view function_name_)
: args(std::move(args_)), function_name(std::string{function_name_}) {}
: args(args_), function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"fuse_args_parsed"};

View File

@@ -31,9 +31,7 @@ struct fuse_event final : public i_event {
fuse_event() = default;
fuse_event(std::string_view api_path_, std::int32_t error_,
std::string_view function_name_)
: api_path(std::string{api_path_}),
error(error_),
function_name(std::string{function_name_}) {}
: api_path(api_path_), error(error_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"fuse_event"};

View File

@@ -28,8 +28,8 @@
namespace repertory {
struct info_log final : public i_event {
info_log() = default;
info_log(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
info_log(std::string_view function_name_, std::string_view msg_)
: function_name(function_name_), msg(msg_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"info_log"};

View File

@@ -31,7 +31,7 @@ struct invalid_cache_size final : public i_event {
invalid_cache_size(std::uint64_t cache_size_, std::string_view function_name_,
std::uint64_t invalid_size_)
: cache_size(cache_size_),
function_name(std::string{function_name_}),
function_name(function_name_),
invalid_size(invalid_size_) {}
static constexpr event_level level{event_level::warn};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct item_timeout final : public i_event {
item_timeout() = default;
item_timeout(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
item_timeout(std::string_view api_path_, std::string_view function_name_)
: api_path(api_path_), function_name(function_name_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"item_timeout"};

View File

@@ -32,7 +32,7 @@ struct max_cache_size_reached final : public i_event {
std::string_view function_name_,
std::uint64_t max_cache_size_)
: cache_size(cache_size_),
function_name(std::string{function_name_}),
function_name(function_name_),
max_cache_size(max_cache_size_) {}
static constexpr event_level level{event_level::warn};

View File

@@ -29,9 +29,8 @@ namespace repertory {
struct orphaned_file_detected final : public i_event {
orphaned_file_detected() = default;
orphaned_file_detected(std::string_view function_name_,
std::string source_path_)
: function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: function_name(function_name_), source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"orphaned_file_detected"};

View File

@@ -28,13 +28,14 @@
namespace repertory {
struct orphaned_file_processing_failed final : public i_event {
orphaned_file_processing_failed() = default;
orphaned_file_processing_failed(std::string dest_path_, std::string error_,
orphaned_file_processing_failed(std::string_view dest_path_,
std::string_view error_,
std::string_view function_name_,
std::string source_path_)
: dest_path(std::move(dest_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: dest_path(dest_path_),
error(error_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{

View File

@@ -29,9 +29,8 @@ namespace repertory {
struct orphaned_source_file_detected final : public i_event {
orphaned_source_file_detected() = default;
orphaned_source_file_detected(std::string_view function_name_,
std::string source_path_)
: function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: function_name(function_name_), source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"orphaned_source_file_detected"};

View File

@@ -29,9 +29,8 @@ namespace repertory {
struct orphaned_source_file_removed final : public i_event {
orphaned_source_file_removed() = default;
orphaned_source_file_removed(std::string_view function_name_,
std::string source_path_)
: function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
std::string_view source_path_)
: function_name(function_name_), source_path(source_path_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"orphaned_source_file_removed"};

View File

@@ -30,8 +30,7 @@ struct packet_client_timeout final : public i_event {
packet_client_timeout() = default;
packet_client_timeout(std::string_view event_name_,
std::string_view function_name_)
: event_name(std::string(event_name_)),
function_name(std::string(function_name_)) {}
: event_name(event_name_), function_name(function_name_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"packet_client_timeout"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct polling_item_begin final : public i_event {
polling_item_begin() = default;
polling_item_begin(std::string_view function_name_, std::string item_name_)
: function_name(std::string(function_name_)),
item_name(std::move(item_name_)) {}
polling_item_begin(std::string_view function_name_,
std::string_view item_name_)
: function_name(function_name_), item_name(item_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"polling_item_begin"};

View File

@@ -28,9 +28,8 @@
namespace repertory {
struct polling_item_end final : public i_event {
polling_item_end() = default;
polling_item_end(std::string_view function_name_, std::string item_name_)
: function_name(std::string(function_name_)),
item_name(std::move(item_name_)) {}
polling_item_end(std::string_view function_name_, std::string_view item_name_)
: function_name(function_name_), item_name(item_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"polling_item_end"};

View File

@@ -29,11 +29,11 @@ namespace repertory {
struct provider_invalid_version final : public i_event {
provider_invalid_version() = default;
provider_invalid_version(std::string_view function_name_,
std::string required_version_,
std::string returned_version_)
: function_name(std::string(function_name_)),
required_version(std::move(required_version_)),
returned_version(std::move(returned_version_)) {}
std::string_view required_version_,
std::string_view returned_version_)
: function_name(function_name_),
required_version(required_version_),
returned_version(returned_version_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"provider_invalid_version"};

View File

@@ -29,9 +29,9 @@ namespace repertory {
struct provider_offline final : public i_event {
provider_offline() = default;
provider_offline(std::string_view function_name_,
std::string host_name_or_ip_, std::uint16_t port_)
: function_name(std::string(function_name_)),
host_name_or_ip(std::move(host_name_or_ip_)),
std::string_view host_name_or_ip_, std::uint16_t port_)
: function_name(function_name_),
host_name_or_ip(host_name_or_ip_),
port(port_) {}
static constexpr event_level level{event_level::warn};

View File

@@ -28,11 +28,12 @@
namespace repertory {
struct provider_upload_begin final : public i_event {
provider_upload_begin() = default;
provider_upload_begin(std::string api_path_, std::string_view function_name_,
std::string source_path_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
provider_upload_begin(std::string_view api_path_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"provider_upload_begin"};

View File

@@ -28,12 +28,13 @@
namespace repertory {
struct provider_upload_end final : public i_event {
provider_upload_end() = default;
provider_upload_end(std::string api_path_, api_error error_,
std::string_view function_name_, std::string source_path_)
: api_path(std::move(api_path_)),
provider_upload_end(std::string_view api_path_, api_error error_,
std::string_view function_name_,
std::string_view source_path_)
: api_path(api_path_),
error(error_),
function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {}
function_name(function_name_),
source_path(source_path_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"provider_upload_end"};

View File

@@ -29,11 +29,9 @@
namespace repertory {
struct remote_server_event final : public i_event {
remote_server_event() = default;
remote_server_event(std::string api_path_, packet::error_type error_,
remote_server_event(std::string_view api_path_, packet::error_type error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
: api_path(api_path_), error(error_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"remote_server_event"};

View File

@@ -28,8 +28,8 @@
namespace repertory {
struct repertory_exception final : public i_event {
repertory_exception() = default;
repertory_exception(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
repertory_exception(std::string_view function_name_, std::string_view msg_)
: function_name(function_name_), msg(msg_) {}
static constexpr event_level level{event_level::error};
static constexpr std::string_view name{"repertory_exception"};

View File

@@ -29,9 +29,8 @@ namespace repertory {
struct service_start_begin final : public i_event {
service_start_begin() = default;
service_start_begin(std::string_view function_name_,
std::string service_name_)
: function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {}
std::string_view service_name_)
: function_name(function_name_), service_name(service_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"service_start_begin"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct service_start_end final : public i_event {
service_start_end() = default;
service_start_end(std::string_view function_name_, std::string service_name_)
: function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {}
service_start_end(std::string_view function_name_,
std::string_view service_name_)
: function_name(function_name_), service_name(std::move(service_name_)) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"service_start_end"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct service_stop_begin final : public i_event {
service_stop_begin() = default;
service_stop_begin(std::string_view function_name_, std::string service_name_)
: function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {}
service_stop_begin(std::string_view function_name_,
std::string_view service_name_)
: function_name(function_name_), service_name(service_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"service_stop_begin"};

View File

@@ -28,9 +28,9 @@
namespace repertory {
struct service_stop_end final : public i_event {
service_stop_end() = default;
service_stop_end(std::string_view function_name_, std::string service_name_)
: function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {}
service_stop_end(std::string_view function_name_,
std::string_view service_name_)
: function_name(function_name_), service_name(service_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"service_stop_end"};

View File

@@ -28,8 +28,8 @@
namespace repertory {
struct trace_log final : public i_event {
trace_log() = default;
trace_log(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
trace_log(std::string_view function_name_, std::string_view msg_)
: function_name(function_name_), msg(msg_) {}
static constexpr event_level level{event_level::trace};
static constexpr std::string_view name{"trace_log"};

View File

@@ -29,7 +29,7 @@ namespace repertory {
struct unmount_requested final : public i_event {
unmount_requested() = default;
unmount_requested(std::string_view function_name_)
: function_name(std::string(function_name_)) {}
: function_name(function_name_) {}
static constexpr event_level level{event_level::info};
static constexpr std::string_view name{"unmount_requested"};

View File

@@ -29,10 +29,10 @@
namespace repertory {
struct unmount_result final : public i_event {
unmount_result() = default;
unmount_result(std::string_view function_name_, std::string mount_location_,
std::int32_t result_)
: function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)),
unmount_result(std::string_view function_name_,
std::string_view mount_location_, std::int32_t result_)
: function_name(function_name_),
mount_location(mount_location_),
result(result_) {}
static constexpr event_level level{event_level::info};

View File

@@ -28,8 +28,8 @@
namespace repertory {
struct warn_log final : public i_event {
warn_log() = default;
warn_log(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
warn_log(std::string_view function_name_, std::string_view msg_)
: function_name(function_name_), msg(msg_) {}
static constexpr event_level level{event_level::warn};
static constexpr std::string_view name{"warn_log"};

View File

@@ -29,11 +29,9 @@
namespace repertory {
struct winfsp_event final : public i_event {
winfsp_event() = default;
winfsp_event(std::string api_path_, NTSTATUS error_,
winfsp_event(std::string_view api_path_, NTSTATUS error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
: api_path(api_path_), error(error_), function_name(function_name_) {}
static constexpr event_level level{event_level::debug};
static constexpr std::string_view name{"winfsp_event"};

View File

@@ -81,27 +81,27 @@ private:
bool &is_unlinked) const
-> std::shared_ptr<i_closeable_open_file>;
[[nodiscard]] auto get_open_file_count(const std::string &api_path) const
[[nodiscard]] auto get_open_file_count(std::string_view api_path) const
-> std::size_t;
[[nodiscard]] auto get_stop_requested() const -> bool;
[[nodiscard]] auto open(const std::string &api_path, bool directory,
[[nodiscard]] auto open(std::string_view api_path, bool directory,
const open_file_data &ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &file,
std::shared_ptr<i_closeable_open_file> closeable_file)
-> api_error;
void queue_upload(const std::string &api_path, const std::string &source_path,
void queue_upload(std::string_view api_path, std::string_view source_path,
bool is_unlinked, bool no_lock);
void remove_resume(const std::string &api_path,
const std::string &source_path, bool no_lock);
void remove_resume(std::string_view api_path, std::string_view source_path,
bool no_lock);
void remove_upload(const std::string &api_path, bool no_lock);
void remove_upload(std::string_view api_path, bool no_lock);
void swap_renamed_items(std::string from_api_path, std::string to_api_path,
bool directory);
void swap_renamed_items(std::string_view from_api_path,
std::string_view to_api_path, bool directory);
void upload_completed(const file_upload_completed &evt);
@@ -110,43 +110,43 @@ private:
public:
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
auto handle_file_rename(const std::string &from_api_path,
const std::string &to_api_path) -> api_error;
auto handle_file_rename(std::string_view from_api_path,
std::string_view to_api_path) -> api_error;
void queue_upload(const i_open_file &file) override;
void remove_resume(const std::string &api_path,
const std::string &source_path) override;
void remove_resume(std::string_view api_path,
std::string_view source_path) override;
static auto remove_source_and_shrink_cache(const std::string &api_path,
const std::string &source_path,
static auto remove_source_and_shrink_cache(std::string_view api_path,
std::string_view source_path,
std::uint64_t file_size,
bool allocated) -> bool;
void remove_upload(const std::string &api_path) override;
void remove_upload(std::string_view api_path) override;
void store_resume(const i_open_file &file) override;
public:
void close(std::uint64_t handle);
[[nodiscard]] auto create(const std::string &api_path, api_meta_map &meta,
[[nodiscard]] auto create(std::string_view api_path, api_meta_map &meta,
open_file_data ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &file) -> api_error;
[[nodiscard]] auto download_pinned_file(const std::string &api_path)
[[nodiscard]] auto download_pinned_file(std::string_view api_path)
-> bool override;
[[nodiscard]] auto evict_file(const std::string &api_path) -> bool override;
[[nodiscard]] auto evict_file(std::string_view api_path) -> bool override;
[[nodiscard]] auto get_directory_item(const std::string &api_path,
[[nodiscard]] auto get_directory_item(std::string_view api_path,
directory_item &item) const
-> api_error override;
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
[[nodiscard]] auto get_directory_items(std::string_view api_path) const
-> directory_item_list override;
[[nodiscard]] auto get_open_file(const std::string &api_path,
[[nodiscard]] auto get_open_file(std::string_view api_path,
std::shared_ptr<i_open_file> &file) -> bool;
[[nodiscard]] auto get_open_file(std::uint64_t handle, bool write_supported,
@@ -164,7 +164,7 @@ public:
[[nodiscard]] auto has_no_open_file_handles() const -> bool override;
[[nodiscard]] auto is_processing(const std::string &api_path) const
[[nodiscard]] auto is_processing(std::string_view api_path) const
-> bool override;
#if defined(PROJECT_TESTING)
@@ -172,20 +172,20 @@ public:
const open_file_data &ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &file) -> api_error;
#endif // defined(PROJECT_TESTING)
[[nodiscard]] auto open(const std::string &api_path, bool directory,
[[nodiscard]] auto open(std::string_view api_path, bool directory,
const open_file_data &ofd, std::uint64_t &handle,
std::shared_ptr<i_open_file> &file) -> api_error;
[[nodiscard]] auto remove_directory(const std::string &api_path) -> api_error;
[[nodiscard]] auto remove_directory(std::string_view api_path) -> api_error;
[[nodiscard]] auto remove_file(const std::string &api_path) -> api_error;
[[nodiscard]] auto remove_file(std::string_view api_path) -> api_error;
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
const std::string &to_api_path)
[[nodiscard]] auto rename_directory(std::string_view from_api_path,
std::string_view to_api_path)
-> api_error;
[[nodiscard]] auto rename_file(const std::string &from_api_path,
const std::string &to_api_path, bool overwrite)
[[nodiscard]] auto rename_file(std::string_view from_api_path,
std::string_view to_api_path, bool overwrite)
-> api_error;
void start();

View File

@@ -31,18 +31,17 @@ class i_file_manager {
INTERFACE_SETUP(i_file_manager);
public:
[[nodiscard]] virtual auto download_pinned_file(const std::string &api_path)
[[nodiscard]] virtual auto download_pinned_file(std::string_view api_path)
-> bool = 0;
[[nodiscard]] virtual auto evict_file(const std::string &api_path)
-> bool = 0;
[[nodiscard]] virtual auto evict_file(std::string_view api_path) -> bool = 0;
[[nodiscard]] virtual auto get_directory_item(const std::string &api_path,
[[nodiscard]] virtual auto get_directory_item(std::string_view api_path,
directory_item &item) const
-> api_error = 0;
[[nodiscard]] virtual auto
get_directory_items(const std::string &api_path) const
get_directory_items(std::string_view api_path) const
-> directory_item_list = 0;
[[nodiscard]] virtual auto get_open_files() const
@@ -50,7 +49,7 @@ public:
[[nodiscard]] virtual auto has_no_open_file_handles() const -> bool = 0;
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const
[[nodiscard]] virtual auto is_processing(std::string_view api_path) const
-> bool = 0;
};
} // namespace repertory

View File

@@ -90,7 +90,7 @@ public:
[[nodiscard]] virtual auto resize(std::uint64_t new_file_size)
-> api_error = 0;
virtual void set_api_path(const std::string &api_path) = 0;
virtual void set_api_path(std::string_view api_path) = 0;
[[nodiscard]] virtual auto write(std::uint64_t write_offset,
const data_buffer &data,

Some files were not shown because too many files have changed in this diff Show More