1 Commits

Author SHA1 Message Date
fa439c634f v2.0.3-rc (#32)
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
# Changelog

## v2.0.3-rc

### Issues

* \#28 \[bug\] Address slow directory responses in S3 mounts for deeply nested directories
* \#29 \[bug\] S3 error responses are not being logged
* \#30 \[bug\] Sia provider error responses are not logged
* \#31 \[bug\] S3 provider should limit max key size to 1024

### Changes from v2.0.2-rc

* Always use direct for read-only providers
* Fixed externally removed files not being processed during cleanup
* Fixed http headers not being added for requests
* Fixed incorrect `stat` values for remote mounts
* Fixed invalid directory nullptr error on remote mounts
* Fixed memory leak in event system
* Refactored application shutdown
* Refactored event system
* Updated build system to Alpine 3.21.0
* Updated build system to MinGW-w64 12.0.0
* Updated copyright to 2018-2025

Reviewed-on: #32
2025-02-11 17:26:24 -06:00
121 changed files with 2375 additions and 1000 deletions

View File

@ -128,6 +128,7 @@ libcurl
libdsm libdsm
libevent libevent
libexample libexample
libexpat
libfuse3 libfuse3
libgmock libgmock
libgtest libgtest
@ -140,10 +141,12 @@ libuuid
libuuid_include_dirs libuuid_include_dirs
libvlc libvlc
linkflags linkflags
localappdata
lptr lptr
lpwstr lpwstr
markdownlint markdownlint
mbig mbig
minio
msvc msvc
msvcr120 msvcr120
msys2 msys2
@ -200,6 +203,7 @@ stduuid_project
strequal strequal
ularge_integer ularge_integer
uring uring
url
userenv userenv
utimens_impl utimens_impl
utimensat utimensat

View File

@ -4,10 +4,6 @@
### Issues ### Issues
* ~~\#12 \[Unit Test\] Complete all providers unit tests~~
* ~~\#20 Add support to evict open files~~
* ~~\#21 \[Unit Test \] Complete WinFSP unit tests~~
* ~~\#22 \[Unit Test\] Complete FUSE unit tests~~
* \#28 \[bug\] Address slow directory responses in S3 mounts for deeply nested directories * \#28 \[bug\] Address slow directory responses in S3 mounts for deeply nested directories
* \#29 \[bug\] S3 error responses are not being logged * \#29 \[bug\] S3 error responses are not being logged
* \#30 \[bug\] Sia provider error responses are not logged * \#30 \[bug\] Sia provider error responses are not logged
@ -16,6 +12,7 @@
### Changes from v2.0.2-rc ### Changes from v2.0.2-rc
* Always use direct for read-only providers * Always use direct for read-only providers
* Fixed externally removed files not being processed during cleanup
* Fixed http headers not being added for requests * Fixed http headers not being added for requests
* Fixed incorrect `stat` values for remote mounts * Fixed incorrect `stat` values for remote mounts
* Fixed invalid directory nullptr error on remote mounts * Fixed invalid directory nullptr error on remote mounts

View File

@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.27)
cmake_policy(SET CMP0135 NEW) cmake_policy(SET CMP0135 NEW)
cmake_policy(SET CMP0144 NEW) cmake_policy(SET CMP0144 NEW)
if (NOT PROJECT_INTERFACE)
message(FATAL_ERROR "Project must be compiled via 'make_win32.cmd'/'make_win32.sh' or 'make_unix.sh' build scripts. Invoking 'cmake' directly is not supported.")
endif()
project(${PROJECT_NAME} project(${PROJECT_NAME}
DESCRIPTION ${PROJECT_DESC} DESCRIPTION ${PROJECT_DESC}
HOMEPAGE_URL ${PROJECT_URL} HOMEPAGE_URL ${PROJECT_URL}
@ -158,6 +162,7 @@ endif()
-DPROJECT_FUSE=${PROJECT_FUSE} -DPROJECT_FUSE=${PROJECT_FUSE}
-DPROJECT_FUSE_INCLUDE_DIRS=${PROJECT_FUSE_INCLUDE_DIRS} -DPROJECT_FUSE_INCLUDE_DIRS=${PROJECT_FUSE_INCLUDE_DIRS}
-DPROJECT_GIT_REV=${PROJECT_GIT_REV} -DPROJECT_GIT_REV=${PROJECT_GIT_REV}
-DPROJECT_INTERFACE=1
-DPROJECT_IS_ALPINE=${PROJECT_IS_ALPINE} -DPROJECT_IS_ALPINE=${PROJECT_IS_ALPINE}
-DPROJECT_IS_ARM64=${PROJECT_IS_ARM64} -DPROJECT_IS_ARM64=${PROJECT_IS_ARM64}
-DPROJECT_IS_MINGW=${PROJECT_IS_MINGW} -DPROJECT_IS_MINGW=${PROJECT_IS_MINGW}

126
README.md
View File

@ -1,23 +1,22 @@
# Repertory # Repertory
Repertory allows you to mount AWS S3 and Sia via FUSE on Linux ~~/OS X~~ or via WinFSP Repertory allows you to mount S3 and Sia via FUSE on Linux or via WinFSP
on Windows. on Windows.
## Details and Features ## Details and Features
* Optimized for [Plex Media Server](https://www.plex.tv/) * Optimized for [Plex Media Server](https://www.plex.tv/)
* Single application to mount AWS S3 and/or Sia * Single application to mount S3 and/or Sia
* Remote mounting of Repertory instances on Linux ~~, OS X~~ and Windows * Remote mounting of Repertory instances on Linux and Windows
* Securely share your mounts over TCP/IP (`XChaCha20-Poly1305` stream cipher) * Securely share your mounts over TCP/IP via `XChaCha20-Poly1305` with other systems on your network or over the internet.
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64, ~~OS X,~~ Windows 64-bit) * Cross-platform support (Linux 64-bit, Linux arm64/aarch64, Windows 64-bit)
* Optionally encrypt file names and file data via `XChaCha20-Poly1305` in S3 mounts
## Minimum Requirements ## Minimum Requirements
* [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v0.4.0+ for Sia support * [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v0.4.0+ for Sia support
* Only 64-bit operating systems are supported * Only 64-bit operating systems are supported
* By default, Linux requires `fusermount3`; otherwise, `repertory` must be manually compiled with `libfuse2` support * By default, Linux requires `fusermount3`; otherwise, `repertory` must be manually compiled with `libfuse2` support
* ~~OS X requires the following dependency to be installed:~~
* ~~[FUSE for macOS v4.5.0](https://github.com/osxfuse/osxfuse/releases/download/macfuse-4.5.0/macfuse-4.5.0.dmg)~~
* Windows requires the following dependencies to be installed: * Windows requires the following dependencies to be installed:
* [WinFSP 2023](https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi) * [WinFSP 2023](https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi)
@ -25,47 +24,103 @@ on Windows.
* Linux `arm64/aarch64` * Linux `arm64/aarch64`
* Linux `amd64` * Linux `amd64`
* ~~OS X Mojave and above~~
* Windows 64-bit 10, 11 * Windows 64-bit 10, 11
## Usage ## Usage
### Sia
* Initial Configuration
* Sia steps:
* Set the appropriate bucket name and `renterd` API password in `repertory` configuration:
* To use `default` as the bucket name and configuration name:
* `repertory -set HostConfig.ApiPassword '<my password>'`
* To use a different bucket name with `default` as the configuration name:
* `repertory -set HostConfig.ApiPassword '<my password>'`
* `repertory -set SiaConfig.Bucket '<my bucket>'`
* For all other configurations:
* `repertory --name '<my config name>' -set HostConfig.ApiPassword '<my password>'`
* `repertory --name '<my config name>' -set SiaConfig.Bucket '<my bucket name>'`
* To verify/view all configuration options:
* `repertory -dc`
* `repertory --name '<my config name>' -dc`
* Example:
* `repertory --name default -dc`
* Mounting on Linux:
* `repertory /mnt/location`
* `repertory --name '<my config name>' /mnt/location`
* Example:
* `repertory --name default /mnt/location`
* Mounting on Windows:
* `repertory t:`
* `repertory --name '<my config name>' t:`
* Example:
* `repertory --name default t:`
### S3
* Initial Configuration
* S3 steps:
* Set the appropriate base URL:
* `repertory -s3 --name '<my config name>' -set S3Config.URL '<my url>'`
* Example:
* `repertory -s3 --name minio -set S3Config.URL 'http://localhost:9000'`
* Set the appropriate bucket name:
* `repertory -s3 --name '<my config name>' -set S3Config.Bucket '<my bucket name>'`
* Set the appropriate access key:
* `repertory -s3 --name '<my config name>' -set S3Config.AccessKey '<my access key>'`
* Set the appropriate secret key:
* `repertory -s3 --name '<my config name>' -set S3Config.SecretKey '<my secret key>'`
* For Sia and most local S3 gateway instances, enable path style URL's:
* `repertory -s3 --name '<my config name>' -set S3Config.UsePathStyle true`
* Optional steps:
* Set an appropriate region. Default is set to `any`:
* `repertory -s3 --name '<my config name>' -set S3Config.Region '<my region>'`
* Enable encrypted file names and file data. Set a strong, random encryption token and be sure to store it in a secure backup location:
* `repertory -s3 --name '<my config name>' -set S3Config.EncryptionToken '<my strong password>'`
* To verify/view all configuration options:
* `repertory -s3 --name '<my config name>' -dc`
* Example:
* `repertory -s3 --name minio -dc`
* Mounting on Linux:
* `repertory -s3 --name '<my config name>' /mnt/location`
* Example:
* `repertory -s3 --name minio /mnt/location`
* Mounting on Windows:
* `repertory -s3 --name '<my config name>' t:`
* Example:
* `repertory -s3 --name minio t:`
### Notable Options ### Notable Options
* `-dc`
* Display mount configuration.
* For Sia, `--name` is optional
* For S3, the `-s3` option is required along with `--name`
* `--help` * `--help`
* Display all mount utility options. * Display all mount utility options
* `--name, -na [name]` * `--name, -na [name]`
* The `--name` option can be set to any valid value allowed as a file name for your filesystem. * The `--name` option can be set to any valid value allowed as a file name for your filesystem.
* For Sia, the bucket name will be set to the same value if it is empty in the configuration file. * For Sia, the bucket name will be set to the same value if it is empty in the configuration file.
* If the `--name` option is not specified, `default` will be used. * If the `--name` option is not specified, `default` will be used.
* For S3, the `--name` option is required and does not affect the bucket name. * For S3, the `--name` option is required and does not affect the bucket name.
* `-set SiaConfig.Bucket` * `-dc`
* Set Sia bucket name for the mount. * Display mount configuration
* Can be used in combination with `--name` to target a unique configuration. * For Sia, `--name` is optional
* `-set S3Config.Bucket` * For S3, the `-s3` option is required along with `--name`
* S3 bucket name for the mount.
* Must be used in combination with `--name` to target a unique configuration.
* Must be used in combination with `-s3`.
### Sia ### Data Directories
* Linux * Linux
* `repertory /mnt/location` * `~/.local/repertory2`
* `repertory --name default /mnt/location`
* Windows * Windows
* `repertory.exe t:` * `%LOCALAPPDATA%\repertory2`
* `repertory.exe --name default t:` * Example:
* `C:\Users\Tom\AppData\Local\repertory2`
* IMPORTANT:
* It is highly recommended to exclude this folder from any anti-virus/anti-malware applications as severe performance issues may arise.
* Excluding the mounted drive letter is also highly recommended.
### S3 ## Remote Mounting
* Linux `Repertory` allows local mounts to be shared with other computers on your network.
* `repertory --name storj -s3 /mnt/location` This option is referred to as remote mounting. Instructions TBD.
* Windows
* `repertory.exe --name storj -s3 t:`
## Compiling ## Compiling
@ -94,17 +149,26 @@ on Windows.
## Credits ## Credits
* [binutils](https://www.gnu.org/software/binutils/)
* [boost c++ libraries](https://www.boost.org/) * [boost c++ libraries](https://www.boost.org/)
* [cpp-httplib](https://github.com/yhirose/cpp-httplib) * [cpp-httplib](https://github.com/yhirose/cpp-httplib)
* [curl](https://curl.haxx.se/) * [curl](https://curl.haxx.se/)
* ~~[FUSE for macOS](https://osxfuse.github.io/)~~ * [docker](https://www.docker.com/)
* [Google Test](https://github.com/google/googletest) * [Google Test](https://github.com/google/googletest)
* [ICU](https://icu.unicode.org/)
* [JSON for Modern C++](https://github.com/nlohmann/json) * [JSON for Modern C++](https://github.com/nlohmann/json)
* [libexpat](https://github.com/libexpat/libexpat)
* [libfuse](https://github.com/libfuse/libfuse) * [libfuse](https://github.com/libfuse/libfuse)
* [libsodium](https://doc.libsodium.org/) * [libsodium](https://doc.libsodium.org/)
* [mingw-w64](https://www.mingw-w64.org/)
* [MSYS2](https://www.msys2.org)
* [OpenSSL](https://www.openssl.org/) * [OpenSSL](https://www.openssl.org/)
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
* [pugixml](https://pugixml.org/)
* [RocksDB](https://rocksdb.org)
* [ScPrime](https://scpri.me/) * [ScPrime](https://scpri.me/)
* [Sia Decentralized Cloud Storage](https://sia.tech/) * [Sia Decentralized Cloud Storage](https://sia.tech/)
* [spdlog](https://github.com/gabime/spdlog)
* [SQLite](https://www.sqlite.org) * [SQLite](https://www.sqlite.org)
* [stduuid](https://github.com/mariusbancila/stduuid) * [stduuid](https://github.com/mariusbancila/stduuid)
* [Storj](https://storj.io/) * [Storj](https://storj.io/)

View File

@ -1,15 +1,15 @@
set(BINUTILS_VERSION 2.43) set(BINUTILS_VERSION 2.43)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(BOOST_MAJOR_VERSION 1) set(BOOST_MAJOR_VERSION 1)
set(BOOST_MINOR_VERSION 87) set(BOOST_MINOR_VERSION 87)
set(BOOST_PATCH_VERSION 0) set(BOOST_PATCH_VERSION 0)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(CPP_HTTPLIB_VERSION 0.18.1) set(CPP_HTTPLIB_VERSION 0.18.1)
set(CURL2_VERSION 8_11_0)
set(CURL_VERSION 8.11.0) set(CURL_VERSION 8.11.0)
set(EXPAT2_VERSION 2_6_4) set(CURL2_VERSION 8_11_0)
set(EXPAT_VERSION 2.6.4) set(EXPAT_VERSION 2.6.4)
set(EXPAT2_VERSION 2_6_4)
set(GCC_VERSION 14.2.0) set(GCC_VERSION 14.2.0)
set(GTEST_VERSION 1.15.2) set(GTEST_VERSION 1.15.2)
set(ICU_VERSION 76-1) set(ICU_VERSION 76-1)
@ -22,7 +22,7 @@ set(PKG_CONFIG_VERSION 0.29.2)
set(PUGIXML_VERSION 1.14) set(PUGIXML_VERSION 1.14)
set(ROCKSDB_VERSION 9.7.4) set(ROCKSDB_VERSION 9.7.4)
set(SPDLOG_VERSION 1.15.0) set(SPDLOG_VERSION 1.15.0)
set(SQLITE2_VERSION 3.46.1)
set(SQLITE_VERSION 3460100) set(SQLITE_VERSION 3460100)
set(SQLITE2_VERSION 3.46.1)
set(STDUUID_VERSION 1.2.3) set(STDUUID_VERSION 1.2.3)
set(ZLIB_VERSION 1.3.1) set(ZLIB_VERSION 1.3.1)

View File

@ -58,7 +58,10 @@ public:
drive_(drv), drive_(drv),
mount_location_(std::move(mount_location)), mount_location_(std::move(mount_location)),
client_pool_(config.get_remote_mount().client_pool_size) { client_pool_(config.get_remote_mount().client_pool_size) {
event_system::instance().raise<service_start_begin>("remote_server_base"); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>(function_name,
"remote_server_base");
handler_lookup_.insert( handler_lookup_.insert(
{"::winfsp_can_delete", {"::winfsp_can_delete",
[this](std::uint32_t, const std::string &, std::uint64_t, [this](std::uint32_t, const std::string &, std::uint64_t,
@ -1375,14 +1378,19 @@ public:
method, request, response, method, request, response,
message_complete); message_complete);
}); });
event_system::instance().raise<service_start_end>("remote_server_base"); event_system::instance().raise<service_start_end>(function_name,
"remote_server_base");
} }
~remote_server_base() override { ~remote_server_base() override {
event_system::instance().raise<service_stop_begin>("remote_server_base"); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_stop_begin>(function_name,
"remote_server_base");
client_pool_.shutdown(); client_pool_.shutdown();
packet_server_.reset(); packet_server_.reset();
event_system::instance().raise<service_stop_end>("remote_server_base"); event_system::instance().raise<service_stop_end>(function_name,
"remote_server_base");
} }
public: public:

View File

@ -37,7 +37,7 @@ public:
~console_consumer(); ~console_consumer();
private: private:
static void process_event2(const i_event &evt); static void process_event(const i_event &evt);
}; };
} // namespace repertory } // namespace repertory

View File

@ -40,7 +40,7 @@ private:
5ULL}; 5ULL};
private: private:
static void process_event2(const i_event &evt); static void process_event(const i_event &evt);
}; };
} // namespace repertory } // namespace repertory

View File

@ -127,14 +127,10 @@ private: \
#define E_CONSUMER_RELEASE() event_consumers_.clear() #define E_CONSUMER_RELEASE() event_consumers_.clear()
#define E_SUBSCRIBE(name, callback) \ #define E_SUBSCRIBE(event, callback) \
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \ event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
#name, [this](const i_event &evt) { callback(evt); })) event::name, [this](const i_event &evt) { \
callback(dynamic_cast<const event &>(evt)); \
#define E_SUBSCRIBE_EXACT(name, callback) \
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
#name, [this](const i_event &evt) { \
callback(dynamic_cast<const name &>(evt)); \
})) }))
#define E_SUBSCRIBE_ALL(callback) \ #define E_SUBSCRIBE_ALL(callback) \

View File

@ -1,120 +0,0 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
#define REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
#if 0
#include "types/repertory.hpp"
namespace repertory {
// clang-format off
E_SIMPLE2(download_restored, info,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE3(download_restore_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE3(download_resume_add_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE2(download_resume_added, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE2(download_resume_removed, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE3(download_type_selected, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING,
download_type, download_type, type, E_FROM_DOWNLOAD_TYPE
);
E_SIMPLE1(item_timeout, trace,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE2(invalid_cache_size, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, by, by, E_FROM_UINT64
);
E_SIMPLE2(max_cache_size_reached, warn,
std::uint64_t, cache_size, sz, E_FROM_UINT64,
std::uint64_t, max_cache_size, max, E_FROM_UINT64
);
E_SIMPLE2(packet_client_timeout, error,
std::string, event_name, en, E_FROM_STRING,
std::string, message, msg, E_FROM_STRING
);
//FUSE
E_SIMPLE3(fuse_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
int, result, res, E_FROM_INT32
);
E_SIMPLE1(fuse_args_parsed, info,
std::string, arguments, args, E_FROM_STRING
);
E_SIMPLE3(remote_fuse_server_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
//WINFSP
E_SIMPLE3(winfsp_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
NTSTATUS, result, res, E_FROM_INT32
);
E_SIMPLE(drive_stop_timed_out, info);
E_SIMPLE3(remote_winfsp_client_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
E_SIMPLE3(remote_winfsp_server_event, debug,
std::string, function, FUNC, E_FROM_STRING,
std::string, api_path, AP, E_FROM_STRING,
packet::error_type, result, RES, E_FROM_INT32
);
// clang-format on
} // namespace repertory
#endif // 0
#endif // REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_

View File

@ -33,6 +33,7 @@ struct curl_error final : public i_event {
function_name(std::string{function_name_}), function_name(std::string{function_name_}),
url(std::move(url_)) {} url(std::move(url_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"curl_error"}; static constexpr const std::string_view name{"curl_error"};
CURLcode code{}; CURLcode code{};
@ -40,7 +41,7 @@ struct curl_error final : public i_event {
std::string url; std::string url;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::error; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -31,13 +31,14 @@ struct debug_log final : public i_event {
debug_log(std::string_view function_name_, std::string msg_) debug_log(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {} : function_name(std::string(function_name_)), msg(std::move(msg_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"debug_log"}; static constexpr const std::string_view name{"debug_log"};
std::string function_name; std::string function_name;
std::string msg; std::string msg;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct directory_remove_failed final : public i_event {
error(error_), error(error_),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"directory_remove_failed"}; static constexpr const std::string_view name{"directory_remove_failed"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct directory_remove_failed final : public i_event {
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::error; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct directory_removed final : public i_event {
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"directory_removed"}; static constexpr const std::string_view name{"directory_removed"};
std::string api_path; std::string api_path;
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct directory_removed_externally final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"directory_removed_externally"}; static constexpr const std::string_view name{"directory_removed_externally"};
std::string api_path; std::string api_path;
@ -42,7 +43,7 @@ struct directory_removed_externally final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct download_begin final : public i_event {
dest_path(std::move(dest_path_)), dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"download_begin"}; static constexpr const std::string_view name{"download_begin"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct download_begin final : public i_event {
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct download_end final : public i_event {
error(error_), error(error_),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"download_end"}; static constexpr const std::string_view name{"download_end"};
std::string api_path; std::string api_path;
@ -43,7 +44,7 @@ struct download_end final : public i_event {
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct download_progress final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
progress(progress_) {} progress(progress_) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"download_progress"}; static constexpr const std::string_view name{"download_progress"};
std::string api_path; std::string api_path;
@ -43,7 +44,7 @@ struct download_progress final : public i_event {
double progress{}; double progress{};
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,81 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"download_restore_failed"};
std::string api_path;
std::string dest_path;
std::string error;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|error|{}", name, function_name,
api_path, dest_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_restore_failed> {
static void to_json(json &data,
const repertory::download_restore_failed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_restore_failed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("error").get_to<std::string>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_

View File

@ -0,0 +1,75 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_restored final : public i_event {
download_restored() = default;
download_restored(std::string api_path_, std::string 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_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"download_restored"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_restored> {
static void to_json(json &data, const repertory::download_restored &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::download_restored &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORED_HPP_

View File

@ -0,0 +1,82 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_,
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_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"download_resume_add_failed"};
std::string api_path;
std::string dest_path;
std::string error;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|error|{}", name, function_name,
api_path, dest_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_add_failed> {
static void to_json(json &data,
const repertory::download_resume_add_failed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_add_failed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("error").get_to<std::string>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADDED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADDED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_resume_added"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_added> {
static void to_json(json &data,
const repertory::download_resume_added &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_added &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADDED_HPP_

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_resume_removed"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_removed> {
static void to_json(json &data,
const repertory::download_resume_removed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_removed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_

View File

@ -0,0 +1,82 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_,
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_)),
type(type_) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_type_selected"};
std::string api_path;
std::string dest_path;
std::string function_name;
download_type type{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|type|{}", name, function_name,
api_path, dest_path, download_type_to_string(type));
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_type_selected> {
static void to_json(json &data,
const repertory::download_type_selected &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
data["type"] = repertory::download_type_to_string(value.type);
}
static void from_json(const json &data,
repertory::download_type_selected &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
value.type = repertory::download_type_from_string(
data.at("type").get<std::string>());
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_

View File

@ -29,20 +29,21 @@
namespace repertory { namespace repertory {
struct drive_mount_failed final : public i_event { struct drive_mount_failed final : public i_event {
drive_mount_failed() = default; drive_mount_failed() = default;
drive_mount_failed(std::string_view function_name_, drive_mount_failed(NTSTATUS error_, std::string_view function_name_,
std::string mount_location_, NTSTATUS status_) std::string mount_location_)
: function_name(std::string(function_name_)), : error(error_),
mount_location(std::move(mount_location_)), function_name(std::string(function_name_)),
status(status_) {} mount_location(std::move(mount_location_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"drive_mount_failed"}; static constexpr const std::string_view name{"drive_mount_failed"};
NTSTATUS error{};
std::string function_name; std::string function_name;
std::string mount_location; std::string mount_location;
NTSTATUS status{};
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::error; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {
@ -51,7 +52,7 @@ struct drive_mount_failed final : public i_event {
[[nodiscard]] auto get_single_line() const -> std::string override { [[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|location|{}|status|{}", name, function_name, return fmt::format("{}|func|{}|location|{}|status|{}", name, function_name,
mount_location, status); mount_location, error);
} }
}; };
} // namespace repertory } // namespace repertory
@ -59,16 +60,16 @@ struct drive_mount_failed final : public i_event {
NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::drive_mount_failed> { template <> struct adl_serializer<repertory::drive_mount_failed> {
static void to_json(json &data, const repertory::drive_mount_failed &value) { static void to_json(json &data, const repertory::drive_mount_failed &value) {
data["error"] = value.error;
data["function_name"] = value.function_name; data["function_name"] = value.function_name;
data["mount_location"] = value.mount_location; data["mount_location"] = value.mount_location;
data["status"] = value.status;
} }
static void from_json(const json &data, static void from_json(const json &data,
repertory::drive_mount_failed &value) { repertory::drive_mount_failed &value) {
data.at("error").get_to<NTSTATUS>(value.error);
data.at("function_name").get_to<std::string>(value.function_name); data.at("function_name").get_to<std::string>(value.function_name);
data.at("mount_location").get_to<std::string>(value.mount_location); data.at("mount_location").get_to<std::string>(value.mount_location);
data.at("status").get_to<NTSTATUS>(value.status);
} }
}; };
NLOHMANN_JSON_NAMESPACE_END NLOHMANN_JSON_NAMESPACE_END

View File

@ -34,6 +34,7 @@ struct drive_mount_result final : public i_event {
mount_location(std::move(mount_location_)), mount_location(std::move(mount_location_)),
result(std::move(result_)) {} result(std::move(result_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"drive_mount_result"}; static constexpr const std::string_view name{"drive_mount_result"};
std::string function_name; std::string function_name;
@ -41,7 +42,7 @@ struct drive_mount_result final : public i_event {
std::string result; std::string result;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct drive_mounted final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {} mount_location(std::move(mount_location_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"drive_mounted"}; static constexpr const std::string_view name{"drive_mounted"};
std::string function_name; std::string function_name;
std::string mount_location; std::string mount_location;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,67 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_STOP_TIMED_OUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_STOP_TIMED_OUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"drive_stop_timed_out"};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}", name, function_name);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::drive_stop_timed_out> {
static void to_json(json &data,
const repertory::drive_stop_timed_out &value) {
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::drive_stop_timed_out &value) {
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_STOP_TIMED_OUT_HPP_

View File

@ -33,13 +33,14 @@ struct drive_unmount_pending final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {} mount_location(std::move(mount_location_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"drive_unmount_pending"}; static constexpr const std::string_view name{"drive_unmount_pending"};
std::string function_name; std::string function_name;
std::string mount_location; std::string mount_location;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct drive_unmounted final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
mount_location(std::move(mount_location_)) {} mount_location(std::move(mount_location_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"drive_unmounted"}; static constexpr const std::string_view name{"drive_unmounted"};
std::string function_name; std::string function_name;
std::string mount_location; std::string mount_location;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -28,16 +28,17 @@
namespace repertory { namespace repertory {
struct event_level_changed final : public i_event { struct event_level_changed final : public i_event {
event_level_changed() = default; event_level_changed() = default;
event_level_changed(std::string_view function_name_, event_level level_) event_level_changed(std::string_view function_name_, event_level new_level_)
: function_name(std::string(function_name_)), level(level_) {} : function_name(std::string(function_name_)), new_level(new_level_) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"event_level_changed"}; static constexpr const std::string_view name{"event_level_changed"};
std::string function_name; std::string function_name;
event_level level{}; event_level new_level{};
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {
@ -46,7 +47,7 @@ struct event_level_changed final : public i_event {
[[nodiscard]] auto get_single_line() const -> std::string override { [[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|level|{}", name, function_name, return fmt::format("{}|func|{}|level|{}", name, function_name,
event_level_to_string(level)); event_level_to_string(new_level));
} }
}; };
} // namespace repertory } // namespace repertory
@ -54,14 +55,14 @@ struct event_level_changed final : public i_event {
NLOHMANN_JSON_NAMESPACE_BEGIN NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::event_level_changed> { template <> struct adl_serializer<repertory::event_level_changed> {
static void to_json(json &data, const repertory::event_level_changed &value) { static void to_json(json &data, const repertory::event_level_changed &value) {
data["event_level"] = repertory::event_level_to_string(value.level); data["new_level"] = repertory::event_level_to_string(value.new_level);
data["function_name"] = value.function_name; data["function_name"] = value.function_name;
} }
static void from_json(const json &data, static void from_json(const json &data,
repertory::event_level_changed &value) { repertory::event_level_changed &value) {
value.level = repertory::event_level_from_string( value.new_level = repertory::event_level_from_string(
data.at("event_level").get<std::string>()); data.at("new_level").get<std::string>());
data.at("function_name").get_to<std::string>(value.function_name); data.at("function_name").get_to<std::string>(value.function_name);
} }
}; };

View File

@ -32,13 +32,14 @@ struct file_pinned final : public i_event {
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"file_pinned"}; static constexpr const std::string_view name{"file_pinned"};
std::string api_path; std::string api_path;
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct file_remove_failed final : public i_event {
error(error_), error(error_),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"file_remove_failed"}; static constexpr const std::string_view name{"file_remove_failed"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct file_remove_failed final : public i_event {
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::error; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct file_removed final : public i_event {
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"file_removed"}; static constexpr const std::string_view name{"file_removed"};
std::string api_path; std::string api_path;
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct file_removed_externally final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"file_removed_externally"}; static constexpr const std::string_view name{"file_removed_externally"};
std::string api_path; std::string api_path;
@ -42,7 +43,7 @@ struct file_removed_externally final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct file_unpinned final : public i_event {
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"file_unpinned"}; static constexpr const std::string_view name{"file_unpinned"};
std::string api_path; std::string api_path;
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -37,6 +37,7 @@ struct file_upload_completed final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"file_upload_completed"}; static constexpr const std::string_view name{"file_upload_completed"};
std::string api_path; std::string api_path;
@ -46,7 +47,7 @@ struct file_upload_completed final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct file_upload_failed final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"file_upload_failed"}; static constexpr const std::string_view name{"file_upload_failed"};
std::string api_path; std::string api_path;
@ -43,7 +44,7 @@ struct file_upload_failed final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct file_upload_not_found final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"file_upload_not_found"}; static constexpr const std::string_view name{"file_upload_not_found"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct file_upload_not_found final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct file_upload_queued final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"file_upload_queued"}; static constexpr const std::string_view name{"file_upload_queued"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct file_upload_queued final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct file_upload_removed final : public i_event {
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"file_upload_removed"}; static constexpr const std::string_view name{"file_upload_removed"};
std::string api_path; std::string api_path;
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -28,22 +28,23 @@
namespace repertory { namespace repertory {
struct file_upload_retry final : public i_event { struct file_upload_retry final : public i_event {
file_upload_retry() = default; file_upload_retry() = default;
file_upload_retry(std::string api_path_, std::string error_, file_upload_retry(std::string api_path_, api_error error_,
std::string_view function_name_, std::string source_path_) std::string_view function_name_, std::string source_path_)
: api_path(std::move(api_path_)), : api_path(std::move(api_path_)),
error(std::move(error_)), error(std::move(error_)),
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"file_upload_retry"}; static constexpr const std::string_view name{"file_upload_retry"};
std::string api_path; std::string api_path;
std::string error; api_error error{};
std::string function_name; std::string function_name;
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {
@ -51,8 +52,8 @@ struct file_upload_retry final : public i_event {
} }
[[nodiscard]] auto get_single_line() const -> std::string override { [[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}|sp|{}", name, function_name, return fmt::format("{}|func|{}|ap|{}|sp|{}|error|{}", name, function_name,
api_path, error, source_path); api_path, source_path, api_error_to_string(error));
} }
}; };
} // namespace repertory } // namespace repertory
@ -61,14 +62,15 @@ NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::file_upload_retry> { template <> struct adl_serializer<repertory::file_upload_retry> {
static void to_json(json &data, const repertory::file_upload_retry &value) { static void to_json(json &data, const repertory::file_upload_retry &value) {
data["api_path"] = value.api_path; data["api_path"] = value.api_path;
data["error"] = value.error; data["error"] = repertory::api_error_to_string(value.error);
data["function_name"] = value.function_name; data["function_name"] = value.function_name;
data["source_path"] = value.source_path; data["source_path"] = value.source_path;
} }
static void from_json(const json &data, repertory::file_upload_retry &value) { static void from_json(const json &data, repertory::file_upload_retry &value) {
data.at("api_path").get_to<std::string>(value.api_path); data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<std::string>(value.error); value.error =
repertory::api_error_from_string(data.at("error").get<std::string>());
data.at("function_name").get_to<std::string>(value.function_name); data.at("function_name").get_to<std::string>(value.function_name);
data.at("source_path").get_to<std::string>(value.source_path); data.at("source_path").get_to<std::string>(value.source_path);
} }

View File

@ -35,6 +35,7 @@ struct filesystem_item_added final : public i_event {
directory(directory_), directory(directory_),
function_name(std::string(function_name_)) {} function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"filesystem_item_added"}; static constexpr const std::string_view name{"filesystem_item_added"};
std::string api_parent; std::string api_parent;
@ -43,7 +44,7 @@ struct filesystem_item_added final : public i_event {
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -37,6 +37,7 @@ struct filesystem_item_closed final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"filesystem_item_closed"}; static constexpr const std::string_view name{"filesystem_item_closed"};
std::string api_path; std::string api_path;
@ -46,7 +47,7 @@ struct filesystem_item_closed final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::trace; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct filesystem_item_evicted final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"filesystem_item_evicted"}; static constexpr const std::string_view name{"filesystem_item_evicted"};
std::string api_path; std::string api_path;
@ -42,7 +43,7 @@ struct filesystem_item_evicted final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -39,6 +39,7 @@ struct filesystem_item_handle_closed final : public i_event {
handle(handle_), handle(handle_),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"filesystem_item_handle_closed"}; static constexpr const std::string_view name{"filesystem_item_handle_closed"};
std::string api_path; std::string api_path;
@ -49,7 +50,7 @@ struct filesystem_item_handle_closed final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::trace; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -37,6 +37,7 @@ struct filesystem_item_handle_opened final : public i_event {
handle(handle_), handle(handle_),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"filesystem_item_handle_opened"}; static constexpr const std::string_view name{"filesystem_item_handle_opened"};
std::string api_path; std::string api_path;
@ -46,7 +47,7 @@ struct filesystem_item_handle_opened final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::trace; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -36,6 +36,7 @@ struct filesystem_item_opened final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"filesystem_item_opened"}; static constexpr const std::string_view name{"filesystem_item_opened"};
std::string api_path; std::string api_path;
@ -44,7 +45,7 @@ struct filesystem_item_opened final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::trace; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,70 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_ARGS_PARSED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_ARGS_PARSED_HPP_
#if !defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_}) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"fuse_args_parsed"};
std::string args;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|args|{}", name, function_name, args);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::fuse_args_parsed> {
static void to_json(json &data, const repertory::fuse_args_parsed &value) {
data["args"] = value.args;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::fuse_args_parsed &value) {
data.at("args").get_to<std::string>(value.args);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // !defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_ARGS_PARSED_HPP_

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_EVENT_HPP_
#if !defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
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_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"fuse_event"};
std::string api_path;
std::int32_t error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::fuse_event> {
static void to_json(json &data, const repertory::fuse_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::fuse_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<std::int32_t>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // !defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_EVENT_HPP_

View File

@ -0,0 +1,76 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_INVALID_CACHE_SIZE_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_INVALID_CACHE_SIZE_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct invalid_cache_size final : public i_event {
invalid_cache_size() = default;
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_}),
invalid_size(invalid_size_) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"invalid_cache_size"};
std::uint64_t cache_size{};
std::string function_name;
std::uint64_t invalid_size{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|size|{}|by|{}", name, function_name,
cache_size, invalid_size);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::invalid_cache_size> {
static void to_json(json &data, const repertory::invalid_cache_size &value) {
data["cache_size"] = value.cache_size;
data["function_name"] = value.function_name;
data["invalid_size"] = value.invalid_size;
}
static void from_json(const json &data,
repertory::invalid_cache_size &value) {
data.at("cache_size").get_to<std::uint64_t>(value.cache_size);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("invalid_size").get_to<std::uint64_t>(value.invalid_size);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_INVALID_CACHE_SIZE_HPP_

View File

@ -0,0 +1,69 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_ITEM_TIMEOUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_ITEM_TIMEOUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"item_timeout"};
std::string api_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}", name, function_name, api_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::item_timeout> {
static void to_json(json &data, const repertory::item_timeout &value) {
data["api_path"] = value.api_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::item_timeout &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ITEM_TIMEOUT_HPP_

View File

@ -0,0 +1,78 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_MAX_CACHE_SIZE_REACHED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_MAX_CACHE_SIZE_REACHED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct max_cache_size_reached final : public i_event {
max_cache_size_reached() = default;
max_cache_size_reached(std::uint64_t cache_size_,
std::string_view function_name_,
std::uint64_t max_cache_size_)
: cache_size(cache_size_),
function_name(std::string{function_name_}),
max_cache_size(max_cache_size_) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"max_cache_size_reached"};
std::uint64_t cache_size{};
std::string function_name;
std::uint64_t max_cache_size{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|size|{}|max|{}", name, function_name,
cache_size, max_cache_size);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::max_cache_size_reached> {
static void to_json(json &data,
const repertory::max_cache_size_reached &value) {
data["cache_size"] = value.cache_size;
data["function_name"] = value.function_name;
data["max_cache_size"] = value.max_cache_size;
}
static void from_json(const json &data,
repertory::max_cache_size_reached &value) {
data.at("cache_size").get_to<std::uint64_t>(value.cache_size);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("max_cache_size").get_to<std::uint64_t>(value.max_cache_size);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_MAX_CACHE_SIZE_REACHED_HPP_

View File

@ -33,13 +33,14 @@ struct orphaned_file_detected final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"orphaned_file_detected"}; static constexpr const std::string_view name{"orphaned_file_detected"};
std::string function_name; std::string function_name;
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -36,8 +36,10 @@ struct orphaned_file_processing_failed final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{ static constexpr const std::string_view name{
"orphaned_file_processing_failed"}; "orphaned_file_processing_failed",
};
std::string dest_path; std::string dest_path;
std::string error; std::string error;
@ -45,7 +47,7 @@ struct orphaned_file_processing_failed final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -33,13 +33,14 @@ struct orphaned_source_file_detected final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"orphaned_source_file_detected"}; static constexpr const std::string_view name{"orphaned_source_file_detected"};
std::string function_name; std::string function_name;
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -33,13 +33,14 @@ struct orphaned_source_file_removed final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"orphaned_source_file_removed"}; static constexpr const std::string_view name{"orphaned_source_file_removed"};
std::string function_name; std::string function_name;
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_PACKET_CLIENT_TIMEOUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_PACKET_CLIENT_TIMEOUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct packet_client_timeout final : public i_event {
packet_client_timeout() = default;
packet_client_timeout(std::string event_name_,
std::string_view function_name_, std::string msg_)
: event_name(std::move(event_name_)),
function_name(std::string(function_name_)),
msg(std::move(msg_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"packet_client_timeout"};
std::string event_name;
std::string function_name;
std::string msg;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|event|{}|msg|{}", name, function_name,
event_name, msg);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::packet_client_timeout> {
static void to_json(json &data,
const repertory::packet_client_timeout &value) {
data["event_name"] = value.event_name;
data["function_name"] = value.function_name;
data["msg"] = value.msg;
}
static void from_json(const json &data,
repertory::packet_client_timeout &value) {
data.at("event_name").get_to<std::string>(value.event_name);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("msg").get_to<std::string>(value.msg);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PACKET_CLIENT_TIMEOUT_HPP_

View File

@ -32,13 +32,14 @@ struct polling_item_begin final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
item_name(std::move(item_name_)) {} item_name(std::move(item_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"polling_item_begin"}; static constexpr const std::string_view name{"polling_item_begin"};
std::string function_name; std::string function_name;
std::string item_name; std::string item_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct polling_item_end final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
item_name(std::move(item_name_)) {} item_name(std::move(item_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"polling_item_end"}; static constexpr const std::string_view name{"polling_item_end"};
std::string function_name; std::string function_name;
std::string item_name; std::string item_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct provider_offline final : public i_event {
host_name_or_ip(std::move(host_name_or_ip_)), host_name_or_ip(std::move(host_name_or_ip_)),
port(port_) {} port(port_) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"provider_offline"}; static constexpr const std::string_view name{"provider_offline"};
std::string function_name; std::string function_name;
@ -41,7 +42,7 @@ struct provider_offline final : public i_event {
std::uint16_t port{}; std::uint16_t port{};
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -34,6 +34,7 @@ struct provider_upload_begin final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"provider_upload_begin"}; static constexpr const std::string_view name{"provider_upload_begin"};
std::string api_path; std::string api_path;
@ -41,7 +42,7 @@ struct provider_upload_begin final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::warn; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct provider_upload_end final : public i_event {
function_name(std::string(function_name_)), function_name(std::string(function_name_)),
source_path(std::move(source_path_)) {} source_path(std::move(source_path_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"provider_upload_end"}; static constexpr const std::string_view name{"provider_upload_end"};
std::string api_path; std::string api_path;
@ -43,7 +44,7 @@ struct provider_upload_end final : public i_event {
std::string source_path; std::string source_path;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_REMOTE_SERVER_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_REMOTE_SERVER_EVENT_HPP_
#include "comm/packet/packet.hpp"
#include "events/i_event.hpp"
#include "types/repertory.hpp"
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_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"remote_server_event"};
std::string api_path;
packet::error_type error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::remote_server_event> {
static void to_json(json &data, const repertory::remote_server_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::remote_server_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<repertory::packet::error_type>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_REMOTE_SERVER_EVENT_HPP_

View File

@ -31,13 +31,14 @@ struct repertory_exception final : public i_event {
repertory_exception(std::string_view function_name_, std::string msg_) repertory_exception(std::string_view function_name_, std::string msg_)
: function_name(std::string(function_name_)), msg(std::move(msg_)) {} : function_name(std::string(function_name_)), msg(std::move(msg_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"repertory_exception"}; static constexpr const std::string_view name{"repertory_exception"};
std::string function_name; std::string function_name;
std::string msg; std::string msg;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::error; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -33,13 +33,14 @@ struct service_start_begin final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {} service_name(std::move(service_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"service_start_begin"}; static constexpr const std::string_view name{"service_start_begin"};
std::string function_name; std::string function_name;
std::string service_name; std::string service_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct service_start_end final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {} service_name(std::move(service_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"service_start_end"}; static constexpr const std::string_view name{"service_start_end"};
std::string function_name; std::string function_name;
std::string service_name; std::string service_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct service_stop_begin final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {} service_name(std::move(service_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"service_stop_begin"}; static constexpr const std::string_view name{"service_stop_begin"};
std::string function_name; std::string function_name;
std::string service_name; std::string service_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -32,13 +32,14 @@ struct service_stop_end final : public i_event {
: function_name(std::string(function_name_)), : function_name(std::string(function_name_)),
service_name(std::move(service_name_)) {} service_name(std::move(service_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"service_stop_end"}; static constexpr const std::string_view name{"service_stop_end"};
std::string function_name; std::string function_name;
std::string service_name; std::string service_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::debug; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -31,12 +31,13 @@ struct unmount_requested final : public i_event {
unmount_requested(std::string_view function_name_) unmount_requested(std::string_view function_name_)
: function_name(std::string(function_name_)) {} : function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"unmount_requested"}; static constexpr const std::string_view name{"unmount_requested"};
std::string function_name; std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -35,6 +35,7 @@ struct unmount_result final : public i_event {
mount_location(std::move(mount_location_)), mount_location(std::move(mount_location_)),
result(result_) {} result(result_) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"unmount_result"}; static constexpr const std::string_view name{"unmount_result"};
std::string function_name; std::string function_name;
@ -42,7 +43,7 @@ struct unmount_result final : public i_event {
std::int32_t result{}; std::int32_t result{};
[[nodiscard]] auto get_event_level() const -> event_level override { [[nodiscard]] auto get_event_level() const -> event_level override {
return event_level::info; return level;
} }
[[nodiscard]] auto get_name() const -> std::string_view override { [[nodiscard]] auto get_name() const -> std::string_view override {

View File

@ -0,0 +1,77 @@
/*
Copyright <2018-2025> <scott.e.graves@protonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_WINFSP_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_WINFSP_EVENT_HPP_
#if defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct winfsp_event final : public i_event {
winfsp_event() = default;
winfsp_event(std::string api_path_, NTSTATUS error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"winfsp_event"};
std::string api_path;
NTSTATUS error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::winfsp_event> {
static void to_json(json &data, const repertory::winfsp_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::winfsp_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<NTSTATUS>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_WINFSP_EVENT_HPP_

View File

@ -31,18 +31,18 @@ public:
private: private:
const rpc_host_info host_info_; const rpc_host_info host_info_;
std::atomic<std::uint32_t> request_id_; std::atomic<std::uint32_t> request_id_{0U};
public: public:
[[nodiscard]] auto get_drive_information() -> rpc_response; [[nodiscard]] auto get_drive_information() -> rpc_response;
[[nodiscard]] auto get_config() -> rpc_response; [[nodiscard]] auto get_config() -> rpc_response;
[[nodiscard]] auto [[nodiscard]] auto get_config_value_by_name(const std::string &name)
get_config_value_by_name(const std::string &name) -> rpc_response; -> rpc_response;
[[nodiscard]] auto [[nodiscard]] auto get_directory_items(const std::string &api_path)
get_directory_items(const std::string &api_path) -> rpc_response; -> rpc_response;
[[nodiscard]] auto get_open_files() -> rpc_response; [[nodiscard]] auto get_open_files() -> rpc_response;
@ -52,9 +52,9 @@ public:
[[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response; [[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response;
[[nodiscard]] auto [[nodiscard]] auto set_config_value_by_name(const std::string &name,
set_config_value_by_name(const std::string &name, const std::string &value)
const std::string &value) -> rpc_response; -> rpc_response;
[[nodiscard]] auto unmount() -> rpc_response; [[nodiscard]] auto unmount() -> rpc_response;

View File

@ -43,7 +43,8 @@ constexpr const auto max_orphaned_file_retention_days{std::uint16_t(31U)};
constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)}; constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)};
constexpr const auto max_s3_object_name_length{1024U}; constexpr const auto max_s3_object_name_length{1024U};
constexpr const auto min_cache_size_bytes{ constexpr const auto min_cache_size_bytes{
std::uint64_t(100UL * 1024UL * 1024UL)}; std::uint64_t(100UL * 1024UL * 1024UL),
};
constexpr const auto min_download_timeout_secs{std::uint8_t(5U)}; constexpr const auto min_download_timeout_secs{std::uint8_t(5U)};
constexpr const auto min_online_check_retry_secs{std::uint16_t(15U)}; constexpr const auto min_online_check_retry_secs{std::uint16_t(15U)};
constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)}; constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)};

View File

@ -32,13 +32,13 @@ public:
public: public:
timeout(std::function<void()> timeout_callback, timeout(std::function<void()> timeout_callback,
const std::chrono::system_clock::duration &duration = 10s); std::chrono::system_clock::duration duration);
~timeout() { disable(); } ~timeout() { disable(); }
private: private:
std::atomic<bool> timeout_killed_; std::atomic<bool> timeout_killed_;
std::unique_ptr<std::thread> timeout_thread_; std::unique_ptr<std::thread> timeout_thread_{nullptr};
std::mutex timeout_mutex_; std::mutex timeout_mutex_;
std::condition_variable timeout_notify_; std::condition_variable timeout_notify_;

View File

@ -46,7 +46,8 @@ void client_pool::pool::execute(
client_pool::pool::pool(std::uint8_t pool_size) { client_pool::pool::pool(std::uint8_t pool_size) {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>("client_pool"); event_system::instance().raise<service_start_begin>(function_name,
"client_pool");
for (std::uint8_t i = 0U; i < pool_size; i++) { for (std::uint8_t i = 0U; i < pool_size; i++) {
pool_queues_.emplace_back(std::make_unique<work_queue>()); pool_queues_.emplace_back(std::make_unique<work_queue>());
@ -109,7 +110,8 @@ client_pool::pool::pool(std::uint8_t pool_size) {
}); });
} }
event_system::instance().raise<service_start_end>("client_pool"); event_system::instance().raise<service_start_end>(function_name,
"client_pool");
} }
void client_pool::pool::shutdown() { void client_pool::pool::shutdown() {
@ -151,11 +153,14 @@ void client_pool::remove_client(const std::string &client_id) {
} }
void client_pool::shutdown() { void client_pool::shutdown() {
REPERTORY_USES_FUNCTION_NAME();
if (shutdown_) { if (shutdown_) {
return; return;
} }
event_system::instance().raise<service_stop_begin>("client_pool"); event_system::instance().raise<service_stop_begin>(function_name,
"client_pool");
unique_mutex_lock pool_lock(pool_mutex_); unique_mutex_lock pool_lock(pool_mutex_);
if (not shutdown_) { if (not shutdown_) {
shutdown_ = true; shutdown_ = true;
@ -165,6 +170,7 @@ void client_pool::shutdown() {
pool_lookup_.clear(); pool_lookup_.clear();
} }
pool_lock.unlock(); pool_lock.unlock();
event_system::instance().raise<service_stop_end>("client_pool"); event_system::instance().raise<service_stop_end>(function_name,
"client_pool");
} }
} // namespace repertory } // namespace repertory

View File

@ -22,6 +22,7 @@
#include "comm/packet/packet_client.hpp" #include "comm/packet/packet_client.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/packet_client_timeout.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/collection.hpp" #include "utils/collection.hpp"
@ -105,8 +106,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
} }
} }
auto packet_client::read_packet(client &cli, auto packet_client::read_packet(client &cli, packet &response) const
packet &response) const -> packet::error_type { -> packet::error_type {
data_buffer buffer(sizeof(std::uint32_t)); data_buffer buffer(sizeof(std::uint32_t));
const auto read_buffer = [&]() { const auto read_buffer = [&]() {
std::uint32_t offset{}; std::uint32_t offset{};
@ -147,8 +148,8 @@ void packet_client::resolve() {
.resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port)); .resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port));
} }
auto packet_client::send(std::string_view method, auto packet_client::send(std::string_view method, std::uint32_t &service_flags)
std::uint32_t &service_flags) -> packet::error_type { -> packet::error_type {
packet request; packet request;
return send(method, request, service_flags); return send(method, request, service_flags);
} }
@ -160,8 +161,8 @@ auto packet_client::send(std::string_view method, packet &request,
} }
auto packet_client::send(std::string_view method, packet &request, auto packet_client::send(std::string_view method, packet &request,
packet &response, packet &response, std::uint32_t &service_flags)
std::uint32_t &service_flags) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto success = false; auto success = false;
@ -184,7 +185,7 @@ auto packet_client::send(std::string_view method, packet &request,
timeout request_timeout( timeout request_timeout(
[method, current_client]() { [method, current_client]() {
event_system::instance().raise<packet_client_timeout>( event_system::instance().raise<packet_client_timeout>(
"request", std::string{method}); "request", function_name, std::string{method});
packet_client::close(*current_client); packet_client::close(*current_client);
}, },
std::chrono::milliseconds(cfg_.send_timeout_ms)); std::chrono::milliseconds(cfg_.send_timeout_ms));
@ -206,7 +207,7 @@ auto packet_client::send(std::string_view method, packet &request,
timeout response_timeout( timeout response_timeout(
[method, current_client]() { [method, current_client]() {
event_system::instance().raise<packet_client_timeout>( event_system::instance().raise<packet_client_timeout>(
"response", std::string{method}); "response", function_name, std::string{method});
packet_client::close(*current_client); packet_client::close(*current_client);
}, },
std::chrono::milliseconds(cfg_.recv_timeout_ms)); std::chrono::milliseconds(cfg_.recv_timeout_ms));

View File

@ -40,13 +40,20 @@ packet_server::packet_server(std::uint16_t port, std::string token,
: encryption_token_(std::move(token)), : encryption_token_(std::move(token)),
closed_(std::move(closed)), closed_(std::move(closed)),
message_handler_(std::move(message_handler)) { message_handler_(std::move(message_handler)) {
event_system::instance().raise<service_start_begin>("packet_server"); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>(function_name,
"packet_server");
initialize(port, pool_size); initialize(port, pool_size);
event_system::instance().raise<service_start_end>("packet_server"); event_system::instance().raise<service_start_end>(function_name,
"packet_server");
} }
packet_server::~packet_server() { packet_server::~packet_server() {
event_system::instance().raise<service_stop_begin>("packet_server"); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_stop_begin>(function_name,
"packet_server");
std::thread([this]() { std::thread([this]() {
for (std::size_t i = 0U; i < service_threads_.size(); i++) { for (std::size_t i = 0U; i < service_threads_.size(); i++) {
io_context_.stop(); io_context_.stop();
@ -55,7 +62,8 @@ packet_server::~packet_server() {
server_thread_->join(); server_thread_->join();
server_thread_.reset(); server_thread_.reset();
event_system::instance().raise<service_stop_end>("packet_server"); event_system::instance().raise<service_stop_end>(function_name,
"packet_server");
} }
void packet_server::add_client(connection &conn, const std::string &client_id) { void packet_server::add_client(connection &conn, const std::string &client_id) {

View File

@ -191,6 +191,10 @@ void rdb_file_db::enumerate_item_list(
list.clear(); list.clear();
} }
} }
if (not list.empty()) {
callback(list);
}
} }
auto rdb_file_db::get_api_path(const std::string &source_path, auto rdb_file_db::get_api_path(const std::string &source_path,
@ -203,9 +207,8 @@ auto rdb_file_db::get_api_path(const std::string &source_path,
}); });
} }
auto rdb_file_db::get_directory_api_path(const std::string &source_path, auto rdb_file_db::get_directory_api_path(
std::string &api_path) const const std::string &source_path, std::string &api_path) const -> api_error {
-> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto result = perform_action(function_name, [&]() -> rocksdb::Status { auto result = perform_action(function_name, [&]() -> rocksdb::Status {
@ -228,9 +231,8 @@ auto rdb_file_db::get_directory_api_path(const std::string &source_path,
: result; : result;
} }
auto rdb_file_db::get_directory_source_path(const std::string &api_path, auto rdb_file_db::get_directory_source_path(
std::string &source_path) const const std::string &api_path, std::string &source_path) const -> api_error {
-> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto result = perform_action(function_name, [&]() -> rocksdb::Status { auto result = perform_action(function_name, [&]() -> rocksdb::Status {
@ -291,9 +293,8 @@ auto rdb_file_db::get_file_data(const std::string &api_path,
return result; return result;
} }
auto rdb_file_db::get_file_source_path(const std::string &api_path, auto rdb_file_db::get_file_source_path(
std::string &source_path) const const std::string &api_path, std::string &source_path) const -> api_error {
-> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto result = perform_action(function_name, [&]() -> rocksdb::Status { auto result = perform_action(function_name, [&]() -> rocksdb::Status {

View File

@ -81,6 +81,10 @@ void rdb_meta_db::enumerate_api_path_list(
callback(list); callback(list);
list.clear(); list.clear();
} }
if (not list.empty()) {
callback(list);
}
} }
auto rdb_meta_db::get_api_path(const std::string &source_path, auto rdb_meta_db::get_api_path(const std::string &source_path,
@ -314,10 +318,9 @@ void rdb_meta_db::remove_api_path(const std::string &api_path) {
} }
} }
auto rdb_meta_db::remove_api_path(const std::string &api_path, auto rdb_meta_db::remove_api_path(
const std::string &source_path, const std::string &api_path, const std::string &source_path,
rocksdb::Transaction *txn) rocksdb::Transaction *txn) -> rocksdb::Status {
-> rocksdb::Status {
auto txn_res = txn->Delete(pinned_family_, api_path); auto txn_res = txn->Delete(pinned_family_, api_path);
if (not txn_res.ok()) { if (not txn_res.ok()) {
return txn_res; return txn_res;

View File

@ -65,9 +65,8 @@ sqlite_file_db::sqlite_file_db(const app_config &cfg) {
sqlite_file_db::~sqlite_file_db() { db_.reset(); } sqlite_file_db::~sqlite_file_db() { db_.reset(); }
auto sqlite_file_db::add_directory(const std::string &api_path, auto sqlite_file_db::add_directory(
const std::string &source_path) const std::string &api_path, const std::string &source_path) -> api_error {
-> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto result = utils::db::sqlite::db_insert{*db_, file_table} auto result = utils::db::sqlite::db_insert{*db_, file_table}
@ -158,6 +157,10 @@ void sqlite_file_db::enumerate_item_list(
list.clear(); list.clear();
} }
} }
if (not list.empty()) {
callback(list);
}
} }
auto sqlite_file_db::get_api_path(const std::string &source_path, auto sqlite_file_db::get_api_path(const std::string &source_path,
@ -179,9 +182,8 @@ auto sqlite_file_db::get_api_path(const std::string &source_path,
return api_error::item_not_found; return api_error::item_not_found;
} }
auto sqlite_file_db::get_directory_api_path(const std::string &source_path, auto sqlite_file_db::get_directory_api_path(
std::string &api_path) const const std::string &source_path, std::string &api_path) const -> api_error {
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
@ -202,9 +204,8 @@ auto sqlite_file_db::get_directory_api_path(const std::string &source_path,
return api_error::directory_not_found; return api_error::directory_not_found;
} }
auto sqlite_file_db::get_directory_source_path(const std::string &api_path, auto sqlite_file_db::get_directory_source_path(
std::string &source_path) const const std::string &api_path, std::string &source_path) const -> api_error {
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
@ -225,9 +226,8 @@ auto sqlite_file_db::get_directory_source_path(const std::string &api_path,
return api_error::directory_not_found; return api_error::directory_not_found;
} }
auto sqlite_file_db::get_file_api_path(const std::string &source_path, auto sqlite_file_db::get_file_api_path(
std::string &api_path) const const std::string &source_path, std::string &api_path) const -> api_error {
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
@ -286,9 +286,8 @@ auto sqlite_file_db::get_file_data(const std::string &api_path,
return api_error::item_not_found; return api_error::item_not_found;
} }
auto sqlite_file_db::get_file_source_path(const std::string &api_path, auto sqlite_file_db::get_file_source_path(
std::string &source_path) const const std::string &api_path, std::string &source_path) const -> api_error {
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
@ -330,9 +329,8 @@ auto sqlite_file_db::get_item_list(stop_type_callback stop_requested_cb) const
return ret; return ret;
} }
auto sqlite_file_db::get_source_path(const std::string &api_path, auto sqlite_file_db::get_source_path(
std::string &source_path) const const std::string &api_path, std::string &source_path) const -> api_error {
-> api_error {
auto result = utils::db::sqlite::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")

View File

@ -95,6 +95,10 @@ void sqlite_meta_db::enumerate_api_path_list(
list.clear(); list.clear();
} }
} }
if (not list.empty()) {
callback(list);
}
} }
auto sqlite_meta_db::get_api_path(const std::string &source_path, auto sqlite_meta_db::get_api_path(const std::string &source_path,

View File

@ -39,12 +39,11 @@ auto directory_cache::get_directory(std::uint64_t handle)
-> std::shared_ptr<directory_iterator> { -> std::shared_ptr<directory_iterator> {
recur_mutex_lock directory_lock(directory_mutex_); recur_mutex_lock directory_lock(directory_mutex_);
auto iter = auto iter =
std::find_if(directory_lookup_.begin(), directory_lookup_.end(), std::ranges::find_if(directory_lookup_, [handle](auto &&item) -> bool {
[handle](auto &&item) -> bool { auto &&handles = item.second.handles;
auto &&handles = item.second.handles; return std::find(handles.begin(), handles.end(), handle) !=
return std::find(handles.begin(), handles.end(), handle) != item.second.handles.end();
item.second.handles.end(); });
});
if (iter != directory_lookup_.end()) { if (iter != directory_lookup_.end()) {
return iter->second.iterator; return iter->second.iterator;
} }
@ -68,12 +67,11 @@ auto directory_cache::remove_directory(const std::string &api_path)
void directory_cache::remove_directory(std::uint64_t handle) { void directory_cache::remove_directory(std::uint64_t handle) {
recur_mutex_lock directory_lock(directory_mutex_); recur_mutex_lock directory_lock(directory_mutex_);
auto iter = auto iter =
std::find_if(directory_lookup_.begin(), directory_lookup_.end(), std::ranges::find_if(directory_lookup_, [handle](auto &&item) -> bool {
[handle](auto &&item) -> bool { auto &&handles = item.second.handles;
auto &&handles = item.second.handles; return std::find(handles.begin(), handles.end(), handle) !=
return std::find(handles.begin(), handles.end(), handle) != item.second.handles.end();
item.second.handles.end(); });
});
if (iter == directory_lookup_.end()) { if (iter == directory_lookup_.end()) {
return; return;
} }

View File

@ -102,10 +102,9 @@ auto directory_iterator::get_directory_item(std::size_t offset,
auto directory_iterator::get_directory_item(const std::string &api_path, auto directory_iterator::get_directory_item(const std::string &api_path,
directory_item &di) -> api_error { directory_item &di) -> api_error {
auto iter = auto iter = std::ranges::find_if(items_, [&api_path](auto &&item) -> bool {
std::find_if(items_.begin(), items_.end(), [&](const auto &item) -> bool { return api_path == item.api_path;
return api_path == item.api_path; });
});
if (iter == items_.end()) { if (iter == items_.end()) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -126,10 +125,10 @@ auto directory_iterator::get_json(std::size_t offset, json &item) -> int {
auto directory_iterator::get_next_directory_offset( auto directory_iterator::get_next_directory_offset(
const std::string &api_path) const -> std::size_t { const std::string &api_path) const -> std::size_t {
const auto iter = std::find_if(items_.begin(), items_.end(), const auto iter =
[&api_path](const auto &dir_item) -> bool { std::ranges::find_if(items_, [&api_path](auto &&dir_item) -> bool {
return api_path == dir_item.api_path; return api_path == dir_item.api_path;
}); });
return (iter == items_.end()) ? 0U return (iter == items_.end()) ? 0U
: static_cast<std::size_t>( : static_cast<std::size_t>(

View File

@ -25,6 +25,8 @@
#include "app_config.hpp" #include "app_config.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/fuse_args_parsed.hpp"
#include "events/types/fuse_event.hpp"
#include "events/types/unmount_requested.hpp" #include "events/types/unmount_requested.hpp"
#include "events/types/unmount_result.hpp" #include "events/types/unmount_result.hpp"
#include "initialize.hpp" #include "initialize.hpp"
@ -90,7 +92,7 @@ fuse_base::fuse_base(app_config &config) : config_(config) {
fuse_ops_.flag_reserved = 0; fuse_ops_.flag_reserved = 0;
#endif // FUSE_USE_VERSION < 30 #endif // FUSE_USE_VERSION < 30
E_SUBSCRIBE_EXACT(unmount_requested, [this](const unmount_requested &) { E_SUBSCRIBE(unmount_requested, [this](const unmount_requested &) {
std::thread([this]() { this->shutdown(); }).detach(); std::thread([this]() { this->shutdown(); }).detach();
}); });
} }
@ -118,8 +120,8 @@ auto fuse_base::chflags_(const char *path, uint32_t flags) -> int {
#endif // __APPLE__ #endif // __APPLE__
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_base::chmod_(const char *path, mode_t mode, auto fuse_base::chmod_(const char *path, mode_t mode, struct fuse_file_info *fi)
struct fuse_file_info *fi) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -186,7 +188,7 @@ void fuse_base::display_options(
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
fuse_cmdline_help(); fuse_cmdline_help();
#else #else
struct fuse_operations fuse_ops {}; struct fuse_operations fuse_ops{};
fuse_main(args.size(), fuse_main(args.size(),
reinterpret_cast<char **>(const_cast<char **>(args.data())), reinterpret_cast<char **>(const_cast<char **>(args.data())),
&fuse_ops, nullptr); &fuse_ops, nullptr);
@ -196,7 +198,7 @@ void fuse_base::display_options(
} }
void fuse_base::display_version_information(std::vector<const char *> args) { void fuse_base::display_version_information(std::vector<const char *> args) {
struct fuse_operations fuse_ops {}; struct fuse_operations fuse_ops{};
fuse_main(static_cast<int>(args.size()), fuse_main(static_cast<int>(args.size()),
reinterpret_cast<char **>(const_cast<char **>(args.data())), reinterpret_cast<char **>(const_cast<char **>(args.data())),
&fuse_ops, nullptr); &fuse_ops, nullptr);
@ -334,8 +336,8 @@ auto fuse_base::getxtimes_(const char *path, struct timespec *bkuptime,
#endif // __APPLE__ #endif // __APPLE__
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_base::init_(struct fuse_conn_info *conn, auto fuse_base::init_(struct fuse_conn_info *conn, struct fuse_config *cfg)
struct fuse_config *cfg) -> void * { -> void * {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return execute_void_pointer_callback(function_name, [&]() -> void * { return execute_void_pointer_callback(function_name, [&]() -> void * {
@ -408,7 +410,7 @@ auto fuse_base::mount(std::vector<std::string> args) -> int {
char *mount_location{nullptr}; char *mount_location{nullptr};
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
struct fuse_cmdline_opts opts {}; struct fuse_cmdline_opts opts{};
fuse_parse_cmdline(&fa, &opts); fuse_parse_cmdline(&fa, &opts);
mount_location = opts.mountpoint; mount_location = opts.mountpoint;
#else #else
@ -477,8 +479,8 @@ auto fuse_base::read_(const char *path, char *buffer, size_t read_size,
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_base::readdir_(const char *path, void *buf, auto fuse_base::readdir_(const char *path, void *buf,
fuse_fill_dir_t fuse_fill_dir, off_t offset, fuse_fill_dir_t fuse_fill_dir, off_t offset,
struct fuse_file_info *fi, struct fuse_file_info *fi, fuse_readdir_flags flags)
fuse_readdir_flags flags) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -510,8 +512,8 @@ auto fuse_base::release_(const char *path, struct fuse_file_info *fi) -> int {
}); });
} }
auto fuse_base::releasedir_(const char *path, auto fuse_base::releasedir_(const char *path, struct fuse_file_info *fi)
struct fuse_file_info *fi) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -521,8 +523,8 @@ auto fuse_base::releasedir_(const char *path,
} }
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_base::rename_(const char *from, const char *to, auto fuse_base::rename_(const char *from, const char *to, unsigned int flags)
unsigned int flags) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -601,12 +603,17 @@ auto fuse_base::listxattr_(const char *path, char *buffer, size_t size) -> int {
} }
void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) { void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) {
event_system::instance().raise<fuse_args_parsed>(std::accumulate( REPERTORY_USES_FUNCTION_NAME();
args.begin(), args.end(), std::string(),
[](auto &&command_line, auto &&arg) -> auto { event_system::instance().raise<fuse_args_parsed>(
command_line += (command_line.empty() ? arg : (" " + std::string(arg))); std::accumulate(args.begin(), args.end(), std::string(),
return command_line; [](auto &&command_line, auto &&arg) -> auto {
})); command_line +=
(command_line.empty() ? arg
: (" " + std::string(arg)));
return command_line;
}),
function_name);
} }
auto fuse_base::parse_args(std::vector<std::string> &args) -> int { auto fuse_base::parse_args(std::vector<std::string> &args) -> int {
@ -701,7 +708,7 @@ void fuse_base::raise_fuse_event(std::string_view function_name,
(config_.get_event_level() >= event_level::trace)) { (config_.get_event_level() >= event_level::trace)) {
std::string func{function_name}; std::string func{function_name};
event_system::instance().raise<fuse_event>( event_system::instance().raise<fuse_event>(
utils::string::right_trim(func, '_'), std::string{api_path}, ret); api_path, ret, utils::string::right_trim(func, '_'));
} }
} }
@ -754,7 +761,7 @@ void fuse_base::shutdown() {
auto res = unmount(get_mount_location()); auto res = unmount(get_mount_location());
event_system::instance().raise<unmount_result>(function_name, event_system::instance().raise<unmount_result>(function_name,
get_mount_location(), res); get_mount_location(), res);
} }
#if defined(__APPLE__) #if defined(__APPLE__)
@ -767,8 +774,8 @@ auto fuse_base::setattr_x_(const char *path, struct setattr_x *attr) -> int {
}); });
} }
auto fuse_base::setbkuptime_(const char *path, auto fuse_base::setbkuptime_(const char *path, const struct timespec *bkuptime)
const struct timespec *bkuptime) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -777,8 +784,8 @@ auto fuse_base::setbkuptime_(const char *path,
}); });
} }
auto fuse_base::setchgtime_(const char *path, auto fuse_base::setchgtime_(const char *path, const struct timespec *chgtime)
const struct timespec *chgtime) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(
@ -787,8 +794,8 @@ auto fuse_base::setchgtime_(const char *path,
}); });
} }
auto fuse_base::setcrtime_(const char *path, auto fuse_base::setcrtime_(const char *path, const struct timespec *crtime)
const struct timespec *crtime) -> int { -> int {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
return instance().execute_callback( return instance().execute_callback(

View File

@ -33,6 +33,7 @@
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/drive_mount_result.hpp" #include "events/types/drive_mount_result.hpp"
#include "events/types/drive_mounted.hpp" #include "events/types/drive_mounted.hpp"
#include "events/types/drive_stop_timed_out.hpp"
#include "events/types/drive_unmount_pending.hpp" #include "events/types/drive_unmount_pending.hpp"
#include "events/types/drive_unmounted.hpp" #include "events/types/drive_unmounted.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -84,8 +85,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid) auto fuse_drive::chown_impl(std::string api_path, uid_t uid,
-> api_error { gid_t gid) -> api_error {
#endif #endif
return check_and_perform( return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error { api_path, X_OK, [&](api_meta_map &meta) -> api_error {
@ -281,6 +282,7 @@ void fuse_drive::stop_all() {
}); });
if (future.wait_for(30s) == std::future_status::timeout) { if (future.wait_for(30s) == std::future_status::timeout) {
event_system::instance().raise<drive_stop_timed_out>(function_name);
app_config::set_stop_requested(); app_config::set_stop_requested();
future.wait(); future.wait();
} }
@ -294,7 +296,7 @@ void fuse_drive::destroy_impl(void *ptr) {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_unmount_pending>(function_name, event_system::instance().raise<drive_unmount_pending>(function_name,
get_mount_location()); get_mount_location());
stop_all(); stop_all();
@ -303,7 +305,7 @@ void fuse_drive::destroy_impl(void *ptr) {
fuse_base::destroy_impl(ptr); fuse_base::destroy_impl(ptr);
event_system::instance().raise<drive_unmounted>(function_name, event_system::instance().raise<drive_unmounted>(function_name,
get_mount_location()); get_mount_location());
} }
auto fuse_drive::fallocate_impl(std::string /*api_path*/, int mode, auto fuse_drive::fallocate_impl(std::string /*api_path*/, int mode,
@ -492,8 +494,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st) auto fuse_drive::getattr_impl(std::string api_path,
-> api_error { struct stat *unix_st) -> api_error {
#endif #endif
auto parent = utils::path::get_parent_api_path(api_path); auto parent = utils::path::get_parent_api_path(api_path);
@ -559,8 +561,8 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
#endif // __APPLE__ #endif // __APPLE__
#if FUSE_USE_VERSION >= 30 #if FUSE_USE_VERSION >= 30
auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg) auto fuse_drive::init_impl(struct fuse_conn_info *conn,
-> void * { struct fuse_config *cfg) -> void * {
#else #else
void *fuse_drive::init_impl(struct fuse_conn_info *conn) { void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
#endif #endif
@ -617,7 +619,7 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
} }
event_system::instance().raise<drive_mounted>(function_name, event_system::instance().raise<drive_mounted>(function_name,
get_mount_location()); get_mount_location());
} catch (const std::exception &e) { } catch (const std::exception &e) {
utils::error::raise_error(function_name, e, "exception during fuse init"); utils::error::raise_error(function_name, e, "exception during fuse init");
@ -664,13 +666,17 @@ auto fuse_drive::mkdir_impl(std::string api_path, mode_t mode) -> api_error {
} }
void fuse_drive::notify_fuse_main_exit(int &ret) { void fuse_drive::notify_fuse_main_exit(int &ret) {
if (was_mounted_) { REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret)); if (not was_mounted_) {
event_system::instance().stop(); return;
logging_consumer_.reset();
console_consumer_.reset();
} }
event_system::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret));
event_system::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();
} }
auto fuse_drive::open_impl(std::string api_path, auto fuse_drive::open_impl(std::string api_path,
@ -798,9 +804,8 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
return api_error::success; return api_error::success;
} }
auto fuse_drive::releasedir_impl(std::string /*api_path*/, auto fuse_drive::releasedir_impl(
struct fuse_file_info *file_info) std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error {
-> api_error {
auto iter = directory_cache_->get_directory(file_info->fh); auto iter = directory_cache_->get_directory(file_info->fh);
if (iter == nullptr) { if (iter == nullptr) {
return api_error::invalid_handle; return api_error::invalid_handle;
@ -818,8 +823,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
} }
auto fuse_drive::rename_file(const std::string &from_api_path, auto fuse_drive::rename_file(const std::string &from_api_path,
const std::string &to_api_path, bool overwrite) const std::string &to_api_path,
-> int { bool overwrite) -> int {
auto res = fm_->rename_file(from_api_path, to_api_path, overwrite); auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
errno = std::abs(utils::from_api_error(res)); errno = std::abs(utils::from_api_error(res));
return (res == api_error::success) ? 0 : -1; return (res == api_error::success) ? 0 : -1;
@ -829,8 +834,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path, auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
unsigned int /*flags*/) -> api_error { unsigned int /*flags*/) -> api_error {
#else #else
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path) auto fuse_drive::rename_impl(std::string from_api_path,
-> api_error { std::string to_api_path) -> api_error {
#endif #endif
auto res = check_parent_access(to_api_path, W_OK | X_OK); auto res = check_parent_access(to_api_path, W_OK | X_OK);
if (res != api_error::success) { if (res != api_error::success) {
@ -932,15 +937,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
} }
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::getxattr_impl(std::string api_path, const char *name, auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
char *value, size_t size, int &attribute_size) char *value, size_t size,
-> api_error { int &attribute_size) -> api_error {
return getxattr_common(api_path, name, value, size, attribute_size, nullptr); return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
} }
#endif // __APPLE__ #endif // __APPLE__
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size, auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
int &required_size, bool &return_size) int &required_size,
-> api_error { bool &return_size) -> api_error {
auto check_size = (size == 0); auto check_size = (size == 0);
auto res = check_parent_access(api_path, X_OK); auto res = check_parent_access(api_path, X_OK);
@ -980,8 +985,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
return res; return res;
} }
auto fuse_drive::removexattr_impl(std::string api_path, const char *name) auto fuse_drive::removexattr_impl(std::string api_path,
-> api_error { const char *name) -> api_error {
std::string attribute_name; std::string attribute_name;
#if defined(__APPLE__) #if defined(__APPLE__)
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path); auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
@ -1009,8 +1014,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
uint32_t position) -> api_error { uint32_t position) -> api_error {
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::setxattr_impl(std::string api_path, const char *name, auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size, int flags) const char *value, size_t size,
-> api_error { int flags) -> api_error {
#endif #endif
std::string attribute_name; std::string attribute_name;
#if defined(__APPLE__) #if defined(__APPLE__)
@ -1088,8 +1093,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
} }
#if defined(__APPLE__) #if defined(__APPLE__)
auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr) auto fuse_drive::setattr_x_impl(std::string api_path,
-> api_error { struct setattr_x *attr) -> api_error {
bool exists{}; bool exists{};
auto res = provider_.is_file(api_path, exists); auto res = provider_.is_file(api_path, exists);
if (res != api_error::success) { if (res != api_error::success) {
@ -1143,7 +1148,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
ts[0].tv_sec = attr->acctime.tv_sec; ts[0].tv_sec = attr->acctime.tv_sec;
ts[0].tv_nsec = attr->acctime.tv_nsec; ts[0].tv_nsec = attr->acctime.tv_nsec;
} else { } else {
struct timeval tv{}; struct timeval tv {};
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ts[0].tv_sec = tv.tv_sec; ts[0].tv_sec = tv.tv_sec;
ts[0].tv_nsec = tv.tv_usec * 1000; ts[0].tv_nsec = tv.tv_usec * 1000;
@ -1188,9 +1193,8 @@ auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
return api_error::success; return api_error::success;
} }
auto fuse_drive::setbkuptime_impl(std::string api_path, auto fuse_drive::setbkuptime_impl(
const struct timespec *bkuptime) std::string api_path, const struct timespec *bkuptime) -> api_error {
-> api_error {
return check_and_perform( return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error { api_path, X_OK, [&](api_meta_map &meta) -> api_error {
auto nanos = bkuptime->tv_nsec + auto nanos = bkuptime->tv_nsec +
@ -1226,8 +1230,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
return api_error::success; return api_error::success;
} }
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf) auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
-> api_error { struct statfs *stbuf) -> api_error {
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) { if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
return api_error::os_error; return api_error::os_error;
} }
@ -1252,8 +1256,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
return api_error::success; return api_error::success;
} }
#else // __APPLE__ #else // __APPLE__
auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf) auto fuse_drive::statfs_impl(std::string /*api_path*/,
-> api_error { struct statvfs *stbuf) -> api_error {
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) { if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
return api_error::os_error; return api_error::os_error;
} }
@ -1337,8 +1341,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*file_info*/) struct fuse_file_info * /*file_info*/)
-> api_error { -> api_error {
#else #else
auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2]) auto fuse_drive::utimens_impl(std::string api_path,
-> api_error { const struct timespec tv[2]) -> api_error {
#endif #endif
api_meta_map meta; api_meta_map meta;
auto res = provider_.get_item_meta(api_path, meta); auto res = provider_.get_item_meta(api_path, meta);

View File

@ -26,6 +26,8 @@
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "providers/i_provider.hpp" #include "providers/i_provider.hpp"
#include "utils/common.hpp" #include "utils/common.hpp"
#include "utils/path.hpp"
#include "utils/string.hpp"
#include "utils/time.hpp" #include "utils/time.hpp"
namespace repertory { namespace repertory {
@ -33,8 +35,8 @@ auto fuse_drive_base::access_impl(std::string api_path, int mask) -> api_error {
return check_access(api_path, mask); return check_access(api_path, mask);
} }
auto fuse_drive_base::check_access(const std::string &api_path, int mask) const auto fuse_drive_base::check_access(const std::string &api_path,
-> api_error { int mask) const -> api_error {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
api_meta_map meta; api_meta_map meta;
@ -135,9 +137,8 @@ auto fuse_drive_base::check_and_perform(
return action(meta); return action(meta);
} }
auto fuse_drive_base::check_open_flags(int flags, int mask, auto fuse_drive_base::check_open_flags(
const api_error &fail_error) int flags, int mask, const api_error &fail_error) -> api_error {
-> api_error {
return (((flags & mask) == 0) ? api_error::success : fail_error); return (((flags & mask) == 0) ? api_error::success : fail_error);
} }
@ -194,8 +195,8 @@ auto fuse_drive_base::check_parent_access(const std::string &api_path,
return ret; return ret;
} }
auto fuse_drive_base::check_readable(int flags, const api_error &fail_error) auto fuse_drive_base::check_readable(int flags,
-> api_error { const api_error &fail_error) -> api_error {
auto mode = (flags & O_ACCMODE); auto mode = (flags & O_ACCMODE);
return ((mode == O_WRONLY) ? fail_error : api_error::success); return ((mode == O_WRONLY) ? fail_error : api_error::success);
} }
@ -253,16 +254,13 @@ auto fuse_drive_base::get_uid_from_meta(const api_meta_map &meta) -> uid_t {
} }
#if defined(__APPLE__) #if defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(const char *name, auto fuse_drive_base::parse_xattr_parameters(
const uint32_t &position, const char *name, const uint32_t &position, std::string &attribute_name,
std::string &attribute_name, const std::string &api_path) -> api_error {
const std::string &api_path)
-> api_error {
#else // !defined(__APPLE__) #else // !defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(const char *name, auto fuse_drive_base::parse_xattr_parameters(
std::string &attribute_name, const char *name, std::string &attribute_name,
const std::string &api_path) const std::string &api_path) -> api_error {
-> api_error {
#endif // defined(__APPLE__) #endif // defined(__APPLE__)
auto res = api_path.empty() ? api_error::bad_address : api_error::success; auto res = api_path.empty() ? api_error::bad_address : api_error::success;
if (res != api_error::success) { if (res != api_error::success) {
@ -295,11 +293,9 @@ auto fuse_drive_base::parse_xattr_parameters(
std::string &attribute_name, const std::string &api_path) -> api_error { std::string &attribute_name, const std::string &api_path) -> api_error {
auto res = parse_xattr_parameters(name, position, attribute_name, api_path); auto res = parse_xattr_parameters(name, position, attribute_name, api_path);
#else // !defined(__APPLE__) #else // !defined(__APPLE__)
auto fuse_drive_base::parse_xattr_parameters(const char *name, auto fuse_drive_base::parse_xattr_parameters(
const char *value, size_t size, const char *name, const char *value, size_t size,
std::string &attribute_name, std::string &attribute_name, const std::string &api_path) -> api_error {
const std::string &api_path)
-> api_error {
auto res = parse_xattr_parameters(name, attribute_name, api_path); auto res = parse_xattr_parameters(name, attribute_name, api_path);
#endif // defined(__APPLE__) #endif // defined(__APPLE__)
if (res != api_error::success) { if (res != api_error::success) {

View File

@ -28,6 +28,7 @@
#include "drives/directory_iterator.hpp" #include "drives/directory_iterator.hpp"
#include "drives/remote/remote_open_file_table.hpp" #include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/remote.hpp" #include "types/remote.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -36,15 +37,15 @@
#include "utils/file.hpp" #include "utils/file.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
#include "utils/time.hpp" #include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory::remote_fuse { namespace repertory::remote_fuse {
#define RAISE_REMOTE_FUSE_SERVER_EVENT(func, file, ret) \ #define RAISE_REMOTE_FUSE_SERVER_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \ if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= remote_fuse_server_event::level) && \ (((config_.get_event_level() >= remote_server_event::level) && \
((ret) < 0)) || \ ((ret) < 0)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<remote_fuse_server_event>(std::string{func}, \ event_system::instance().raise<remote_server_event>(file, ret, func)
file, ret)
remote_server::remote_server(app_config &config, i_fuse_drive &drive, remote_server::remote_server(app_config &config, i_fuse_drive &drive,
const std::string &mount_location) const std::string &mount_location)
@ -200,8 +201,8 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask)
return ret; return ret;
} }
auto remote_server::fuse_chflags(const char *path, auto remote_server::fuse_chflags(const char *path, std::uint32_t flags)
std::uint32_t flags) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -313,9 +314,10 @@ length); ret = ((res < 0) ? -errno : 0); #endif
return ret; return ret;
}*/ }*/
auto remote_server::fuse_fgetattr( auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
const char *path, remote::stat &r_stat, bool &directory, bool &directory,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
r_stat = {}; r_stat = {};
@ -325,7 +327,7 @@ auto remote_server::fuse_fgetattr(
auto res = has_open_info(static_cast<native_handle>(handle), EBADF); auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
if (res == 0) { if (res == 0) {
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {}; struct stat64 unix_st{};
res = fstat64(static_cast<native_handle>(handle), &unix_st); res = fstat64(static_cast<native_handle>(handle), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -337,9 +339,10 @@ auto remote_server::fuse_fgetattr(
return ret; return ret;
} }
auto remote_server::fuse_fsetattr_x( auto remote_server::fuse_fsetattr_x(const char *path,
const char *path, const remote::setattr_x &attr, const remote::setattr_x &attr,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -455,9 +458,10 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
return ret; return ret;
} }
auto remote_server::fuse_ftruncate( auto remote_server::fuse_ftruncate(const char *path,
const char *path, const remote::file_offset &size, const remote::file_offset &size,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -485,7 +489,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct stat64 unix_st {}; struct stat64 unix_st{};
auto res = stat64(file_path.c_str(), &unix_st); auto res = stat64(file_path.c_str(), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(unix_st, r_stat); populate_stat(unix_st, r_stat);
@ -550,9 +554,10 @@ STATUS_NOT_IMPLEMENTED; #endif RAISE_REMOTE_FUSE_SERVER_EVENT(function_name,
file_path, ret); return ret; file_path, ret); return ret;
}*/ }*/
auto remote_server::fuse_getxtimes( auto remote_server::fuse_getxtimes(const char *path,
const char *path, remote::file_time &bkuptime, remote::file_time &bkuptime,
remote::file_time &crtime) -> packet::error_type { remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -657,10 +662,11 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
return ret; return ret;
} }
auto remote_server::fuse_read( auto remote_server::fuse_read(const char *path, char *buffer,
const char *path, char *buffer, const remote::file_size &read_size, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -681,8 +687,8 @@ auto remote_server::fuse_read(
return static_cast<packet::error_type>(ret); return static_cast<packet::error_type>(ret);
} }
auto remote_server::fuse_rename(const char *from, auto remote_server::fuse_rename(const char *from, const char *to)
const char *to) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto from_path = utils::path::combine(mount_location_, {from}); const auto from_path = utils::path::combine(mount_location_, {from});
@ -720,8 +726,9 @@ auto remote_server::fuse_readdir(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_release( auto remote_server::fuse_release(const char *path,
const char *path, const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet::error_type ret = 0; packet::error_type ret = 0;
@ -738,8 +745,9 @@ auto remote_server::fuse_release(
return ret; return ret;
} }
auto remote_server::fuse_releasedir( auto remote_server::fuse_releasedir(const char *path,
const char *path, const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -784,8 +792,9 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr)
return ret; return ret;
} }
auto remote_server::fuse_setbkuptime( auto remote_server::fuse_setbkuptime(const char *path,
const char *path, const remote::file_time &bkuptime) -> packet::error_type { const remote::file_time &bkuptime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -804,8 +813,9 @@ auto remote_server::fuse_setbkuptime(
return ret; return ret;
} }
auto remote_server::fuse_setchgtime( auto remote_server::fuse_setchgtime(const char *path,
const char *path, const remote::file_time &chgtime) -> packet::error_type { const remote::file_time &chgtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -824,8 +834,9 @@ auto remote_server::fuse_setchgtime(
return ret; return ret;
} }
auto remote_server::fuse_setcrtime( auto remote_server::fuse_setcrtime(const char *path,
const char *path, const remote::file_time &crtime) -> packet::error_type { const remote::file_time &crtime)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -916,8 +927,9 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0; return 0;
} }
auto remote_server::fuse_truncate( auto remote_server::fuse_truncate(const char *path,
const char *path, const remote::file_offset &size) -> packet::error_type { const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -938,8 +950,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
} }
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
std::uint64_t op0, std::uint64_t op0, std::uint64_t op1)
std::uint64_t op1) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -966,10 +978,11 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
return ret; return ret;
} }
auto remote_server::fuse_write( auto remote_server::fuse_write(const char *path, const char *buffer,
const char *path, const char *buffer, const remote::file_size &write_size, const remote::file_size &write_size,
const remote::file_offset &write_offset, const remote::file_offset &write_offset,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);
@ -999,8 +1012,8 @@ auto remote_server::fuse_write_base64(
} }
// WinFSP Layer // WinFSP Layer
auto remote_server::winfsp_can_delete(PVOID file_desc, auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
PWSTR file_name) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1025,8 +1038,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc,
} }
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name, auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
UINT32 flags, UINT32 flags, BOOLEAN &was_deleted)
BOOLEAN &was_deleted) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1103,8 +1116,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc, UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, std::string &normalized_name, BOOLEAN &exists)
BOOLEAN &exists) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1176,8 +1189,9 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret; return ret;
} }
auto remote_server::winfsp_get_file_info( auto remote_server::winfsp_get_file_info(PVOID file_desc,
PVOID file_desc, remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1220,9 +1234,10 @@ auto remote_server::winfsp_get_security_by_name(
return ret; return ret;
} }
auto remote_server::winfsp_get_volume_info( auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &total_size, UINT64 &free_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type { std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label); drive_.get_volume_info(total_size, free_size, volume_label);
@ -1239,10 +1254,11 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_open( auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 granted_access, PVOID *file_desc,
PVOID *file_desc, remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name) -> packet::error_type { std::string &normalized_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1283,10 +1299,11 @@ auto remote_server::winfsp_open(
return ret; return ret;
} }
auto remote_server::winfsp_overwrite( auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1402,9 +1419,10 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret; return ret;
} }
auto remote_server::winfsp_rename( auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type { BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto relative_path = utils::string::to_utf8(file_name); const auto relative_path = utils::string::to_utf8(file_name);
@ -1498,9 +1516,10 @@ auto remote_server::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_server::winfsp_set_file_size( auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto handle = reinterpret_cast<remote::file_handle>(file_desc); const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
@ -1536,10 +1555,12 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_write( auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, UINT32 length, BOOLEAN write_to_end,
BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, BOOLEAN constrained_io,
remote::file_info *file_info) -> packet::error_type { PUINT32 bytes_transferred,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0; *bytes_transferred = 0;
@ -1587,8 +1608,9 @@ auto remote_server::winfsp_write(
return ret; return ret;
} }
auto remote_server::json_create_directory_snapshot( auto remote_server::json_create_directory_snapshot(const std::string &path,
const std::string &path, json &json_data) -> packet::error_type { json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto api_path = utils::path::create_api_path(path); const auto api_path = utils::path::create_api_path(path);
@ -1647,8 +1669,8 @@ auto remote_server::json_read_directory_snapshot(
} }
auto remote_server::json_release_directory_snapshot( auto remote_server::json_release_directory_snapshot(
const std::string &path, const std::string &path, const remote::file_handle &handle)
const remote::file_handle &handle) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
const auto file_path = construct_path(path); const auto file_path = construct_path(path);

View File

@ -32,19 +32,11 @@
#include "version.hpp" #include "version.hpp"
namespace repertory::remote_winfsp { namespace repertory::remote_winfsp {
#define RAISE_REMOTE_WINFSP_CLIENT_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \
((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<remote_winfsp_client_event>( \
std::string{func}, file, ret)
remote_client::remote_client(const app_config &config) remote_client::remote_client(const app_config &config)
: config_(config), packet_client_(config.get_remote_config()) {} : config_(config), packet_client_(config.get_remote_config()) {}
auto remote_client::winfsp_can_delete(PVOID file_desc, auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
PWSTR file_name) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -56,14 +48,12 @@ auto remote_client::winfsp_can_delete(PVOID file_desc,
packet_client_.send(function_name, request, service_flags), packet_client_.send(function_name, request, service_flags),
}; };
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name,
utils::path::create_api_path(utils::string::to_utf8(file_name)), ret);
return ret; return ret;
} }
auto remote_client::json_create_directory_snapshot( auto remote_client::json_create_directory_snapshot(const std::string &path,
const std::string &path, json &json_data) -> packet::error_type { json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -78,7 +68,6 @@ auto remote_client::json_create_directory_snapshot(
ret = packet::decode_json(response, json_data); ret = packet::decode_json(response, json_data);
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret; return ret;
} }
@ -101,13 +90,12 @@ auto remote_client::json_read_directory_snapshot(
ret = packet::decode_json(response, json_data); ret = packet::decode_json(response, json_data);
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret; return ret;
} }
auto remote_client::json_release_directory_snapshot( auto remote_client::json_release_directory_snapshot(
const std::string &path, const std::string &path, const remote::file_handle &handle)
const remote::file_handle &handle) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -119,13 +107,12 @@ auto remote_client::json_release_directory_snapshot(
packet_client_.send(function_name, request, service_flags), packet_client_.send(function_name, request, service_flags),
}; };
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret; return ret;
} }
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name, auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
UINT32 flags, UINT32 flags, BOOLEAN &was_deleted)
BOOLEAN &was_deleted) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto handle{ auto handle{
@ -154,7 +141,6 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
remove_all(file_path); remove_all(file_path);
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
return ret; return ret;
} }
@ -179,7 +165,6 @@ auto remote_client::winfsp_close(PVOID file_desc) -> packet::error_type {
if ((ret == STATUS_SUCCESS) || if ((ret == STATUS_SUCCESS) ||
(ret == static_cast<packet::error_type>(STATUS_INVALID_HANDLE))) { (ret == static_cast<packet::error_type>(STATUS_INVALID_HANDLE))) {
remove_open_info(handle); remove_open_info(handle);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
} }
} }
@ -190,8 +175,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 allocation_size, PVOID *file_desc, UINT64 allocation_size, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, std::string &normalized_name, BOOLEAN &exists)
BOOLEAN &exists) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -230,8 +215,6 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
} }
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(*file_desc)), ret);
return ret; return ret;
} }
@ -249,8 +232,6 @@ auto remote_client::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
}; };
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
@ -265,8 +246,9 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc,
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE); return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
} }
auto remote_client::winfsp_get_file_info( auto remote_client::winfsp_get_file_info(PVOID file_desc,
PVOID file_desc, remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -279,14 +261,14 @@ auto remote_client::winfsp_get_file_info(
}; };
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
auto remote_client::winfsp_get_security_by_name( auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, PUINT32 attributes,
std::wstring &string_descriptor) -> packet::error_type { std::uint64_t *descriptor_size,
std::wstring &string_descriptor)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -311,14 +293,13 @@ auto remote_client::winfsp_get_security_by_name(
DECODE_OR_IGNORE(&response, *attributes); DECODE_OR_IGNORE(&response, *attributes);
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name,
utils::string::to_utf8(file_name), ret);
return ret; return ret;
} }
auto remote_client::winfsp_get_volume_info( auto remote_client::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &total_size, UINT64 &free_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type { std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -352,14 +333,14 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
}; };
event_system::instance().raise<drive_mounted>(function_name, mount_location); event_system::instance().raise<drive_mounted>(function_name, mount_location);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
return ret; return ret;
} }
auto remote_client::winfsp_open( auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 granted_access, PVOID *file_desc,
PVOID *file_desc, remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name) -> packet::error_type { std::string &normalized_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -390,15 +371,14 @@ auto remote_client::winfsp_open(
} }
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(*file_desc)), ret);
return ret; return ret;
} }
auto remote_client::winfsp_overwrite( auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, BOOLEAN replace_attributes,
UINT64 allocation_size, UINT64 allocation_size,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -414,8 +394,6 @@ auto remote_client::winfsp_overwrite(
}; };
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
@ -439,17 +417,12 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
ret = response.decode(buffer, *bytes_transferred); ret = response.decode(buffer, *bytes_transferred);
#if defined(_WIN32) #if defined(_WIN32)
if ((ret == STATUS_SUCCESS) && if ((ret == STATUS_SUCCESS) &&
(not *bytes_transferred || (*bytes_transferred != length))) { (not*bytes_transferred || (*bytes_transferred != length))) {
::SetLastError(ERROR_HANDLE_EOF); ::SetLastError(ERROR_HANDLE_EOF);
} }
#endif #endif
} }
if (ret != STATUS_SUCCESS) {
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
}
return ret; return ret;
} }
@ -472,14 +445,13 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
ret = packet::decode_json(response, item_list); ret = packet::decode_json(response, item_list);
} }
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
auto remote_client::winfsp_rename( auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name,
PVOID file_desc, PWSTR file_name, PWSTR new_file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type { BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -493,11 +465,6 @@ auto remote_client::winfsp_rename(
packet_client_.send(function_name, request, service_flags), packet_client_.send(function_name, request, service_flags),
}; };
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name,
utils::path::create_api_path(utils::string::to_utf8(file_name)) + "|" +
utils::path::create_api_path(utils::string::to_utf8(new_file_name)),
ret);
return ret; return ret;
} }
@ -522,14 +489,13 @@ auto remote_client::winfsp_set_basic_info(
}; };
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
auto remote_client::winfsp_set_file_size( auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -544,8 +510,6 @@ auto remote_client::winfsp_set_file_size(
}; };
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret; return ret;
} }
@ -557,7 +521,7 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
utils::string::to_utf8(location), utils::string::to_utf8(location),
}; };
event_system::instance().raise<drive_unmount_pending>(function_name, event_system::instance().raise<drive_unmount_pending>(function_name,
mount_location); mount_location);
packet request; packet request;
request.encode(location); request.encode(location);
@ -566,16 +530,17 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
packet_client_.send(function_name, request, service_flags), packet_client_.send(function_name, request, service_flags),
}; };
event_system::instance().raise<drive_unmounted>(function_name, event_system::instance().raise<drive_unmounted>(function_name,
mount_location); mount_location);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
return ret; return ret;
} }
auto remote_client::winfsp_write( auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, UINT32 length, BOOLEAN write_to_end,
BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred, BOOLEAN constrained_io,
remote::file_info *file_info) -> packet::error_type { PUINT32 bytes_transferred,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
packet request; packet request;
@ -596,10 +561,6 @@ auto remote_client::winfsp_write(
DECODE_OR_IGNORE(&response, *bytes_transferred); DECODE_OR_IGNORE(&response, *bytes_transferred);
DECODE_OR_IGNORE(&response, *file_info); DECODE_OR_IGNORE(&response, *file_info);
if (ret != STATUS_SUCCESS) {
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
}
return ret; return ret;
} }

View File

@ -33,6 +33,7 @@
#include "drives/remote/remote_open_file_table.hpp" #include "drives/remote/remote_open_file_table.hpp"
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp" #include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/remote.hpp" #include "types/remote.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -41,15 +42,15 @@
#include "utils/file_utils.hpp" #include "utils/file_utils.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
#include "utils/time.hpp" #include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory::remote_winfsp { namespace repertory::remote_winfsp {
#define RAISE_REMOTE_WINFSP_SERVER_EVENT(func, file, ret) \ #define RAISE_REMOTE_WINFSP_SERVER_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \ if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= remote_winfsp_server_event::level) && \ (((config_.get_event_level() >= remote_server_event::level) && \
((ret) != STATUS_SUCCESS)) || \ ((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<remote_winfsp_server_event>( \ event_system::instance().raise<remote_server_event>(file, ret, func)
std::string{func}, file, ret)
auto remote_server::get_next_handle() -> std::uint64_t { auto remote_server::get_next_handle() -> std::uint64_t {
if (++next_handle_ == 0U) { if (++next_handle_ == 0U) {
@ -141,9 +142,10 @@ auto remote_server::fuse_chmod(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_chown( auto remote_server::fuse_chown(const char *path,
const char *path, const remote::user_id & /*uid*/, const remote::user_id & /*uid*/,
const remote::group_id & /*gid*/) -> packet::error_type { const remote::group_id & /*gid*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -171,9 +173,10 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
return ret; return ret;
}*/ }*/
auto remote_server::fuse_fgetattr( auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
const char *path, remote::stat &r_stat, bool &directory, bool &directory,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
r_stat = {}; r_stat = {};
@ -185,7 +188,7 @@ auto remote_server::fuse_fgetattr(
}; };
if (res == 0) { if (res == 0) {
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct _stat64 unix_st {}; struct _stat64 unix_st{};
res = _fstat64(static_cast<int>(handle), &unix_st); res = _fstat64(static_cast<int>(handle), &unix_st);
if (res == 0) { if (res == 0) {
populate_stat(path, directory, r_stat, unix_st); populate_stat(path, directory, r_stat, unix_st);
@ -197,9 +200,10 @@ auto remote_server::fuse_fgetattr(
return ret; return ret;
} }
auto remote_server::fuse_fsetattr_x( auto remote_server::fuse_fsetattr_x(const char *path,
const char *path, const remote::setattr_x & /*attr*/, const remote::setattr_x & /*attr*/,
const remote::file_handle & /*handle*/) -> packet::error_type { const remote::file_handle & /*handle*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -208,9 +212,10 @@ auto remote_server::fuse_fsetattr_x(
return ret; return ret;
} }
auto remote_server::fuse_fsync( auto remote_server::fuse_fsync(const char *path,
const char *path, const std::int32_t & /*datasync*/, const std::int32_t & /*datasync*/,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -237,9 +242,10 @@ auto remote_server::fuse_fsync(
return ret; return ret;
} }
auto remote_server::fuse_ftruncate( auto remote_server::fuse_ftruncate(const char *path,
const char *path, const remote::file_offset &size, const remote::file_offset &size,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -279,7 +285,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
directory = utils::file::directory(file_path).exists(); directory = utils::file::directory(file_path).exists();
struct _stat64 st1 {}; struct _stat64 st1{};
auto res{ auto res{
_stat64(file_path.c_str(), &st1), _stat64(file_path.c_str(), &st1),
}; };
@ -305,9 +311,10 @@ STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
file_path, ret); return ret; file_path, ret); return ret;
}*/ }*/
auto remote_server::fuse_getxtimes( auto remote_server::fuse_getxtimes(const char *path,
const char *path, remote::file_time & /*bkuptime*/, remote::file_time & /*bkuptime*/,
remote::file_time & /*crtime*/) -> packet::error_type { remote::file_time & /*crtime*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -438,10 +445,11 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
return ret; return ret;
} }
auto remote_server::fuse_read( auto remote_server::fuse_read(const char *path, char *buffer,
const char *path, char *buffer, const remote::file_size &read_size, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -472,8 +480,8 @@ auto remote_server::fuse_read(
return ret; return ret;
} }
auto remote_server::fuse_rename(const char *from, auto remote_server::fuse_rename(const char *from, const char *to)
const char *to) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto from_path = utils::path::combine(mount_location_, {from}); auto from_path = utils::path::combine(mount_location_, {from});
@ -488,10 +496,11 @@ auto remote_server::fuse_rename(const char *from,
return ret; return ret;
} }
auto remote_server::fuse_write( auto remote_server::fuse_write(const char *path, const char *buffer,
const char *path, const char *buffer, const remote::file_size &write_size, const remote::file_size &write_size,
const remote::file_offset &write_offset, const remote::file_offset &write_offset,
const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -558,8 +567,9 @@ auto remote_server::fuse_readdir(const char *path,
return ret; return ret;
} }
auto remote_server::fuse_release( auto remote_server::fuse_release(const char *path,
const char *path, const remote::file_handle &handle) -> packet::error_type { const remote::file_handle &handle)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -603,8 +613,9 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
return ret; return ret;
} }
auto remote_server::fuse_setattr_x( auto remote_server::fuse_setattr_x(const char *path,
const char *path, remote::setattr_x & /*attr*/) -> packet::error_type { remote::setattr_x & /*attr*/)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -716,8 +727,9 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
return 0; return 0;
} }
auto remote_server::fuse_truncate( auto remote_server::fuse_truncate(const char *path,
const char *path, const remote::file_offset &size) -> packet::error_type { const remote::file_offset &size)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -764,8 +776,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
} }
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv, auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
std::uint64_t op0, std::uint64_t op0, std::uint64_t op1)
std::uint64_t op1) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -824,8 +836,9 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
} }
// JSON Layer // JSON Layer
auto remote_server::json_create_directory_snapshot( auto remote_server::json_create_directory_snapshot(const std::string &path,
const std::string &path, json &json_data) -> packet::error_type { json &json_data)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -883,8 +896,8 @@ auto remote_server::json_read_directory_snapshot(
} }
auto remote_server::json_release_directory_snapshot( auto remote_server::json_release_directory_snapshot(
const std::string &path, const std::string &path, const remote::file_handle & /*handle*/)
const remote::file_handle & /*handle*/) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = construct_path(path); auto file_path = construct_path(path);
@ -915,8 +928,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/)
} }
auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/, auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
UINT32 flags, UINT32 flags, BOOLEAN &was_deleted)
BOOLEAN &was_deleted) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = get_open_file_path(file_desc); auto file_path = get_open_file_path(file_desc);
@ -953,8 +966,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
UINT64 /*allocation_size*/, PVOID *file_desc, UINT64 /*allocation_size*/, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, std::string &normalized_name, BOOLEAN &exists)
BOOLEAN &exists) -> packet::error_type { -> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1022,8 +1035,9 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
return ret; return ret;
} }
auto remote_server::winfsp_get_file_info( auto remote_server::winfsp_get_file_info(PVOID file_desc,
PVOID file_desc, remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1037,9 +1051,11 @@ auto remote_server::winfsp_get_file_info(
return ret; return ret;
} }
auto remote_server::winfsp_get_security_by_name( auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size, PUINT32 attributes,
std::wstring &string_descriptor) -> packet::error_type { std::uint64_t *descriptor_size,
std::wstring &string_descriptor)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1078,9 +1094,10 @@ auto remote_server::winfsp_get_security_by_name(
return ret; return ret;
} }
auto remote_server::winfsp_get_volume_info( auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
UINT64 &total_size, UINT64 &free_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type { std::string &volume_label)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
drive_.get_volume_info(total_size, free_size, volume_label); drive_.get_volume_info(total_size, free_size, volume_label);
@ -1097,10 +1114,11 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_open( auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
PWSTR file_name, UINT32 create_options, UINT32 granted_access, UINT32 granted_access, PVOID *file_desc,
PVOID *file_desc, remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name) -> packet::error_type { std::string &normalized_name)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto file_path = utils::string::from_utf8(utils::path::combine( auto file_path = utils::string::from_utf8(utils::path::combine(
@ -1136,10 +1154,11 @@ auto remote_server::winfsp_open(
return ret; return ret;
} }
auto remote_server::winfsp_overwrite( auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1240,9 +1259,10 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
return ret; return ret;
} }
auto remote_server::winfsp_rename( auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type { BOOLEAN replace_if_exists)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto from_path = utils::string::from_utf8(utils::path::combine( auto from_path = utils::string::from_utf8(utils::path::combine(
@ -1293,9 +1313,10 @@ auto remote_server::winfsp_set_basic_info(
return ret; return ret;
} }
auto remote_server::winfsp_set_file_size( auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size, BOOLEAN set_allocation_size,
remote::file_info *file_info) -> packet::error_type { remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);
@ -1338,10 +1359,12 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
auto remote_server::winfsp_write( auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length, UINT32 length, BOOLEAN /*write_to_end*/,
BOOLEAN /*write_to_end*/, BOOLEAN constrained_io, PUINT32 bytes_transferred, BOOLEAN constrained_io,
remote::file_info *file_info) -> packet::error_type { PUINT32 bytes_transferred,
remote::file_info *file_info)
-> packet::error_type {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto *handle = reinterpret_cast<HANDLE>(file_desc); auto *handle = reinterpret_cast<HANDLE>(file_desc);

View File

@ -77,8 +77,8 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS {
} }
if (ret != STATUS_SUCCESS) { if (ret != STATUS_SUCCESS) {
event_system::instance().raise<drive_mount_failed>(function_name, event_system::instance().raise<drive_mount_failed>(ret, function_name,
mount_location, ret); mount_location);
if (not lock_.set_mount_state(false, "", -1)) { if (not lock_.set_mount_state(false, "", -1)) {
utils::error::raise_error(function_name, "failed to set mount state"); utils::error::raise_error(function_name, "failed to set mount state");
} }
@ -105,7 +105,7 @@ remote_winfsp_drive::remote_winfsp_drive(app_config &config,
config_(config), config_(config),
lock_(lock), lock_(lock),
factory_(std::move(factory)) { factory_(std::move(factory)) {
E_SUBSCRIBE_EXACT(unmount_requested, [this](const unmount_requested &) { E_SUBSCRIBE(unmount_requested, [this](const unmount_requested &) {
std::thread([this]() { this->shutdown(); }).detach(); std::thread([this]() { this->shutdown(); }).detach();
}); });
} }
@ -129,8 +129,8 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, UINT32 attributes, UINT32 granted_access, UINT32 attributes,
PSECURITY_DESCRIPTOR /*descriptor*/, PSECURITY_DESCRIPTOR /*descriptor*/,
UINT64 allocation_size, PVOID * /*file_node*/, UINT64 allocation_size, PVOID * /*file_node*/,
PVOID *file_desc, PVOID *file_desc, OpenFileInfo *ofi)
OpenFileInfo *ofi) -> NTSTATUS { -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
std::string normalized_name; std::string normalized_name;
BOOLEAN exists = 0; BOOLEAN exists = 0;
@ -164,9 +164,10 @@ auto remote_winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc,
return ret; return ret;
} }
auto remote_winfsp_drive::GetSecurityByName( auto remote_winfsp_drive::GetSecurityByName(PWSTR file_name, PUINT32 attributes,
PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor, PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size) -> NTSTATUS { SIZE_T *descriptor_size)
-> NTSTATUS {
std::wstring string_descriptor; std::wstring string_descriptor;
std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size; std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
auto ret = remote_instance_->winfsp_get_security_by_name( auto ret = remote_instance_->winfsp_get_security_by_name(
@ -262,7 +263,7 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args)
auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run(); auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
event_system::instance().raise<drive_mount_result>(function_name, "", event_system::instance().raise<drive_mount_result>(function_name, "",
std::to_string(ret)); std::to_string(ret));
event_system::instance().stop(); event_system::instance().stop();
c.reset(); c.reset();
return static_cast<int>(ret); return static_cast<int>(ret);
@ -286,8 +287,8 @@ auto remote_winfsp_drive::Mounted(PVOID host) -> NTSTATUS {
auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options, auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
UINT32 granted_access, PVOID * /*file_node*/, UINT32 granted_access, PVOID * /*file_node*/,
PVOID *file_desc, PVOID *file_desc, OpenFileInfo *ofi)
OpenFileInfo *ofi) -> NTSTATUS { -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
std::string normalize_name; std::string normalize_name;
auto ret = auto ret =
@ -307,8 +308,8 @@ auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
auto remote_winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc, auto remote_winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT32 attributes,
BOOLEAN replace_attributes, BOOLEAN replace_attributes,
UINT64 allocation_size, UINT64 allocation_size, FileInfo *file_info)
FileInfo *file_info) -> NTSTATUS { -> NTSTATUS {
remote::file_info info{}; remote::file_info info{};
auto ret = remote_instance_->winfsp_overwrite( auto ret = remote_instance_->winfsp_overwrite(
file_desc, attributes, replace_attributes, allocation_size, &info); file_desc, attributes, replace_attributes, allocation_size, &info);
@ -425,8 +426,8 @@ auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT64 creation_time, UINT32 attributes, UINT64 creation_time,
UINT64 last_access_time, UINT64 last_access_time,
UINT64 last_write_time, UINT64 last_write_time,
UINT64 change_time, UINT64 change_time, FileInfo *file_info)
FileInfo *file_info) -> NTSTATUS { -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
auto ret = remote_instance_->winfsp_set_basic_info( auto ret = remote_instance_->winfsp_set_basic_info(
file_desc, attributes, creation_time, last_access_time, last_write_time, file_desc, attributes, creation_time, last_access_time, last_write_time,
@ -478,8 +479,8 @@ VOID remote_winfsp_drive::Unmounted(PVOID host) {
auto remote_winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc, auto remote_winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc,
PVOID buffer, UINT64 offset, ULONG length, PVOID buffer, UINT64 offset, ULONG length,
BOOLEAN write_to_end, BOOLEAN constrained_io, BOOLEAN write_to_end, BOOLEAN constrained_io,
PULONG bytes_transferred, PULONG bytes_transferred, FileInfo *file_info)
FileInfo *file_info) -> NTSTATUS { -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
auto ret = remote_instance_->winfsp_write( auto ret = remote_instance_->winfsp_write(
file_desc, buffer, offset, length, write_to_end, constrained_io, file_desc, buffer, offset, length, write_to_end, constrained_io,

View File

@ -31,9 +31,11 @@
#include "events/types/drive_mount_failed.hpp" #include "events/types/drive_mount_failed.hpp"
#include "events/types/drive_mount_result.hpp" #include "events/types/drive_mount_result.hpp"
#include "events/types/drive_mounted.hpp" #include "events/types/drive_mounted.hpp"
#include "events/types/drive_stop_timed_out.hpp"
#include "events/types/drive_unmount_pending.hpp" #include "events/types/drive_unmount_pending.hpp"
#include "events/types/drive_unmounted.hpp" #include "events/types/drive_unmounted.hpp"
#include "events/types/unmount_requested.hpp" #include "events/types/unmount_requested.hpp"
#include "events/types/winfsp_event.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "providers/i_provider.hpp" #include "providers/i_provider.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -52,9 +54,9 @@ namespace repertory {
#define RAISE_WINFSP_EVENT(func, file, ret) \ #define RAISE_WINFSP_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \ if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= winfsp_event::level) && \ (((config_.get_event_level() >= winfsp_event::level) && \
(ret != STATUS_SUCCESS)) || \ ((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \ (config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<winfsp_event>(std::string{func}, file, ret) event_system::instance().raise<winfsp_event>(file, ret, func)
winfsp_drive::winfsp_service::winfsp_service( winfsp_drive::winfsp_service::winfsp_service(
lock_data &lock, winfsp_drive &drive, std::vector<std::string> drive_args, lock_data &lock, winfsp_drive &drive, std::vector<std::string> drive_args,
@ -88,8 +90,8 @@ auto winfsp_drive::handle_error(std::string_view function_name,
return ret; return ret;
} }
auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/, PWSTR * /*Argv*/)
PWSTR * /*Argv*/) -> NTSTATUS { -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
auto mount_location = utils::string::to_lower( auto mount_location = utils::string::to_lower(
@ -125,8 +127,8 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
utils::error::raise_error(function_name, ret, "failed to set mount state"); utils::error::raise_error(function_name, ret, "failed to set mount state");
} }
event_system::instance().raise<drive_mount_failed>(function_name, event_system::instance().raise<drive_mount_failed>(ret, function_name,
mount_location, ret); mount_location);
return ret; return ret;
} }
@ -136,7 +138,7 @@ auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
timeout stop_timeout( timeout stop_timeout(
[]() { []() {
event_system::instance().raise<drive_stop_timed_out>(); event_system::instance().raise<drive_stop_timed_out>(function_name);
app_config::set_stop_requested(); app_config::set_stop_requested();
}, },
30s); 30s);
@ -154,7 +156,7 @@ auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
winfsp_drive::winfsp_drive(app_config &config, lock_data &lock, winfsp_drive::winfsp_drive(app_config &config, lock_data &lock,
i_provider &provider) i_provider &provider)
: provider_(provider), config_(config), lock_(lock) { : provider_(provider), config_(config), lock_(lock) {
E_SUBSCRIBE_EXACT(unmount_requested, [this](const unmount_requested &) { E_SUBSCRIBE(unmount_requested, [this](const unmount_requested &) {
std::thread([this]() { this->shutdown(); }).detach(); std::thread([this]() { this->shutdown(); }).detach();
}); });
} }
@ -468,9 +470,10 @@ auto winfsp_drive::get_item_meta(const std::string &api_path,
return ret; return ret;
} }
auto winfsp_drive::get_security_by_name( auto winfsp_drive::get_security_by_name(PWSTR file_name, PUINT32 attributes,
PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor, PSECURITY_DESCRIPTOR descriptor,
std::uint64_t *descriptor_size) -> NTSTATUS { std::uint64_t *descriptor_size)
-> NTSTATUS {
auto api_path = auto api_path =
utils::path::create_api_path(utils::string::to_utf8(file_name)); utils::path::create_api_path(utils::string::to_utf8(file_name));
@ -730,8 +733,8 @@ auto winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc, auto winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, BOOLEAN replace_attributes, UINT32 attributes, BOOLEAN replace_attributes,
UINT64 /*allocation_size*/, UINT64 /*allocation_size*/, FileInfo *file_info)
FileInfo *file_info) -> NTSTATUS { -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
std::string api_path; std::string api_path;
@ -837,8 +840,8 @@ void winfsp_drive::populate_file_info(std::uint64_t file_size,
} }
auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer, auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
UINT64 offset, ULONG length, UINT64 offset, ULONG length, PULONG bytes_transferred)
PULONG bytes_transferred) -> NTSTATUS { -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
*bytes_transferred = 0U; *bytes_transferred = 0U;
@ -893,8 +896,8 @@ auto winfsp_drive::Read(PVOID /*file_node*/, PVOID file_desc, PVOID buffer,
auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc, auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
PWSTR /*pattern*/, PWSTR marker, PVOID buffer, PWSTR /*pattern*/, PWSTR marker, PVOID buffer,
ULONG buffer_length, ULONG buffer_length, PULONG bytes_transferred)
PULONG bytes_transferred) -> NTSTATUS { -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
std::string api_path; std::string api_path;
@ -1050,8 +1053,8 @@ auto winfsp_drive::Rename(PVOID /*file_node*/, PVOID /*file_desc*/,
auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc, auto winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT32 attributes, UINT64 creation_time, UINT32 attributes, UINT64 creation_time,
UINT64 last_access_time, UINT64 last_write_time, UINT64 last_access_time, UINT64 last_write_time,
UINT64 change_time, UINT64 change_time, FileInfo *file_info)
FileInfo *file_info) -> NTSTATUS { -> NTSTATUS {
REPERTORY_USES_FUNCTION_NAME(); REPERTORY_USES_FUNCTION_NAME();
std::string api_path; std::string api_path;
@ -1195,6 +1198,7 @@ void winfsp_drive::stop_all() {
}); });
if (future.wait_for(30s) == std::future_status::timeout) { if (future.wait_for(30s) == std::future_status::timeout) {
event_system::instance().raise<drive_stop_timed_out>(function_name);
app_config::set_stop_requested(); app_config::set_stop_requested();
future.wait(); future.wait();
} }

View File

@ -62,14 +62,14 @@ console_consumer::console_consumer(event_level level) {
set_level(level); set_level(level);
E_SUBSCRIBE_ALL(process_event2); E_SUBSCRIBE_ALL(process_event);
E_SUBSCRIBE_EXACT(event_level_changed, E_SUBSCRIBE(event_level_changed,
[](auto &&event) { set_level(event.level); }); [](auto &&event) { set_level(event.new_level); });
} }
console_consumer::~console_consumer() { E_CONSUMER_RELEASE(); } console_consumer::~console_consumer() { E_CONSUMER_RELEASE(); }
void console_consumer::process_event2(const i_event &evt) { void console_consumer::process_event(const i_event &evt) {
switch (evt.get_event_level()) { switch (evt.get_event_level()) {
case event_level::critical: case event_level::critical:
spdlog::get("console")->critical(evt.get_single_line()); spdlog::get("console")->critical(evt.get_single_line());

View File

@ -66,14 +66,14 @@ logging_consumer::logging_consumer(event_level level,
set_level(level); set_level(level);
E_SUBSCRIBE_ALL(process_event2); E_SUBSCRIBE_ALL(process_event);
E_SUBSCRIBE_EXACT(event_level_changed, E_SUBSCRIBE(event_level_changed,
[](auto &&event) { set_level(event.level); }); [](auto &&event) { set_level(event.new_level); });
} }
logging_consumer::~logging_consumer() { E_CONSUMER_RELEASE(); } logging_consumer::~logging_consumer() { E_CONSUMER_RELEASE(); }
void logging_consumer::process_event2(const i_event &evt) { void logging_consumer::process_event(const i_event &evt) {
switch (evt.get_event_level()) { switch (evt.get_event_level()) {
case event_level::critical: case event_level::critical:
spdlog::get("file")->critical(evt.get_single_line()); spdlog::get("file")->critical(evt.get_single_line());

View File

@ -36,7 +36,7 @@ void event_system::attach(event_consumer *consumer) {
} }
void event_system::attach(std::string_view event_name, void event_system::attach(std::string_view event_name,
event_consumer *consumer) { event_consumer *consumer) {
recur_mutex_lock lock(consumer_mutex_); recur_mutex_lock lock(consumer_mutex_);
event_consumers_[std::string{event_name}].push_back(consumer); event_consumers_[std::string{event_name}].push_back(consumer);
} }
@ -83,8 +83,8 @@ void event_system::process_events() {
}; };
for (const auto &evt : event_list) { for (const auto &evt : event_list) {
notify_events("", *evt.get()); notify_events("", *evt);
notify_events(evt->get_name(), *evt.get()); notify_events(evt->get_name(), *evt);
} }
lock_and_notify(); lock_and_notify();

View File

@ -22,8 +22,9 @@
#include "file_manager/cache_size_mgr.hpp" #include "file_manager/cache_size_mgr.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "events/event.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/invalid_cache_size.hpp"
#include "events/types/max_cache_size_reached.hpp"
#include "types/startup_exception.hpp" #include "types/startup_exception.hpp"
#include "utils/file_utils.hpp" #include "utils/file_utils.hpp"
@ -31,6 +32,8 @@ namespace repertory {
cache_size_mgr cache_size_mgr::instance_{}; cache_size_mgr cache_size_mgr::instance_{};
auto cache_size_mgr::expand(std::uint64_t size) -> api_error { auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
REPERTORY_USES_FUNCTION_NAME();
unique_mutex_lock lock(mtx_); unique_mutex_lock lock(mtx_);
if (cfg_ == nullptr) { if (cfg_ == nullptr) {
@ -54,8 +57,8 @@ auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
while (not get_stop_requested() && cache_size_ > max_cache_size && while (not get_stop_requested() && cache_size_ > max_cache_size &&
cache_dir.count() > 1U) { cache_dir.count() > 1U) {
if (last_cache_size != cache_size_) { if (last_cache_size != cache_size_) {
event_system::instance().raise<max_cache_size_reached>(cache_size_, event_system::instance().raise<max_cache_size_reached>(
max_cache_size); cache_size_, function_name, max_cache_size);
last_cache_size = cache_size_; last_cache_size = cache_size_;
} }
notify_.wait_for(lock, cache_wait_secs); notify_.wait_for(lock, cache_wait_secs);
@ -94,6 +97,8 @@ void cache_size_mgr::initialize(app_config *cfg) {
} }
auto cache_size_mgr::shrink(std::uint64_t size) -> api_error { auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
REPERTORY_USES_FUNCTION_NAME();
mutex_lock lock(mtx_); mutex_lock lock(mtx_);
if (size == 0U) { if (size == 0U) {
notify_.notify_all(); notify_.notify_all();
@ -103,7 +108,8 @@ auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
if (cache_size_ >= size) { if (cache_size_ >= size) {
cache_size_ -= size; cache_size_ -= size;
} else { } else {
event_system::instance().raise<invalid_cache_size>(cache_size_, size); event_system::instance().raise<invalid_cache_size>(cache_size_,
function_name, size);
cache_size_ = 0U; cache_size_ = 0U;
} }

View File

@ -23,12 +23,19 @@
#include "app_config.hpp" #include "app_config.hpp"
#include "db/file_mgr_db.hpp" #include "db/file_mgr_db.hpp"
#include "events/types/download_restore_failed.hpp"
#include "events/types/download_restored.hpp"
#include "events/types/download_resume_add_failed.hpp"
#include "events/types/download_resume_added.hpp"
#include "events/types/download_resume_removed.hpp"
#include "events/types/download_type_selected.hpp"
#include "events/types/file_upload_failed.hpp" #include "events/types/file_upload_failed.hpp"
#include "events/types/file_upload_not_found.hpp" #include "events/types/file_upload_not_found.hpp"
#include "events/types/file_upload_queued.hpp" #include "events/types/file_upload_queued.hpp"
#include "events/types/file_upload_removed.hpp" #include "events/types/file_upload_removed.hpp"
#include "events/types/file_upload_retry.hpp" #include "events/types/file_upload_retry.hpp"
#include "events/types/filesystem_item_evicted.hpp" #include "events/types/filesystem_item_evicted.hpp"
#include "events/types/item_timeout.hpp"
#include "events/types/service_start_begin.hpp" #include "events/types/service_start_begin.hpp"
#include "events/types/service_start_end.hpp" #include "events/types/service_start_end.hpp"
#include "events/types/service_stop_begin.hpp" #include "events/types/service_stop_begin.hpp"
@ -58,8 +65,8 @@ file_manager::file_manager(app_config &config, i_provider &provider)
return; return;
} }
E_SUBSCRIBE_EXACT(file_upload_completed, E_SUBSCRIBE(file_upload_completed,
[this](auto &&event) { this->upload_completed(event); }); [this](auto &&event) { this->upload_completed(event); });
} }
file_manager::~file_manager() { file_manager::~file_manager() {
@ -100,6 +107,8 @@ auto file_manager::close_all(const std::string &api_path) -> bool {
} }
void file_manager::close_timed_out_files() { void file_manager::close_timed_out_files() {
REPERTORY_USES_FUNCTION_NAME();
unique_recur_mutex_lock file_lock(open_file_mtx_); unique_recur_mutex_lock file_lock(open_file_mtx_);
auto closeable_list = auto closeable_list =
std::accumulate(open_file_lookup_.begin(), open_file_lookup_.end(), std::accumulate(open_file_lookup_.begin(), open_file_lookup_.end(),
@ -118,8 +127,8 @@ void file_manager::close_timed_out_files() {
for (auto &closeable_file : closeable_list) { for (auto &closeable_file : closeable_list) {
closeable_file->close(); closeable_file->close();
event_system::instance().raise<item_timeout>( event_system::instance().raise<item_timeout>(closeable_file->get_api_path(),
closeable_file->get_api_path()); function_name);
} }
closeable_list.clear(); closeable_list.clear();
} }
@ -225,10 +234,9 @@ auto file_manager::get_next_handle() -> std::uint64_t {
auto file_manager::get_open_file_by_handle(std::uint64_t handle) const auto file_manager::get_open_file_by_handle(std::uint64_t handle) const
-> std::shared_ptr<i_closeable_open_file> { -> std::shared_ptr<i_closeable_open_file> {
auto file_iter = auto file_iter =
std::find_if(open_file_lookup_.begin(), open_file_lookup_.end(), std::ranges::find_if(open_file_lookup_, [&handle](auto &&item) -> bool {
[&handle](auto &&item) -> bool { return item.second->has_handle(handle);
return item.second->has_handle(handle); });
});
return (file_iter == open_file_lookup_.end()) ? nullptr : file_iter->second; return (file_iter == open_file_lookup_.end()) ? nullptr : file_iter->second;
} }
@ -498,7 +506,7 @@ auto file_manager::open(const std::string &api_path, bool directory,
: preferred_type); : preferred_type);
if (not directory) { if (not directory) {
event_system::instance().raise<download_type_selected>( event_system::instance().raise<download_type_selected>(
fsi.api_path, fsi.source_path, type); fsi.api_path, fsi.source_path, function_name, type);
} }
switch (type) { switch (type) {
@ -550,7 +558,7 @@ void file_manager::queue_upload(const std::string &api_path,
})) { })) {
remove_resume(api_path, source_path, true); remove_resume(api_path, source_path, true);
event_system::instance().raise<file_upload_queued>(api_path, function_name, event_system::instance().raise<file_upload_queued>(api_path, function_name,
source_path); source_path);
} else { } else {
event_system::instance().raise<file_upload_failed>( event_system::instance().raise<file_upload_failed>(
api_path, "failed to queue upload", function_name, source_path); api_path, "failed to queue upload", function_name, source_path);
@ -597,6 +605,8 @@ void file_manager::remove_resume(const std::string &api_path,
void file_manager::remove_resume(const std::string &api_path, void file_manager::remove_resume(const std::string &api_path,
const std::string &source_path, bool no_lock) { const std::string &source_path, bool no_lock) {
REPERTORY_USES_FUNCTION_NAME();
if (provider_.is_read_only()) { if (provider_.is_read_only()) {
return; return;
} }
@ -607,8 +617,8 @@ void file_manager::remove_resume(const std::string &api_path,
} }
if (mgr_db_->remove_resume(api_path)) { if (mgr_db_->remove_resume(api_path)) {
event_system::instance().raise<download_resume_removed>(api_path, event_system::instance().raise<download_resume_removed>(
source_path); api_path, source_path, function_name);
} }
if (not no_lock) { if (not no_lock) {
@ -685,7 +695,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
if (removed) { if (removed) {
event_system::instance().raise<file_upload_removed>(api_path, event_system::instance().raise<file_upload_removed>(api_path,
function_name); function_name);
} }
if (not no_lock) { if (not no_lock) {
@ -849,7 +859,8 @@ void file_manager::start() {
return; return;
} }
event_system::instance().raise<service_start_begin>("file_manager"); event_system::instance().raise<service_start_begin>(function_name,
"file_manager");
stop_requested_ = false; stop_requested_ = false;
polling::instance().set_callback({ polling::instance().set_callback({
@ -860,7 +871,8 @@ void file_manager::start() {
if (provider_.is_read_only()) { if (provider_.is_read_only()) {
stop_requested_ = false; stop_requested_ = false;
event_system::instance().raise<service_start_end>("file_manager"); event_system::instance().raise<service_start_end>(function_name,
"file_manager");
return; return;
} }
@ -875,15 +887,18 @@ void file_manager::start() {
if (res != api_error::success) { if (res != api_error::success) {
event_system::instance().raise<download_restore_failed>( event_system::instance().raise<download_restore_failed>(
entry.api_path, entry.source_path, entry.api_path, entry.source_path,
"failed to get filesystem item|" + api_error_to_string(res)); fmt::format("failed to get filesystem item|{}",
api_error_to_string(res)),
function_name);
continue; continue;
} }
if (entry.source_path != fsi.source_path) { if (entry.source_path != fsi.source_path) {
event_system::instance().raise<download_restore_failed>( event_system::instance().raise<download_restore_failed>(
fsi.api_path, fsi.source_path, fsi.api_path, fsi.source_path,
"source path mismatch|expected|" + entry.source_path + "|actual|" + fmt::format("source path mismatch|expected|{}|actual|{}",
fsi.source_path); entry.source_path, fsi.source_path),
function_name);
continue; continue;
} }
@ -891,8 +906,9 @@ void file_manager::start() {
if (not opt_size.has_value()) { if (not opt_size.has_value()) {
event_system::instance().raise<download_restore_failed>( event_system::instance().raise<download_restore_failed>(
fsi.api_path, fsi.source_path, fsi.api_path, fsi.source_path,
"failed to get file size: " + fmt::format("failed to get file size|{}",
std::to_string(utils::get_last_error_code())); utils::get_last_error_code()),
function_name);
continue; continue;
} }
@ -900,8 +916,9 @@ void file_manager::start() {
if (file_size != fsi.size) { if (file_size != fsi.size) {
event_system::instance().raise<download_restore_failed>( event_system::instance().raise<download_restore_failed>(
fsi.api_path, fsi.source_path, fsi.api_path, fsi.source_path,
"file size mismatch|expected|" + std::to_string(fsi.size) + fmt::format("file size mismatch|expected|{}|actual|{}", fsi.size,
"|actual|" + std::to_string(file_size)); file_size),
function_name);
continue; continue;
} }
@ -912,23 +929,27 @@ void file_manager::start() {
: 0U, : 0U,
fsi, provider_, entry.read_state, *this); fsi, provider_, entry.read_state, *this);
open_file_lookup_[entry.api_path] = closeable_file; open_file_lookup_[entry.api_path] = closeable_file;
event_system::instance().raise<download_restored>(fsi.api_path, event_system::instance().raise<download_restored>(
fsi.source_path); fsi.api_path, fsi.source_path, function_name);
} catch (const std::exception &ex) { } catch (const std::exception &ex) {
utils::error::raise_error(function_name, ex, "query error"); utils::error::raise_error(function_name, ex, "query error");
} }
} }
upload_thread_ = std::make_unique<std::thread>([this] { upload_handler(); }); upload_thread_ = std::make_unique<std::thread>([this] { upload_handler(); });
event_system::instance().raise<service_start_end>("file_manager"); event_system::instance().raise<service_start_end>(function_name,
"file_manager");
} }
void file_manager::stop() { void file_manager::stop() {
REPERTORY_USES_FUNCTION_NAME();
if (stop_requested_) { if (stop_requested_) {
return; return;
} }
event_system::instance().raise<service_stop_begin>("file_manager"); event_system::instance().raise<service_stop_begin>(function_name,
"file_manager");
stop_requested_ = true; stop_requested_ = true;
@ -962,10 +983,13 @@ void file_manager::stop() {
upload_thread_.reset(); upload_thread_.reset();
event_system::instance().raise<service_stop_end>("file_manager"); event_system::instance().raise<service_stop_end>(function_name,
"file_manager");
} }
void file_manager::store_resume(const i_open_file &file) { void file_manager::store_resume(const i_open_file &file) {
REPERTORY_USES_FUNCTION_NAME();
if (provider_.is_read_only()) { if (provider_.is_read_only()) {
return; return;
} }
@ -977,12 +1001,13 @@ void file_manager::store_resume(const i_open_file &file) {
file.get_source_path(), file.get_source_path(),
})) { })) {
event_system::instance().raise<download_resume_added>( event_system::instance().raise<download_resume_added>(
file.get_api_path(), file.get_source_path()); file.get_api_path(), file.get_source_path(), function_name);
return; return;
} }
event_system::instance().raise<download_resume_add_failed>( event_system::instance().raise<download_resume_add_failed>(
file.get_api_path(), file.get_source_path(), "failed to store resume"); file.get_api_path(), file.get_source_path(), "failed to store resume",
function_name);
} }
void file_manager::swap_renamed_items(std::string from_api_path, void file_manager::swap_renamed_items(std::string from_api_path,

View File

@ -21,6 +21,7 @@
*/ */
#include "file_manager/open_file.hpp" #include "file_manager/open_file.hpp"
#include "app_config.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/download_begin.hpp" #include "events/types/download_begin.hpp"
#include "events/types/download_end.hpp" #include "events/types/download_end.hpp"

View File

@ -21,6 +21,7 @@
*/ */
#include "file_manager/ring_buffer_base.hpp" #include "file_manager/ring_buffer_base.hpp"
#include "app_config.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/types/download_begin.hpp" #include "events/types/download_begin.hpp"
#include "events/types/download_end.hpp" #include "events/types/download_end.hpp"

View File

@ -32,6 +32,7 @@
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "utils/file_utils.hpp" #include "utils/file_utils.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
#include "utils/string.hpp"
#include "utils/unix.hpp" #include "utils/unix.hpp"
namespace repertory { namespace repertory {

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