Compare commits
1 Commits
b5ae3e4ed1
...
v2.0.3-rc
Author | SHA1 | Date | |
---|---|---|---|
fa439c634f |
@ -128,6 +128,7 @@ libcurl
|
||||
libdsm
|
||||
libevent
|
||||
libexample
|
||||
libexpat
|
||||
libfuse3
|
||||
libgmock
|
||||
libgtest
|
||||
@ -140,10 +141,12 @@ libuuid
|
||||
libuuid_include_dirs
|
||||
libvlc
|
||||
linkflags
|
||||
localappdata
|
||||
lptr
|
||||
lpwstr
|
||||
markdownlint
|
||||
mbig
|
||||
minio
|
||||
msvc
|
||||
msvcr120
|
||||
msys2
|
||||
@ -200,6 +203,7 @@ stduuid_project
|
||||
strequal
|
||||
ularge_integer
|
||||
uring
|
||||
url
|
||||
userenv
|
||||
utimens_impl
|
||||
utimensat
|
||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -4,21 +4,21 @@
|
||||
|
||||
### 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
|
||||
* \#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~~
|
||||
* \#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
|
||||
|
@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.27)
|
||||
cmake_policy(SET CMP0135 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}
|
||||
DESCRIPTION ${PROJECT_DESC}
|
||||
HOMEPAGE_URL ${PROJECT_URL}
|
||||
@ -158,6 +162,7 @@ endif()
|
||||
-DPROJECT_FUSE=${PROJECT_FUSE}
|
||||
-DPROJECT_FUSE_INCLUDE_DIRS=${PROJECT_FUSE_INCLUDE_DIRS}
|
||||
-DPROJECT_GIT_REV=${PROJECT_GIT_REV}
|
||||
-DPROJECT_INTERFACE=1
|
||||
-DPROJECT_IS_ALPINE=${PROJECT_IS_ALPINE}
|
||||
-DPROJECT_IS_ARM64=${PROJECT_IS_ARM64}
|
||||
-DPROJECT_IS_MINGW=${PROJECT_IS_MINGW}
|
||||
|
126
README.md
126
README.md
@ -1,23 +1,22 @@
|
||||
# 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.
|
||||
|
||||
## Details and Features
|
||||
|
||||
* Optimized for [Plex Media Server](https://www.plex.tv/)
|
||||
* Single application to mount AWS S3 and/or Sia
|
||||
* Remote mounting of Repertory instances on Linux ~~, OS X~~ and Windows
|
||||
* Securely share your mounts over TCP/IP (`XChaCha20-Poly1305` stream cipher)
|
||||
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64, ~~OS X,~~ Windows 64-bit)
|
||||
* Single application to mount S3 and/or Sia
|
||||
* Remote mounting of Repertory instances on Linux and Windows
|
||||
* 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, Windows 64-bit)
|
||||
* Optionally encrypt file names and file data via `XChaCha20-Poly1305` in S3 mounts
|
||||
|
||||
## Minimum Requirements
|
||||
|
||||
* [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v0.4.0+ for Sia support
|
||||
* Only 64-bit operating systems are supported
|
||||
* 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:
|
||||
* [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 `amd64`
|
||||
* ~~OS X Mojave and above~~
|
||||
* Windows 64-bit 10, 11
|
||||
|
||||
## 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
|
||||
|
||||
* `-dc`
|
||||
* Display mount configuration.
|
||||
* For Sia, `--name` is optional
|
||||
* For S3, the `-s3` option is required along with `--name`
|
||||
* `--help`
|
||||
* Display all mount utility options.
|
||||
* Display all mount utility options
|
||||
* `--name, -na [name]`
|
||||
* 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.
|
||||
* 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.
|
||||
* `-set SiaConfig.Bucket`
|
||||
* Set Sia bucket name for the mount.
|
||||
* Can be used in combination with `--name` to target a unique configuration.
|
||||
* `-set S3Config.Bucket`
|
||||
* 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`.
|
||||
* `-dc`
|
||||
* Display mount configuration
|
||||
* For Sia, `--name` is optional
|
||||
* For S3, the `-s3` option is required along with `--name`
|
||||
|
||||
### Sia
|
||||
### Data Directories
|
||||
|
||||
* Linux
|
||||
* `repertory /mnt/location`
|
||||
* `repertory --name default /mnt/location`
|
||||
* `~/.local/repertory2`
|
||||
* Windows
|
||||
* `repertory.exe t:`
|
||||
* `repertory.exe --name default t:`
|
||||
* `%LOCALAPPDATA%\repertory2`
|
||||
* 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 --name storj -s3 /mnt/location`
|
||||
* Windows
|
||||
* `repertory.exe --name storj -s3 t:`
|
||||
`Repertory` allows local mounts to be shared with other computers on your network.
|
||||
This option is referred to as remote mounting. Instructions TBD.
|
||||
|
||||
## Compiling
|
||||
|
||||
@ -94,17 +149,26 @@ on Windows.
|
||||
|
||||
## Credits
|
||||
|
||||
* [binutils](https://www.gnu.org/software/binutils/)
|
||||
* [boost c++ libraries](https://www.boost.org/)
|
||||
* [cpp-httplib](https://github.com/yhirose/cpp-httplib)
|
||||
* [curl](https://curl.haxx.se/)
|
||||
* ~~[FUSE for macOS](https://osxfuse.github.io/)~~
|
||||
* [docker](https://www.docker.com/)
|
||||
* [Google Test](https://github.com/google/googletest)
|
||||
* [ICU](https://icu.unicode.org/)
|
||||
* [JSON for Modern C++](https://github.com/nlohmann/json)
|
||||
* [libexpat](https://github.com/libexpat/libexpat)
|
||||
* [libfuse](https://github.com/libfuse/libfuse)
|
||||
* [libsodium](https://doc.libsodium.org/)
|
||||
* [mingw-w64](https://www.mingw-w64.org/)
|
||||
* [MSYS2](https://www.msys2.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/)
|
||||
* [Sia Decentralized Cloud Storage](https://sia.tech/)
|
||||
* [spdlog](https://github.com/gabime/spdlog)
|
||||
* [SQLite](https://www.sqlite.org)
|
||||
* [stduuid](https://github.com/mariusbancila/stduuid)
|
||||
* [Storj](https://storj.io/)
|
||||
|
@ -1,15 +1,15 @@
|
||||
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_MINOR_VERSION 87)
|
||||
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(CURL2_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(EXPAT2_VERSION 2_6_4)
|
||||
set(GCC_VERSION 14.2.0)
|
||||
set(GTEST_VERSION 1.15.2)
|
||||
set(ICU_VERSION 76-1)
|
||||
@ -22,7 +22,7 @@ set(PKG_CONFIG_VERSION 0.29.2)
|
||||
set(PUGIXML_VERSION 1.14)
|
||||
set(ROCKSDB_VERSION 9.7.4)
|
||||
set(SPDLOG_VERSION 1.15.0)
|
||||
set(SQLITE2_VERSION 3.46.1)
|
||||
set(SQLITE_VERSION 3460100)
|
||||
set(SQLITE2_VERSION 3.46.1)
|
||||
set(STDUUID_VERSION 1.2.3)
|
||||
set(ZLIB_VERSION 1.3.1)
|
||||
|
@ -22,12 +22,14 @@
|
||||
#ifndef REPERTORY_INCLUDE_APP_CONFIG_HPP_
|
||||
#define REPERTORY_INCLUDE_APP_CONFIG_HPP_
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class app_config final {
|
||||
private:
|
||||
static stop_type stop_requested;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto
|
||||
default_agent_name(const provider_type &prov) -> std::string;
|
||||
@ -50,6 +52,11 @@ public:
|
||||
[[nodiscard]] static auto
|
||||
get_provider_name(const provider_type &prov) -> std::string;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto get_stop_requested() -> bool;
|
||||
|
||||
static void set_stop_requested();
|
||||
|
||||
public:
|
||||
app_config(const provider_type &prov, std::string_view data_directory = "");
|
||||
|
||||
|
@ -22,10 +22,11 @@
|
||||
#ifndef REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||
#define REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "comm/curl/multi_request.hpp"
|
||||
#include "comm/i_http_comm.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "events/types/curl_error.hpp"
|
||||
#include "utils/encryption.hpp"
|
||||
|
||||
namespace repertory {
|
||||
@ -42,7 +43,7 @@ private:
|
||||
|
||||
struct read_write_info final {
|
||||
data_buffer data{};
|
||||
stop_type &stop_requested;
|
||||
stop_type_callback stop_requested_cb;
|
||||
};
|
||||
|
||||
static const write_callback write_data;
|
||||
@ -115,7 +116,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (response_code != 200) {
|
||||
if (response_code != http_error_codes::ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -136,6 +137,8 @@ public:
|
||||
[[nodiscard]] static auto
|
||||
make_request(const host_config &cfg, const request_type &request,
|
||||
long &response_code, stop_type &stop_requested) -> bool {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (request.decryption_token.has_value() &&
|
||||
not request.decryption_token.value().empty()) {
|
||||
return make_encrypted_request(cfg, request, response_code,
|
||||
@ -170,7 +173,12 @@ public:
|
||||
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, write_headers);
|
||||
}
|
||||
|
||||
read_write_info write_info{{}, stop_requested};
|
||||
read_write_info write_info{
|
||||
{},
|
||||
[&stop_requested]() -> bool {
|
||||
return stop_requested || app_config::get_stop_requested();
|
||||
},
|
||||
};
|
||||
if (request.response_handler.has_value()) {
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_info);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
||||
@ -217,7 +225,8 @@ public:
|
||||
}
|
||||
|
||||
if (curl_code != CURLE_OK) {
|
||||
event_system::instance().raise<curl_error>(url, curl_code);
|
||||
event_system::instance().raise<curl_error>(curl_code, function_name,
|
||||
url);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ private:
|
||||
stop_type &stop_requested_;
|
||||
CURLM *multi_handle_;
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
public:
|
||||
void get_result(CURLcode &curl_code, long &http_code);
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
virtual void enumerate_item_list(
|
||||
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
|
||||
stop_type &stop_requested) const = 0;
|
||||
stop_type_callback stop_requested_cb) const = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
@ -84,7 +84,8 @@ public:
|
||||
get_file_source_path(const std::string &api_path,
|
||||
std::string &source_path) const -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_item_list(stop_type &stop_requested) const
|
||||
[[nodiscard]] virtual auto
|
||||
get_item_list(stop_type_callback stop_requested_cb) const
|
||||
-> std::vector<file_info> = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_source_path(const std::string &api_path,
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
virtual void enumerate_api_path_list(
|
||||
std::function<void(const std::vector<std::string> &)> callback,
|
||||
stop_type &stop_requested) const = 0;
|
||||
stop_type_callback stop_requested_cb) const = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
|
||||
void enumerate_item_list(
|
||||
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
|
||||
stop_type &stop_requested) const override;
|
||||
stop_type_callback stop_requested_cb) const override;
|
||||
|
||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
@ -106,7 +106,7 @@ public:
|
||||
std::string &source_path) const
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_item_list(stop_type &stop_requested) const
|
||||
[[nodiscard]] auto get_item_list(stop_type_callback stop_requested_cb) const
|
||||
-> std::vector<i_file_db::file_info> override;
|
||||
|
||||
[[nodiscard]] auto get_source_path(const std::string &api_path,
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
|
||||
void enumerate_api_path_list(
|
||||
std::function<void(const std::vector<std::string> &)> callback,
|
||||
stop_type &stop_requested) const override;
|
||||
stop_type_callback stop_requested_cb) const override;
|
||||
|
||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
void enumerate_item_list(
|
||||
std::function<void(const std::vector<i_file_db::file_info> &)> callback,
|
||||
stop_type &stop_requested) const override;
|
||||
stop_type_callback stop_requested_cb) const override;
|
||||
|
||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
@ -81,7 +81,7 @@ public:
|
||||
std::string &source_path) const
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto get_item_list(stop_type &stop_requested) const
|
||||
[[nodiscard]] auto get_item_list(stop_type_callback stop_requested_cb) const
|
||||
-> std::vector<i_file_db::file_info> override;
|
||||
|
||||
[[nodiscard]] auto get_source_path(const std::string &api_path,
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
|
||||
void enumerate_api_path_list(
|
||||
std::function<void(const std::vector<std::string> &)> callback,
|
||||
stop_type &stop_requested) const override;
|
||||
stop_type_callback stop_requested_cb) const override;
|
||||
|
||||
[[nodiscard]] auto get_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
|
@ -22,12 +22,10 @@
|
||||
#ifndef REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
||||
#define REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
|
||||
|
||||
#include "utils/single_thread_service_base.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class directory_iterator;
|
||||
|
||||
class directory_cache final : public single_thread_service_base {
|
||||
class directory_cache final {
|
||||
public:
|
||||
using execute_callback = std::function<void(directory_iterator &)>;
|
||||
|
||||
@ -35,13 +33,11 @@ private:
|
||||
struct open_directory final {
|
||||
std::shared_ptr<directory_iterator> iterator;
|
||||
std::vector<std::uint64_t> handles;
|
||||
std::chrono::system_clock::time_point last_update{
|
||||
std::chrono::system_clock::now()};
|
||||
};
|
||||
|
||||
public:
|
||||
directory_cache() : single_thread_service_base("directory_cache") {}
|
||||
~directory_cache() override = default;
|
||||
directory_cache() = default;
|
||||
~directory_cache() = default;
|
||||
|
||||
directory_cache(const directory_cache &) = delete;
|
||||
directory_cache(directory_cache &&) = delete;
|
||||
@ -51,17 +47,13 @@ public:
|
||||
private:
|
||||
std::unordered_map<std::string, open_directory> directory_lookup_;
|
||||
std::recursive_mutex directory_mutex_;
|
||||
std::unique_ptr<std::thread> refresh_thread_;
|
||||
|
||||
protected:
|
||||
void service_function() override;
|
||||
|
||||
public:
|
||||
void execute_action(const std::string &api_path,
|
||||
const execute_callback &execute);
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_directory(std::uint64_t handle) -> std::shared_ptr<directory_iterator>;
|
||||
[[nodiscard]] auto get_directory(std::uint64_t handle)
|
||||
-> std::shared_ptr<directory_iterator>;
|
||||
|
||||
auto remove_directory(const std::string &api_path)
|
||||
-> std::shared_ptr<directory_iterator>;
|
||||
|
@ -1,41 +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_DRIVES_FUSE_EVENTS_HPP_
|
||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
|
||||
namespace repertory {
|
||||
// clang-format off
|
||||
E_SIMPLE3(fuse_event, debug, true,
|
||||
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, true,
|
||||
std::string, arguments, args, E_FROM_STRING
|
||||
);
|
||||
// clang-format on
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
@ -24,7 +24,7 @@
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class app_config;
|
||||
@ -51,8 +51,8 @@ private:
|
||||
std::string mount_location_;
|
||||
|
||||
protected:
|
||||
bool atime_enabled_ = true;
|
||||
bool console_enabled_ = false;
|
||||
bool atime_enabled_{true};
|
||||
bool console_enabled_{false};
|
||||
std::optional<gid_t> forced_gid_;
|
||||
std::optional<uid_t> forced_uid_;
|
||||
std::optional<mode_t> forced_umask_;
|
||||
|
@ -63,11 +63,14 @@ private:
|
||||
std::shared_ptr<logging_consumer> logging_consumer_;
|
||||
std::shared_ptr<remote_fuse::remote_server> remote_server_;
|
||||
std::shared_ptr<full_server> server_;
|
||||
bool was_mounted_ = false;
|
||||
std::mutex stop_all_mtx_;
|
||||
bool was_mounted_{false};
|
||||
|
||||
private:
|
||||
void update_accessed_time(const std::string &api_path);
|
||||
|
||||
void stop_all();
|
||||
|
||||
protected:
|
||||
#if defined(__APPLE__)
|
||||
[[nodiscard]] auto chflags_impl(std::string api_path,
|
||||
|
@ -30,7 +30,10 @@
|
||||
#include "drives/remote/remote_open_file_table.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "events/types/service_start_begin.hpp"
|
||||
#include "events/types/service_start_end.hpp"
|
||||
#include "events/types/service_stop_begin.hpp"
|
||||
#include "events/types/service_stop_end.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/base64.hpp"
|
||||
@ -55,7 +58,10 @@ public:
|
||||
drive_(drv),
|
||||
mount_location_(std::move(mount_location)),
|
||||
client_pool_(config.get_remote_mount().client_pool_size) {
|
||||
event_system::instance().raise<service_started>("remote_server_base");
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
event_system::instance().raise<service_start_begin>(function_name,
|
||||
"remote_server_base");
|
||||
handler_lookup_.insert(
|
||||
{"::winfsp_can_delete",
|
||||
[this](std::uint32_t, const std::string &, std::uint64_t,
|
||||
@ -1372,14 +1378,19 @@ public:
|
||||
method, request, response,
|
||||
message_complete);
|
||||
});
|
||||
event_system::instance().raise<service_start_end>(function_name,
|
||||
"remote_server_base");
|
||||
}
|
||||
|
||||
~remote_server_base() override {
|
||||
event_system::instance().raise<service_shutdown_begin>(
|
||||
"remote_server_base");
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
event_system::instance().raise<service_stop_begin>(function_name,
|
||||
"remote_server_base");
|
||||
client_pool_.shutdown();
|
||||
packet_server_.reset();
|
||||
event_system::instance().raise<service_shutdown_end>("remote_server_base");
|
||||
event_system::instance().raise<service_stop_end>(function_name,
|
||||
"remote_server_base");
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -73,6 +73,7 @@ private:
|
||||
std::unique_ptr<file_manager> fm_;
|
||||
std::unique_ptr<eviction> eviction_;
|
||||
std::unique_ptr<remote_winfsp::remote_server> remote_server_;
|
||||
std::mutex stop_all_mtx_;
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto handle_error(std::string_view function_name,
|
||||
@ -94,6 +95,8 @@ private:
|
||||
static void set_file_info(remote::file_info &dest,
|
||||
const FSP_FSCTL_FILE_INFO &src);
|
||||
|
||||
void stop_all();
|
||||
|
||||
public:
|
||||
auto CanDelete(PVOID file_node, PVOID file_desc, PWSTR file_name)
|
||||
-> NTSTATUS override;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class console_consumer final {
|
||||
@ -36,7 +37,7 @@ public:
|
||||
~console_consumer();
|
||||
|
||||
private:
|
||||
void process_event(const event &e) const;
|
||||
static void process_event(const i_event &evt);
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -23,9 +23,10 @@
|
||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class logging_consumer {
|
||||
class logging_consumer final {
|
||||
E_CONSUMER();
|
||||
|
||||
public:
|
||||
@ -39,7 +40,7 @@ private:
|
||||
5ULL};
|
||||
|
||||
private:
|
||||
void process_event(const event &event) const;
|
||||
static void process_event(const i_event &evt);
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -1,92 +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_EVENT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
||||
|
||||
namespace repertory {
|
||||
enum class event_level {
|
||||
critical,
|
||||
error,
|
||||
warn,
|
||||
info,
|
||||
debug,
|
||||
trace,
|
||||
};
|
||||
|
||||
[[nodiscard]] auto
|
||||
event_level_from_string(std::string level,
|
||||
event_level default_level = event_level::info)
|
||||
-> event_level;
|
||||
|
||||
[[nodiscard]] auto event_level_to_string(event_level level) -> std::string;
|
||||
|
||||
class event {
|
||||
protected:
|
||||
explicit event(bool allow_async) : allow_async_(allow_async) {}
|
||||
|
||||
event(const std::stringstream &ss, json j, bool allow_async)
|
||||
: allow_async_(allow_async), ss_(ss.str()), j_(std::move(j)) {}
|
||||
|
||||
public:
|
||||
event(const event &) = delete;
|
||||
event(event &&) = delete;
|
||||
auto operator=(const event &) -> event & = delete;
|
||||
auto operator=(event &&) -> event & = delete;
|
||||
virtual ~event() = default;
|
||||
|
||||
private:
|
||||
bool allow_async_;
|
||||
|
||||
protected:
|
||||
std::stringstream ss_;
|
||||
json j_;
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto clone() const -> std::shared_ptr<event> = 0;
|
||||
|
||||
[[nodiscard]] auto get_allow_async() const -> bool { return allow_async_; }
|
||||
|
||||
[[nodiscard]] virtual auto get_event_level() const -> event_level = 0;
|
||||
|
||||
[[nodiscard]] auto get_json() const -> json { return j_; }
|
||||
|
||||
[[nodiscard]] virtual auto get_name() const -> std::string = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_single_line() const -> std::string = 0;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<std::atomic<repertory::event_level>> {
|
||||
static void to_json(json &data,
|
||||
const std::atomic<repertory::event_level> &value) {
|
||||
data = repertory::event_level_to_string(value.load());
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
std::atomic<repertory::event_level> &value) {
|
||||
value.store(repertory::event_level_from_string(data.get<std::string>()));
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
@ -1,241 +1,141 @@
|
||||
/*
|
||||
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_EVENT_SYSTEM_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "events/t_event_system.hpp"
|
||||
|
||||
namespace repertory {
|
||||
using event_system = t_event_system<event>;
|
||||
using event_consumer = event_system::event_consumer;
|
||||
|
||||
#define E_FROM_API_FILE_ERROR(e) api_error_to_string(e)
|
||||
#define E_FROM_BOOL(t) std::to_string(t)
|
||||
#define E_FROM_CURL_CODE(t) std::string(curl_easy_strerror(t))
|
||||
#define E_FROM_DOUBLE(d) std::to_string(d)
|
||||
#define E_FROM_DOUBLE_PRECISE(dbl_val) \
|
||||
([](const double &d) -> std::string { \
|
||||
std::stringstream ss; \
|
||||
ss << std::fixed << std::setprecision(2) << d; \
|
||||
return ss.str(); \
|
||||
})(dbl_val)
|
||||
#define E_FROM_INT32(t) std::to_string(t)
|
||||
#define E_FROM_SIZE_T(t) std::to_string(t)
|
||||
#define E_FROM_STRING(t) t
|
||||
#define E_FROM_UINT16(t) std::to_string(t)
|
||||
#define E_FROM_UINT64(t) std::to_string(t)
|
||||
#define E_FROM_DOWNLOAD_TYPE(t) download_type_to_string(t)
|
||||
|
||||
#define E_PROP(type, name, short_name, ts) \
|
||||
private: \
|
||||
void init_##short_name(const type &val) { \
|
||||
auto ts_val = ts(val); \
|
||||
ss_ << "|" << #short_name << "|" << ts_val; \
|
||||
j_[#name] = ts_val; \
|
||||
} \
|
||||
\
|
||||
public: \
|
||||
[[nodiscard]] auto get_##name() const->json { return j_[#name]; }
|
||||
|
||||
#define E_BEGIN(name, el) \
|
||||
class name final : public virtual event { \
|
||||
private: \
|
||||
name(const std::stringstream &ss, const json &j, bool allow_async) \
|
||||
: event(ss, j, allow_async) {} \
|
||||
\
|
||||
public: \
|
||||
~name() override = default; \
|
||||
\
|
||||
public: \
|
||||
static const event_level level = event_level::el; \
|
||||
\
|
||||
public: \
|
||||
[[nodiscard]] auto get_name() const -> std::string override { \
|
||||
return #name; \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override { \
|
||||
return name::level; \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override { \
|
||||
const auto s = ss_.str(); \
|
||||
return get_name() + (s.empty() ? "" : s); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] auto clone() const -> std::shared_ptr<event> override { \
|
||||
return std::shared_ptr<name>(new name(ss_, j_, get_allow_async())); \
|
||||
}
|
||||
#define E_END() }
|
||||
|
||||
#define E_SIMPLE(event_name, el, allow_async) \
|
||||
E_BEGIN(event_name, el) \
|
||||
public: \
|
||||
event_name() : event(allow_async) {} \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE1(event_name, el, allow_async, type, name, short_name, tc) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv) : event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE2(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2) : event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE3(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2, type3, name3, short_name3, \
|
||||
tc3) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2, const type3 &tv3) \
|
||||
: event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
init_##short_name3(tv3); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_PROP(type3, name3, short_name3, tc3) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE4(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2, type3, name3, short_name3, \
|
||||
tc3, type4, name4, short_name4, tc4) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2, const type3 &tv3, \
|
||||
const type4 &tv4) \
|
||||
: event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
init_##short_name3(tv3); \
|
||||
init_##short_name4(tv4); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_PROP(type3, name3, short_name3, tc3) \
|
||||
E_PROP(type4, name4, short_name4, tc4) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE5(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2, type3, name3, short_name3, \
|
||||
tc3, type4, name4, short_name4, tc4, type5, name5, \
|
||||
short_name5, tc5) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2, const type3 &tv3, \
|
||||
const type4 &tv4, const type5 &tv5) \
|
||||
: event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
init_##short_name3(tv3); \
|
||||
init_##short_name4(tv4); \
|
||||
init_##short_name5(tv5); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_PROP(type3, name3, short_name3, tc3) \
|
||||
E_PROP(type4, name4, short_name4, tc4) \
|
||||
E_PROP(type5, name5, short_name5, tc5) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE6(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2, type3, name3, short_name3, \
|
||||
tc3, type4, name4, short_name4, tc4, type5, name5, \
|
||||
short_name5, tc5, type6, name6, short_name6, tc6) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2, const type3 &tv3, \
|
||||
const type4 &tv4, const type5 &tv5, const type6 &tv6) \
|
||||
: event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
init_##short_name3(tv3); \
|
||||
init_##short_name4(tv4); \
|
||||
init_##short_name5(tv5); \
|
||||
init_##short_name6(tv6); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_PROP(type3, name3, short_name3, tc3) \
|
||||
E_PROP(type4, name4, short_name4, tc4) \
|
||||
E_PROP(type5, name5, short_name5, tc5) \
|
||||
E_PROP(type6, name6, short_name6, tc6) \
|
||||
E_END()
|
||||
|
||||
#define E_SIMPLE7(event_name, el, allow_async, type, name, short_name, tc, \
|
||||
type2, name2, short_name2, tc2, type3, name3, short_name3, \
|
||||
tc3, type4, name4, short_name4, tc4, type5, name5, \
|
||||
short_name5, tc5, type6, name6, short_name6, tc6, type7, \
|
||||
name7, short_name7, tc7) \
|
||||
E_BEGIN(event_name, el) \
|
||||
explicit event_name(const type &tv, const type2 &tv2, const type3 &tv3, \
|
||||
const type4 &tv4, const type5 &tv5, const type6 &tv6, \
|
||||
const type7 &tv7) \
|
||||
: event(allow_async) { \
|
||||
init_##short_name(tv); \
|
||||
init_##short_name2(tv2); \
|
||||
init_##short_name3(tv3); \
|
||||
init_##short_name4(tv4); \
|
||||
init_##short_name5(tv5); \
|
||||
init_##short_name6(tv6); \
|
||||
init_##short_name7(tv7); \
|
||||
} \
|
||||
E_PROP(type, name, short_name, tc) \
|
||||
E_PROP(type2, name2, short_name2, tc2) \
|
||||
E_PROP(type3, name3, short_name3, tc3) \
|
||||
E_PROP(type4, name4, short_name4, tc4) \
|
||||
E_PROP(type5, name5, short_name5, tc5) \
|
||||
E_PROP(type6, name6, short_name6, tc6) \
|
||||
E_PROP(type7, name7, short_name7, tc7) \
|
||||
E_END()
|
||||
|
||||
#define E_CONSUMER() \
|
||||
private: \
|
||||
std::vector<std::shared_ptr<repertory::event_consumer>> event_consumers_
|
||||
|
||||
#define E_CONSUMER_RELEASE() event_consumers_.clear()
|
||||
|
||||
#define E_SUBSCRIBE(name, callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
#name, [this](const event &evt) { callback(evt); }))
|
||||
|
||||
#define E_SUBSCRIBE_EXACT(name, callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
#name, [this](const event &evt) { \
|
||||
callback(dynamic_cast<const name &>(evt)); \
|
||||
}))
|
||||
|
||||
#define E_SUBSCRIBE_ALL(callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
[this](const event &evt) { callback(evt); }))
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||
/*
|
||||
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_EVENT_SYSTEM_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||
|
||||
namespace repertory {
|
||||
class i_event;
|
||||
|
||||
class event_system final {
|
||||
private:
|
||||
static constexpr const std::uint8_t max_queue_retry{
|
||||
30U,
|
||||
};
|
||||
|
||||
const std::uint32_t max_queue_size{
|
||||
std::thread::hardware_concurrency() * 4U,
|
||||
};
|
||||
|
||||
static constexpr const std::chrono::seconds queue_wait_secs{
|
||||
5s,
|
||||
};
|
||||
|
||||
public:
|
||||
event_system(const event_system &) = delete;
|
||||
event_system(event_system &&) = delete;
|
||||
auto operator=(const event_system &) -> event_system & = delete;
|
||||
auto operator=(event_system &&) -> event_system & = delete;
|
||||
|
||||
protected:
|
||||
event_system() = default;
|
||||
|
||||
~event_system() { stop(); }
|
||||
|
||||
public:
|
||||
class event_consumer final {
|
||||
public:
|
||||
explicit event_consumer(std::function<void(const i_event &)> callback)
|
||||
: callback_(std::move(callback)) {
|
||||
event_system::instance().attach(this);
|
||||
}
|
||||
|
||||
event_consumer(std::string_view event_name,
|
||||
std::function<void(const i_event &)> callback)
|
||||
: callback_(std::move(callback)) {
|
||||
event_system::instance().attach(event_name, this);
|
||||
}
|
||||
|
||||
~event_consumer() { event_system::instance().release(this); }
|
||||
|
||||
public:
|
||||
event_consumer(const event_consumer &) = delete;
|
||||
event_consumer(event_consumer &&) = delete;
|
||||
auto operator=(const event_consumer &) -> event_consumer & = delete;
|
||||
auto operator=(event_consumer &&) -> event_consumer & = delete;
|
||||
|
||||
private:
|
||||
std::function<void(const i_event &)> callback_;
|
||||
|
||||
public:
|
||||
void notify_event(const i_event &event) { callback_(event); }
|
||||
};
|
||||
|
||||
private:
|
||||
static event_system instance_;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto instance() -> event_system &;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::deque<event_consumer *>>
|
||||
event_consumers_;
|
||||
std::recursive_mutex consumer_mutex_;
|
||||
std::vector<std::shared_ptr<i_event>> event_list_;
|
||||
std::condition_variable event_notify_;
|
||||
std::mutex event_mutex_;
|
||||
std::unique_ptr<std::thread> event_thread_;
|
||||
std::mutex run_mutex_;
|
||||
stop_type stop_requested_{false};
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
void process_events();
|
||||
|
||||
void queue_event(std::shared_ptr<i_event> evt);
|
||||
|
||||
public:
|
||||
void attach(event_consumer *consumer);
|
||||
|
||||
void attach(std::string_view event_name, event_consumer *consumer);
|
||||
|
||||
template <typename evt_t, typename... arg_t> void raise(arg_t &&...args) {
|
||||
queue_event(std::make_shared<evt_t>(std::forward<arg_t>(args)...));
|
||||
}
|
||||
|
||||
void release(event_consumer *consumer);
|
||||
|
||||
void start();
|
||||
|
||||
void stop();
|
||||
};
|
||||
|
||||
using event_consumer = event_system::event_consumer;
|
||||
|
||||
#define E_CONSUMER() \
|
||||
private: \
|
||||
std::vector<std::shared_ptr<repertory::event_consumer>> event_consumers_
|
||||
|
||||
#define E_CONSUMER_RELEASE() event_consumers_.clear()
|
||||
|
||||
#define E_SUBSCRIBE(event, callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
event::name, [this](const i_event &evt) { \
|
||||
callback(dynamic_cast<const event &>(evt)); \
|
||||
}))
|
||||
|
||||
#define E_SUBSCRIBE_ALL(callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
[this](const i_event &evt) { callback(evt); }))
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||
|
@ -1,295 +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_
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
// clang-format off
|
||||
E_SIMPLE2(curl_error, error, true,
|
||||
std::string, url, url, E_FROM_STRING,
|
||||
CURLcode, res, res, E_FROM_CURL_CODE
|
||||
);
|
||||
|
||||
E_SIMPLE3(debug_log, debug, true,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, data, data, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(directory_removed, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(directory_removed_externally, warn, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(directory_remove_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(drive_mount_failed, error, true,
|
||||
std::string, location, loc, E_FROM_STRING,
|
||||
std::string, result, res, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(drive_mounted, info, true,
|
||||
std::string, location, loc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(drive_mount_result, info, true,
|
||||
std::string, result, res, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(drive_unmount_pending, info, true,
|
||||
std::string, location, loc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(drive_unmounted, info, true,
|
||||
std::string, location, loc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(event_level_changed, info, true,
|
||||
std::string, new_event_level, level, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(failed_upload_queued, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(failed_upload_removed, warn, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(failed_upload_retry, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_get_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(file_get_api_list_failed, error, true,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(file_pinned, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(file_read_bytes_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING,
|
||||
std::size_t, retry, retry, E_FROM_SIZE_T
|
||||
);
|
||||
|
||||
E_SIMPLE1(file_removed, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_removed_externally, warn, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_remove_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(file_rename_failed, error, true,
|
||||
std::string, from_api_path, FROM, E_FROM_STRING,
|
||||
std::string, to_api_path, TO, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_get_size_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(filesystem_item_added, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, parent, parent, E_FROM_STRING,
|
||||
bool, directory, dir, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE4(filesystem_item_closed, trace, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
bool, directory, dir, E_FROM_BOOL,
|
||||
bool, changed, changed, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE5(filesystem_item_handle_closed, trace, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::uint64_t, handle, handle, E_FROM_UINT64,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
bool, directory, dir, E_FROM_BOOL,
|
||||
bool, changed, changed, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE4(filesystem_item_handle_opened, trace, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::uint64_t, handle, handle, E_FROM_UINT64,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
bool, directory, dir, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE2(filesystem_item_evicted, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(filesystem_item_opened, trace, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
bool, directory, dir, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE1(file_unpinned, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE4(file_upload_completed, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
api_error, result, res, E_FROM_API_FILE_ERROR,
|
||||
bool, cancelled, cancel, E_FROM_BOOL
|
||||
);
|
||||
|
||||
E_SIMPLE3(file_upload_failed, error, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_upload_not_found, warn, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_upload_queued, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(file_upload_removed, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(file_upload_retry, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
api_error, result, res, E_FROM_API_FILE_ERROR
|
||||
);
|
||||
|
||||
E_SIMPLE2(file_upload_started, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_file_deleted, warn, true,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_file_detected, warn, true,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(orphaned_file_processing_failed, error, true,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
std::string, dest, dest, E_FROM_STRING,
|
||||
std::string, result, res, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_source_file_detected, info, true,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(orphaned_source_file_removed, info, true,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(polling_item_begin, debug, true,
|
||||
std::string, item_name, item, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(polling_item_end, debug, true,
|
||||
std::string, item_name, item, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(provider_offline, error, true,
|
||||
std::string, host_name_or_ip, host, E_FROM_STRING,
|
||||
std::uint16_t, port, port, E_FROM_UINT16
|
||||
);
|
||||
|
||||
E_SIMPLE2(provider_upload_begin, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(provider_upload_end, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
api_error, result, res, E_FROM_API_FILE_ERROR
|
||||
);
|
||||
|
||||
E_SIMPLE2(repertory_exception, error, true,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, message, msg, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(rpc_server_exception, error, true,
|
||||
std::string, exception, exception, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(service_shutdown_begin, debug, true,
|
||||
std::string, service, svc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(service_shutdown_end, debug, true,
|
||||
std::string, service, svc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(service_started, debug, true,
|
||||
std::string, service, svc, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE(unmount_requested, info, true);
|
||||
#if !defined(_WIN32)
|
||||
E_SIMPLE2(unmount_result, info, true,
|
||||
std::string, location, loc, E_FROM_STRING,
|
||||
std::string, result, res, E_FROM_STRING
|
||||
);
|
||||
#endif
|
||||
// clang-format on
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
@ -1,36 +1,40 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
#include "events/t_event_system.hpp"
|
||||
|
||||
#include "events/event.hpp"
|
||||
|
||||
namespace repertory {
|
||||
template <typename event_type>
|
||||
auto t_event_system<event_type>::instance() -> t_event_system<event_type> & {
|
||||
return event_system_;
|
||||
}
|
||||
|
||||
template <typename event_type>
|
||||
t_event_system<event_type> t_event_system<event_type>::event_system_;
|
||||
|
||||
template class t_event_system<event>;
|
||||
} // namespace repertory
|
||||
/*
|
||||
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_I_EVENT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_I_EVENT_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class i_event {
|
||||
INTERFACE_SETUP(i_event);
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto get_event_level() const -> event_level = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_name() const -> std::string_view = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_single_line() const -> std::string = 0;
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
@ -1,193 +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_T_EVENT_SYSTEM_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
||||
|
||||
#include "events/event.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory {
|
||||
template <typename event_type> class t_event_system final {
|
||||
public:
|
||||
t_event_system(const t_event_system &) = delete;
|
||||
t_event_system(t_event_system &&) = delete;
|
||||
auto operator=(const t_event_system &) -> t_event_system & = delete;
|
||||
auto operator=(t_event_system &&) -> t_event_system & = delete;
|
||||
|
||||
protected:
|
||||
t_event_system() = default;
|
||||
|
||||
~t_event_system() { stop(); }
|
||||
|
||||
public:
|
||||
class event_consumer final {
|
||||
public:
|
||||
explicit event_consumer(std::function<void(const event &)> callback)
|
||||
: callback_(std::move(callback)) {
|
||||
t_event_system::instance().attach(this);
|
||||
}
|
||||
|
||||
event_consumer(const std::string &event_name,
|
||||
std::function<void(const event &)> callback)
|
||||
: callback_(std::move(callback)) {
|
||||
t_event_system::instance().attach(event_name, this);
|
||||
}
|
||||
|
||||
~event_consumer() { t_event_system::instance().release(this); }
|
||||
|
||||
public:
|
||||
event_consumer(const event_consumer &) = delete;
|
||||
event_consumer(event_consumer &&) = delete;
|
||||
auto operator=(const event_consumer &) -> event_consumer & = delete;
|
||||
auto operator=(event_consumer &&) -> event_consumer & = delete;
|
||||
|
||||
private:
|
||||
std::function<void(const event &)> callback_;
|
||||
|
||||
public:
|
||||
void notify_event(const event &event) { callback_(event); }
|
||||
};
|
||||
|
||||
private:
|
||||
static t_event_system event_system_;
|
||||
|
||||
public:
|
||||
static auto instance() -> t_event_system &;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::deque<event_consumer *>>
|
||||
event_consumers_;
|
||||
std::recursive_mutex consumer_mutex_;
|
||||
std::vector<std::shared_ptr<event_type>> event_list_;
|
||||
std::condition_variable event_notify_;
|
||||
std::mutex event_mutex_;
|
||||
std::unique_ptr<std::thread> event_thread_;
|
||||
std::mutex run_mutex_;
|
||||
stop_type stop_requested_ = false;
|
||||
|
||||
private:
|
||||
void process_events() {
|
||||
std::vector<std::shared_ptr<event_type>> events;
|
||||
{
|
||||
unique_mutex_lock lock(event_mutex_);
|
||||
if (not stop_requested_ && event_list_.empty()) {
|
||||
event_notify_.wait_for(lock, 1s);
|
||||
}
|
||||
|
||||
if (not event_list_.empty()) {
|
||||
events.insert(events.end(), event_list_.begin(), event_list_.end());
|
||||
event_list_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
const auto notify_events = [this](const std::string &name,
|
||||
const event_type &event) {
|
||||
std::deque<std::future<void>> futures;
|
||||
recur_mutex_lock lock(consumer_mutex_);
|
||||
if (event_consumers_.find(name) != event_consumers_.end()) {
|
||||
for (auto *consumer : event_consumers_[name]) {
|
||||
if (event.get_allow_async()) {
|
||||
futures.emplace_back(
|
||||
std::async(std::launch::async, [consumer, &event]() {
|
||||
consumer->notify_event(event);
|
||||
}));
|
||||
} else {
|
||||
consumer->notify_event(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (not futures.empty()) {
|
||||
futures.front().get();
|
||||
futures.pop_front();
|
||||
}
|
||||
};
|
||||
|
||||
for (const auto &evt : events) {
|
||||
notify_events("", *evt.get());
|
||||
notify_events(evt->get_name(), *evt.get());
|
||||
}
|
||||
}
|
||||
|
||||
void queue_event(std::shared_ptr<event_type> evt) {
|
||||
mutex_lock lock(event_mutex_);
|
||||
event_list_.push_back(std::move(evt));
|
||||
event_notify_.notify_all();
|
||||
}
|
||||
|
||||
public:
|
||||
void attach(event_consumer *consumer) {
|
||||
recur_mutex_lock lock(consumer_mutex_);
|
||||
event_consumers_[""].push_back(consumer);
|
||||
}
|
||||
|
||||
void attach(const std::string &event_name, event_consumer *consumer) {
|
||||
recur_mutex_lock lock(consumer_mutex_);
|
||||
event_consumers_[event_name].push_back(consumer);
|
||||
}
|
||||
|
||||
template <typename event_t, typename... arg_t> void raise(arg_t &&...args) {
|
||||
queue_event(std::make_shared<event_t>(std::forward<arg_t>(args)...));
|
||||
}
|
||||
|
||||
void release(event_consumer *consumer) {
|
||||
recur_mutex_lock lock(consumer_mutex_);
|
||||
auto iter = std::find_if(event_consumers_.begin(), event_consumers_.end(),
|
||||
[&](const auto &item) -> bool {
|
||||
return utils::collection::includes(item.second,
|
||||
consumer);
|
||||
});
|
||||
|
||||
if (iter != event_consumers_.end()) {
|
||||
utils::collection::remove_element((*iter).second, consumer);
|
||||
}
|
||||
}
|
||||
|
||||
void start() {
|
||||
mutex_lock lock(run_mutex_);
|
||||
if (not event_thread_) {
|
||||
stop_requested_ = false;
|
||||
event_thread_ = std::make_unique<std::thread>([this]() {
|
||||
while (not stop_requested_) {
|
||||
process_events();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void stop() {
|
||||
mutex_lock lock(run_mutex_);
|
||||
if (event_thread_) {
|
||||
stop_requested_ = true;
|
||||
event_notify_.notify_all();
|
||||
|
||||
event_thread_->join();
|
||||
event_thread_.reset();
|
||||
|
||||
process_events();
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
|
74
repertory/librepertory/include/events/types/curl_error.hpp
Normal file
74
repertory/librepertory/include/events/types/curl_error.hpp
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
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_CURL_ERROR_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_CURL_ERROR_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct curl_error final : public i_event {
|
||||
curl_error() = default;
|
||||
curl_error(CURLcode code_, std::string_view function_name_, std::string url_)
|
||||
: code(code_),
|
||||
function_name(std::string{function_name_}),
|
||||
url(std::move(url_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::error};
|
||||
static constexpr const std::string_view name{"curl_error"};
|
||||
|
||||
CURLcode code{};
|
||||
std::string function_name;
|
||||
std::string url;
|
||||
|
||||
[[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|{}|url|{}|code|{}", name, function_name, url,
|
||||
static_cast<int>(code));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::curl_error> {
|
||||
static void to_json(json &data, const repertory::curl_error &value) {
|
||||
data["code"] = value.code;
|
||||
data["function_name"] = value.function_name;
|
||||
data["url"] = value.url;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::curl_error &value) {
|
||||
data.at("code").get_to<CURLcode>(value.code);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("url").get_to<std::string>(value.url);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_CURL_ERROR_HPP_
|
68
repertory/librepertory/include/events/types/debug_log.hpp
Normal file
68
repertory/librepertory/include/events/types/debug_log.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
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_DEBUG_LOG_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DEBUG_LOG_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct debug_log final : public i_event {
|
||||
debug_log() = default;
|
||||
debug_log(std::string_view function_name_, std::string msg_)
|
||||
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"debug_log"};
|
||||
|
||||
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|{}|msg|{}", name, function_name, msg);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::debug_log> {
|
||||
static void to_json(json &data, const repertory::debug_log &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["msg"] = value.msg;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::debug_log &value) {
|
||||
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_DEBUG_LOG_HPP_
|
@ -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_DIRECTORY_REMOVE_FAILED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DIRECTORY_REMOVE_FAILED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct directory_remove_failed final : public i_event {
|
||||
directory_remove_failed() = default;
|
||||
directory_remove_failed(std::string api_path_, api_error 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::error};
|
||||
static constexpr const std::string_view name{"directory_remove_failed"};
|
||||
|
||||
std::string api_path;
|
||||
api_error 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, api_error_to_string(error));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::directory_remove_failed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::directory_remove_failed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::directory_remove_failed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
value.error =
|
||||
repertory::api_error_from_string(data.at("error").get<std::string>());
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DIRECTORY_REMOVE_FAILED_HPP_
|
@ -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_DIRECTORY_REMOVED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DIRECTORY_REMOVED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct directory_removed final : public i_event {
|
||||
directory_removed() = default;
|
||||
directory_removed(std::string api_path_, std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"directory_removed"};
|
||||
|
||||
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::directory_removed> {
|
||||
static void to_json(json &data, const repertory::directory_removed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::directory_removed &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_DIRECTORY_REMOVED_HPP_
|
@ -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_DIRECTORY_REMOVED_EXTERNALLY_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DIRECTORY_REMOVED_EXTERNALLY_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct directory_removed_externally final : public i_event {
|
||||
directory_removed_externally() = default;
|
||||
directory_removed_externally(std::string api_path_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"directory_removed_externally"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|src|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::directory_removed_externally> {
|
||||
static void to_json(json &data,
|
||||
const repertory::directory_removed_externally &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::directory_removed_externally &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DIRECTORY_REMOVED_EXTERNALLY_HPP_
|
@ -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_BEGIN_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_BEGIN_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct download_begin final : public i_event {
|
||||
download_begin() = default;
|
||||
download_begin(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_begin"};
|
||||
|
||||
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_begin> {
|
||||
static void to_json(json &data, const repertory::download_begin &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_begin &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_BEGIN_HPP_
|
80
repertory/librepertory/include/events/types/download_end.hpp
Normal file
80
repertory/librepertory/include/events/types/download_end.hpp
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
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_END_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_END_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct download_end final : public i_event {
|
||||
download_end() = default;
|
||||
download_end(std::string api_path_, std::string dest_path_, api_error error_,
|
||||
std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
dest_path(std::move(dest_path_)),
|
||||
error(error_),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"download_end"};
|
||||
|
||||
std::string api_path;
|
||||
std::string dest_path;
|
||||
api_error 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, api_error_to_string(error));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::download_end> {
|
||||
static void to_json(json &data, const repertory::download_end &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["dest_path"] = value.dest_path;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::download_end &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("dest_path").get_to<std::string>(value.dest_path);
|
||||
value.error =
|
||||
repertory::api_error_from_string(data.at("error").get<std::string>());
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_END_HPP_
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
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_PROGRESS_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_PROGRESS_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct download_progress final : public i_event {
|
||||
download_progress() = default;
|
||||
download_progress(std::string api_path_, std::string dest_path_,
|
||||
std::string_view function_name_, double progress_)
|
||||
: api_path(std::move(api_path_)),
|
||||
dest_path(std::move(dest_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
progress(progress_) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"download_progress"};
|
||||
|
||||
std::string api_path;
|
||||
std::string dest_path;
|
||||
std::string function_name;
|
||||
double progress{};
|
||||
|
||||
[[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|{}|prog|{}", name, function_name,
|
||||
api_path, dest_path, progress);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::download_progress> {
|
||||
static void to_json(json &data, const repertory::download_progress &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["dest_path"] = value.dest_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["progress"] = value.progress;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::download_progress &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);
|
||||
data.at("progress").get_to<double>(value.progress);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_PROGRESS_HPP_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_DRIVE_MOUNT_FAILED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNT_FAILED_HPP_
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct drive_mount_failed final : public i_event {
|
||||
drive_mount_failed() = default;
|
||||
drive_mount_failed(NTSTATUS error_, std::string_view function_name_,
|
||||
std::string mount_location_)
|
||||
: error(error_),
|
||||
function_name(std::string(function_name_)),
|
||||
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"};
|
||||
|
||||
NTSTATUS error{};
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
|
||||
[[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|{}|location|{}|status|{}", name, function_name,
|
||||
mount_location, error);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::drive_mount_failed> {
|
||||
static void to_json(json &data, const repertory::drive_mount_failed &value) {
|
||||
data["error"] = value.error;
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
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("mount_location").get_to<std::string>(value.mount_location);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNT_FAILED_HPP_
|
@ -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_DRIVE_MOUNT_RESULT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNT_RESULT_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct drive_mount_result final : public i_event {
|
||||
drive_mount_result() = default;
|
||||
drive_mount_result(std::string_view function_name_,
|
||||
std::string mount_location_, std::string result_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)),
|
||||
result(std::move(result_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"drive_mount_result"};
|
||||
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
std::string result;
|
||||
|
||||
[[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|{}|location|{}|result|{}", name, function_name,
|
||||
mount_location, result);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::drive_mount_result> {
|
||||
static void to_json(json &data, const repertory::drive_mount_result &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
data["result"] = value.result;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::drive_mount_result &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("mount_location").get_to<std::string>(value.mount_location);
|
||||
data.at("result").get_to<std::string>(value.result);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNT_RESULT_HPP_
|
@ -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_DRIVE_MOUNTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct drive_mounted final : public i_event {
|
||||
drive_mounted() = default;
|
||||
drive_mounted(std::string_view function_name_, std::string mount_location_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"drive_mounted"};
|
||||
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
|
||||
[[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|{}|location|{}", name, function_name,
|
||||
mount_location);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::drive_mounted> {
|
||||
static void to_json(json &data, const repertory::drive_mounted &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::drive_mounted &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("mount_location").get_to<std::string>(value.mount_location);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_MOUNTED_HPP_
|
@ -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_
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
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_UNMOUNT_PENDING_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_UNMOUNT_PENDING_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct drive_unmount_pending final : public i_event {
|
||||
drive_unmount_pending() = default;
|
||||
drive_unmount_pending(std::string_view function_name_,
|
||||
std::string mount_location_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"drive_unmount_pending"};
|
||||
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
|
||||
[[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|{}|location|{}", name, function_name,
|
||||
mount_location);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::drive_unmount_pending> {
|
||||
static void to_json(json &data,
|
||||
const repertory::drive_unmount_pending &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::drive_unmount_pending &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("mount_location").get_to<std::string>(value.mount_location);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_UNMOUNT_PENDING_HPP_
|
@ -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_DRIVE_UNMOUNTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_UNMOUNTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct drive_unmounted final : public i_event {
|
||||
drive_unmounted() = default;
|
||||
drive_unmounted(std::string_view function_name_, std::string mount_location_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"drive_unmounted"};
|
||||
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
|
||||
[[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|{}|location|{}", name, function_name,
|
||||
mount_location);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::drive_unmounted> {
|
||||
static void to_json(json &data, const repertory::drive_unmounted &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::drive_unmounted &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("mount_location").get_to<std::string>(value.mount_location);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_UNMOUNTED_HPP_
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
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_EVENT_LEVEL_CHANGED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_EVENT_LEVEL_CHANGED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct event_level_changed final : public i_event {
|
||||
event_level_changed() = default;
|
||||
event_level_changed(std::string_view function_name_, event_level new_level_)
|
||||
: function_name(std::string(function_name_)), new_level(new_level_) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"event_level_changed"};
|
||||
|
||||
std::string function_name;
|
||||
event_level new_level{};
|
||||
|
||||
[[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|{}|level|{}", name, function_name,
|
||||
event_level_to_string(new_level));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::event_level_changed> {
|
||||
static void to_json(json &data, const repertory::event_level_changed &value) {
|
||||
data["new_level"] = repertory::event_level_to_string(value.new_level);
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::event_level_changed &value) {
|
||||
value.new_level = repertory::event_level_from_string(
|
||||
data.at("new_level").get<std::string>());
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_EVENT_LEVEL_CHANGED_HPP_
|
69
repertory/librepertory/include/events/types/file_pinned.hpp
Normal file
69
repertory/librepertory/include/events/types/file_pinned.hpp
Normal 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_FILE_PINNED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_PINNED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_pinned final : public i_event {
|
||||
file_pinned() = default;
|
||||
file_pinned(std::string api_path_, std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"file_pinned"};
|
||||
|
||||
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::file_pinned> {
|
||||
static void to_json(json &data, const repertory::file_pinned &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::file_pinned &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_FILE_PINNED_HPP_
|
@ -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_FILE_REMOVE_FAILED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_REMOVE_FAILED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_remove_failed final : public i_event {
|
||||
file_remove_failed() = default;
|
||||
file_remove_failed(std::string api_path_, api_error 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::error};
|
||||
static constexpr const std::string_view name{"file_remove_failed"};
|
||||
|
||||
std::string api_path;
|
||||
api_error 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, api_error_to_string(error));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_remove_failed> {
|
||||
static void to_json(json &data, const repertory::file_remove_failed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_remove_failed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
value.error =
|
||||
repertory::api_error_from_string(data.at("error").get<std::string>());
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_REMOVE_FAILED_HPP_
|
69
repertory/librepertory/include/events/types/file_removed.hpp
Normal file
69
repertory/librepertory/include/events/types/file_removed.hpp
Normal 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_FILE_REMOVED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_REMOVED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_removed final : public i_event {
|
||||
file_removed() = default;
|
||||
file_removed(std::string api_path_, std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"file_removed"};
|
||||
|
||||
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::file_removed> {
|
||||
static void to_json(json &data, const repertory::file_removed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::file_removed &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_FILE_REMOVED_HPP_
|
@ -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_FILE_REMOVED_EXTERNALLY_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_REMOVED_EXTERNALLY_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_removed_externally final : public i_event {
|
||||
file_removed_externally() = default;
|
||||
file_removed_externally(std::string api_path_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"file_removed_externally"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|src|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_removed_externally> {
|
||||
static void to_json(json &data,
|
||||
const repertory::file_removed_externally &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_removed_externally &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_REMOVED_EXTERNALLY_HPP_
|
@ -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_FILE_UNPINNED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UNPINNED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_unpinned final : public i_event {
|
||||
file_unpinned() = default;
|
||||
file_unpinned(std::string api_path_, std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"file_unpinned"};
|
||||
|
||||
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::file_unpinned> {
|
||||
static void to_json(json &data, const repertory::file_unpinned &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::file_unpinned &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_FILE_UNPINNED_HPP_
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
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_FILE_UPLOAD_COMPLETED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_COMPLETED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_completed final : public i_event {
|
||||
file_upload_completed() = default;
|
||||
file_upload_completed(std::string api_path_, bool cancelled_,
|
||||
api_error error_, std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
cancelled(cancelled_),
|
||||
error(error_),
|
||||
function_name(std::string(function_name_)),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
bool cancelled{};
|
||||
api_error error{};
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|cancelled|{}|error|{}|sp|{}", name,
|
||||
function_name, api_path, cancelled,
|
||||
api_error_to_string(error), source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_upload_completed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::file_upload_completed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["cancelled"] = value.cancelled;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_upload_completed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("cancelled").get_to<bool>(value.cancelled);
|
||||
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("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_COMPLETED_HPP_
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
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_FILE_UPLOAD_FAILED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_FAILED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_failed final : public i_event {
|
||||
file_upload_failed() = default;
|
||||
file_upload_failed(std::string api_path_, std::string error_,
|
||||
std::string_view function_name_, std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
error(std::move(error_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"file_upload_failed"};
|
||||
|
||||
std::string api_path;
|
||||
std::string error;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name,
|
||||
api_path, error, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_upload_failed> {
|
||||
static void to_json(json &data, const repertory::file_upload_failed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["error"] = value.error;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_upload_failed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("error").get_to<std::string>(value.error);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_FAILED_HPP_
|
@ -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_FILE_UPLOAD_NOT_FOUND_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_NOT_FOUND_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_not_found final : public i_event {
|
||||
file_upload_not_found() = default;
|
||||
file_upload_not_found(std::string api_path_, std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"file_upload_not_found"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_upload_not_found> {
|
||||
static void to_json(json &data,
|
||||
const repertory::file_upload_not_found &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_upload_not_found &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_NOT_FOUND_HPP_
|
@ -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_FILE_UPLOAD_QUEUED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_QUEUED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_queued final : public i_event {
|
||||
file_upload_queued() = default;
|
||||
file_upload_queued(std::string api_path_, std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"file_upload_queued"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_upload_queued> {
|
||||
static void to_json(json &data, const repertory::file_upload_queued &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_upload_queued &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_QUEUED_HPP_
|
@ -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_FILE_UPLOAD_REMOVED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_REMOVED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_removed final : public i_event {
|
||||
file_upload_removed() = default;
|
||||
file_upload_removed(std::string api_path_, std::string_view function_name_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"file_upload_removed"};
|
||||
|
||||
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::file_upload_removed> {
|
||||
static void to_json(json &data, const repertory::file_upload_removed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::file_upload_removed &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_FILE_UPLOAD_REMOVED_HPP_
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
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_FILE_UPLOAD_RETRY_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_RETRY_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct file_upload_retry final : public i_event {
|
||||
file_upload_retry() = default;
|
||||
file_upload_retry(std::string api_path_, api_error error_,
|
||||
std::string_view function_name_, std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
error(std::move(error_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"file_upload_retry"};
|
||||
|
||||
std::string api_path;
|
||||
api_error error{};
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}|error|{}", name, function_name,
|
||||
api_path, source_path, api_error_to_string(error));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::file_upload_retry> {
|
||||
static void to_json(json &data, const repertory::file_upload_retry &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::file_upload_retry &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
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("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILE_UPLOAD_RETRY_HPP_
|
@ -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_FILESYSTEM_ITEM_ADDED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_ADDED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_added final : public i_event {
|
||||
filesystem_item_added() = default;
|
||||
filesystem_item_added(std::string api_parent_, std::string api_path_,
|
||||
bool directory_, std::string_view function_name_)
|
||||
: api_parent(std::move(api_parent_)),
|
||||
api_path(std::move(api_path_)),
|
||||
directory(directory_),
|
||||
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"};
|
||||
|
||||
std::string api_parent;
|
||||
std::string api_path;
|
||||
bool directory{};
|
||||
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|{}|parent|{}|dir|{}", name, function_name,
|
||||
api_path, api_parent, directory);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_added> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_added &value) {
|
||||
data["api_parent"] = value.api_parent;
|
||||
data["api_path"] = value.api_path;
|
||||
data["directory"] = value.directory;
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_added &value) {
|
||||
data.at("api_parent").get_to<std::string>(value.api_parent);
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("directory").get_to<bool>(value.directory);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_ADDED_HPP_
|
@ -0,0 +1,87 @@
|
||||
/*
|
||||
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_FILESYSTEM_ITEM_CLOSED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_CLOSED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_closed final : public i_event {
|
||||
filesystem_item_closed() = default;
|
||||
filesystem_item_closed(std::string api_path_, bool changed_, bool directory_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
changed(changed_),
|
||||
directory(directory_),
|
||||
function_name(std::string(function_name_)),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
bool changed{};
|
||||
bool directory{};
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|changed|{}|dir|{}|sp|{}", name,
|
||||
function_name, api_path, changed, directory,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_closed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_closed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["changed"] = value.changed;
|
||||
data["directory"] = value.directory;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_closed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("changed").get_to<bool>(value.changed);
|
||||
data.at("directory").get_to<bool>(value.directory);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_CLOSED_HPP_
|
@ -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_FILESYSTEM_ITEM_EVICTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_EVICTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_evicted final : public i_event {
|
||||
filesystem_item_evicted() = default;
|
||||
filesystem_item_evicted(std::string api_path_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"filesystem_item_evicted"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_evicted> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_evicted &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_evicted &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_EVICTED_HPP_
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
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_FILESYSTEM_ITEM_HANDLE_CLOSED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_HANDLE_CLOSED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_handle_closed final : public i_event {
|
||||
filesystem_item_handle_closed() = default;
|
||||
filesystem_item_handle_closed(std::string api_path_, bool changed_,
|
||||
bool directory_,
|
||||
std::string_view function_name_,
|
||||
std::uint64_t handle_, std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
changed(changed_),
|
||||
directory(directory_),
|
||||
function_name(std::string(function_name_)),
|
||||
handle(handle_),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
bool changed{};
|
||||
bool directory{};
|
||||
std::string function_name;
|
||||
std::uint64_t handle{};
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|changed|{}|dir|{}|handle|{}|sp|{}",
|
||||
name, function_name, api_path, changed, directory,
|
||||
handle, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_handle_closed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_handle_closed &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["changed"] = value.changed;
|
||||
data["directory"] = value.directory;
|
||||
data["function_name"] = value.function_name;
|
||||
data["handle"] = value.handle;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_handle_closed &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("changed").get_to<bool>(value.changed);
|
||||
data.at("directory").get_to<bool>(value.directory);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("handle").get_to<std::uint64_t>(value.handle);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_HANDLE_CLOSED_HPP_
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
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_FILESYSTEM_ITEM_HANDLE_OPENED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_HANDLE_OPENED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_handle_opened final : public i_event {
|
||||
filesystem_item_handle_opened() = default;
|
||||
filesystem_item_handle_opened(std::string api_path_, bool directory_,
|
||||
std::string_view function_name_,
|
||||
std::uint64_t handle_, std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
directory(directory_),
|
||||
function_name(std::string(function_name_)),
|
||||
handle(handle_),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
bool directory{};
|
||||
std::string function_name;
|
||||
std::uint64_t handle{};
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|dir|{}|handle|{}|sp|{}", name,
|
||||
function_name, api_path, directory, handle, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_handle_opened> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_handle_opened &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["directory"] = value.directory;
|
||||
data["function_name"] = value.function_name;
|
||||
data["handle"] = value.handle;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_handle_opened &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("directory").get_to<bool>(value.directory);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("handle").get_to<std::uint64_t>(value.handle);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_HANDLE_OPENED_HPP_
|
@ -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_FILESYSTEM_ITEM_OPENED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_OPENED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct filesystem_item_opened final : public i_event {
|
||||
filesystem_item_opened() = default;
|
||||
filesystem_item_opened(std::string api_path_, bool directory_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
directory(directory_),
|
||||
function_name(std::string(function_name_)),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
bool directory{};
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|dir|{}|sp|{}", name, function_name,
|
||||
api_path, directory, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::filesystem_item_opened> {
|
||||
static void to_json(json &data,
|
||||
const repertory::filesystem_item_opened &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["directory"] = value.directory;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::filesystem_item_opened &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("directory").get_to<bool>(value.directory);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FILESYSTEM_ITEM_OPENED_HPP_
|
@ -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_
|
77
repertory/librepertory/include/events/types/fuse_event.hpp
Normal file
77
repertory/librepertory/include/events/types/fuse_event.hpp
Normal 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_
|
@ -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_
|
69
repertory/librepertory/include/events/types/item_timeout.hpp
Normal file
69
repertory/librepertory/include/events/types/item_timeout.hpp
Normal 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_
|
@ -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_
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
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_ORPHANED_FILE_DETECTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_FILE_DETECTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct orphaned_file_detected final : public i_event {
|
||||
orphaned_file_detected() = default;
|
||||
orphaned_file_detected(std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"orphaned_file_detected"};
|
||||
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::orphaned_file_detected> {
|
||||
static void to_json(json &data,
|
||||
const repertory::orphaned_file_detected &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::orphaned_file_detected &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_FILE_DETECTED_HPP_
|
@ -0,0 +1,84 @@
|
||||
/*
|
||||
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_ORPHANED_FILE_PROCESSING_FAILED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_FILE_PROCESSING_FAILED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct orphaned_file_processing_failed final : public i_event {
|
||||
orphaned_file_processing_failed() = default;
|
||||
orphaned_file_processing_failed(std::string dest_path_, std::string error_,
|
||||
std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: dest_path(std::move(dest_path_)),
|
||||
error(std::move(error_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::error};
|
||||
static constexpr const std::string_view name{
|
||||
"orphaned_file_processing_failed",
|
||||
};
|
||||
|
||||
std::string dest_path;
|
||||
std::string error;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}|dp|{}|error|{}", name, function_name,
|
||||
source_path, dest_path, error);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::orphaned_file_processing_failed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::orphaned_file_processing_failed &value) {
|
||||
data["dest_path"] = value.dest_path;
|
||||
data["error"] = value.error;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::orphaned_file_processing_failed &value) {
|
||||
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);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_FILE_PROCESSING_FAILED_HPP_
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
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_ORPHANED_SOURCE_FILE_DETECTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_SOURCE_FILE_DETECTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct orphaned_source_file_detected final : public i_event {
|
||||
orphaned_source_file_detected() = default;
|
||||
orphaned_source_file_detected(std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"orphaned_source_file_detected"};
|
||||
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::orphaned_source_file_detected> {
|
||||
static void to_json(json &data,
|
||||
const repertory::orphaned_source_file_detected &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::orphaned_source_file_detected &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_SOURCE_FILE_DETECTED_HPP_
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
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_ORPHANED_SOURCE_FILE_REMOVED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_SOURCE_FILE_REMOVED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct orphaned_source_file_removed final : public i_event {
|
||||
orphaned_source_file_removed() = default;
|
||||
orphaned_source_file_removed(std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"orphaned_source_file_removed"};
|
||||
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::orphaned_source_file_removed> {
|
||||
static void to_json(json &data,
|
||||
const repertory::orphaned_source_file_removed &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::orphaned_source_file_removed &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ORPHANED_SOURCE_FILE_REMOVED_HPP_
|
@ -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_
|
@ -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_POLLING_ITEM_BEGIN_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_POLLING_ITEM_BEGIN_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct polling_item_begin final : public i_event {
|
||||
polling_item_begin() = default;
|
||||
polling_item_begin(std::string_view function_name_, std::string item_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
item_name(std::move(item_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"polling_item_begin"};
|
||||
|
||||
std::string function_name;
|
||||
std::string item_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|{}", name, function_name, item_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::polling_item_begin> {
|
||||
static void to_json(json &data, const repertory::polling_item_begin &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["item_name"] = value.item_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::polling_item_begin &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("item_name").get_to<std::string>(value.item_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_POLLING_ITEM_BEGIN_HPP_
|
@ -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_POLLING_ITEM_END_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_POLLING_ITEM_END_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct polling_item_end final : public i_event {
|
||||
polling_item_end() = default;
|
||||
polling_item_end(std::string_view function_name_, std::string item_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
item_name(std::move(item_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"polling_item_end"};
|
||||
|
||||
std::string function_name;
|
||||
std::string item_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|{}", name, function_name, item_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::polling_item_end> {
|
||||
static void to_json(json &data, const repertory::polling_item_end &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["item_name"] = value.item_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::polling_item_end &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("item_name").get_to<std::string>(value.item_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_POLLING_ITEM_END_HPP_
|
@ -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_PROVIDER_OFFLINE_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_OFFLINE_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct provider_offline final : public i_event {
|
||||
provider_offline() = default;
|
||||
provider_offline(std::string_view function_name_,
|
||||
std::string host_name_or_ip_, std::uint16_t port_)
|
||||
: function_name(std::string(function_name_)),
|
||||
host_name_or_ip(std::move(host_name_or_ip_)),
|
||||
port(port_) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"provider_offline"};
|
||||
|
||||
std::string function_name;
|
||||
std::string host_name_or_ip;
|
||||
std::uint16_t port{};
|
||||
|
||||
[[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|{}|host|{}|port|{}", name, function_name,
|
||||
host_name_or_ip, port);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::provider_offline> {
|
||||
static void to_json(json &data, const repertory::provider_offline &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["host_name_or_ip"] = value.host_name_or_ip;
|
||||
data["port"] = value.port;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::provider_offline &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("host_name_or_ip").get_to<std::string>(value.host_name_or_ip);
|
||||
data.at("port").get_to<std::uint16_t>(value.port);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_OFFLINE_HPP_
|
@ -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_PROVIDER_UPLOAD_BEGIN_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_UPLOAD_BEGIN_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct provider_upload_begin final : public i_event {
|
||||
provider_upload_begin() = default;
|
||||
provider_upload_begin(std::string api_path_, std::string_view function_name_,
|
||||
std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
function_name(std::string(function_name_)),
|
||||
source_path(std::move(source_path_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"provider_upload_begin"};
|
||||
|
||||
std::string api_path;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name, api_path,
|
||||
source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::provider_upload_begin> {
|
||||
static void to_json(json &data,
|
||||
const repertory::provider_upload_begin &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::provider_upload_begin &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_UPLOAD_BEGIN_HPP_
|
@ -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_PROVIDER_UPLOAD_END_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_UPLOAD_END_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct provider_upload_end final : public i_event {
|
||||
provider_upload_end() = default;
|
||||
provider_upload_end(std::string api_path_, api_error error_,
|
||||
std::string_view function_name_, std::string source_path_)
|
||||
: api_path(std::move(api_path_)),
|
||||
error(error_),
|
||||
function_name(std::string(function_name_)),
|
||||
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"};
|
||||
|
||||
std::string api_path;
|
||||
api_error error{};
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[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|{}|sp|{}", name, function_name,
|
||||
api_path, api_error_to_string(error), source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::provider_upload_end> {
|
||||
static void to_json(json &data, const repertory::provider_upload_end &value) {
|
||||
data["api_path"] = value.api_path;
|
||||
data["error"] = repertory::api_error_to_string(value.error);
|
||||
data["function_name"] = value.function_name;
|
||||
data["source_path"] = value.source_path;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::provider_upload_end &value) {
|
||||
data.at("api_path").get_to<std::string>(value.api_path);
|
||||
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("source_path").get_to<std::string>(value.source_path);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PROVIDER_UPLOAD_END_HPP_
|
@ -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_
|
@ -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_REPERTORY_EXCEPTION_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_REPERTORY_EXCEPTION_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct repertory_exception final : public i_event {
|
||||
repertory_exception() = default;
|
||||
repertory_exception(std::string_view function_name_, std::string msg_)
|
||||
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::error};
|
||||
static constexpr const std::string_view name{"repertory_exception"};
|
||||
|
||||
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|{}|msg|{}", name, function_name, msg);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::repertory_exception> {
|
||||
static void to_json(json &data, const repertory::repertory_exception &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["msg"] = value.msg;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::repertory_exception &value) {
|
||||
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_REPERTORY_EXCEPTION_HPP_
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
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_SERVICE_START_BEGIN_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_START_BEGIN_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct service_start_begin final : public i_event {
|
||||
service_start_begin() = default;
|
||||
service_start_begin(std::string_view function_name_,
|
||||
std::string service_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
service_name(std::move(service_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"service_start_begin"};
|
||||
|
||||
std::string function_name;
|
||||
std::string service_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|{}|svc|{}", name, function_name, service_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::service_start_begin> {
|
||||
static void to_json(json &data, const repertory::service_start_begin &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["service_name"] = value.service_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::service_start_begin &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("service_name").get_to<std::string>(value.service_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_START_BEGIN_HPP_
|
@ -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_SERVICE_START_END_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_START_END_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct service_start_end final : public i_event {
|
||||
service_start_end() = default;
|
||||
service_start_end(std::string_view function_name_, std::string service_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
service_name(std::move(service_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"service_start_end"};
|
||||
|
||||
std::string function_name;
|
||||
std::string service_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|{}|svc|{}", name, function_name, service_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::service_start_end> {
|
||||
static void to_json(json &data, const repertory::service_start_end &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["service_name"] = value.service_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::service_start_end &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("service_name").get_to<std::string>(value.service_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_START_END_HPP_
|
@ -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_SERVICE_STOP_BEGIN_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_STOP_BEGIN_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct service_stop_begin final : public i_event {
|
||||
service_stop_begin() = default;
|
||||
service_stop_begin(std::string_view function_name_, std::string service_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
service_name(std::move(service_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"service_stop_begin"};
|
||||
|
||||
std::string function_name;
|
||||
std::string service_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|{}|svc|{}", name, function_name, service_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::service_stop_begin> {
|
||||
static void to_json(json &data, const repertory::service_stop_begin &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["service_name"] = value.service_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::service_stop_begin &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("service_name").get_to<std::string>(value.service_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_STOP_BEGIN_HPP_
|
@ -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_SERVICE_STOP_END_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_STOP_END_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct service_stop_end final : public i_event {
|
||||
service_stop_end() = default;
|
||||
service_stop_end(std::string_view function_name_, std::string service_name_)
|
||||
: function_name(std::string(function_name_)),
|
||||
service_name(std::move(service_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::debug};
|
||||
static constexpr const std::string_view name{"service_stop_end"};
|
||||
|
||||
std::string function_name;
|
||||
std::string service_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|{}|svc|{}", name, function_name, service_name);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::service_stop_end> {
|
||||
static void to_json(json &data, const repertory::service_stop_end &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["service_name"] = value.service_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::service_stop_end &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("service_name").get_to<std::string>(value.service_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_SERVICE_STOP_END_HPP_
|
@ -0,0 +1,65 @@
|
||||
/*
|
||||
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_UNMOUNT_REQUESTED_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_UNMOUNT_REQUESTED_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct unmount_requested final : public i_event {
|
||||
unmount_requested() = default;
|
||||
unmount_requested(std::string_view function_name_)
|
||||
: function_name(std::string(function_name_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"unmount_requested"};
|
||||
|
||||
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::unmount_requested> {
|
||||
static void to_json(json &data, const repertory::unmount_requested &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::unmount_requested &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_UNMOUNT_REQUESTED_HPP_
|
@ -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_UNMOUNT_RESULT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_UNMOUNT_RESULT_HPP_
|
||||
#if !defined(_WIN32)
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct unmount_result final : public i_event {
|
||||
unmount_result() = default;
|
||||
unmount_result(std::string_view function_name_, std::string mount_location_,
|
||||
std::int32_t result_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)),
|
||||
result(result_) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"unmount_result"};
|
||||
|
||||
std::string function_name;
|
||||
std::string mount_location;
|
||||
std::int32_t result{};
|
||||
|
||||
[[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|{}|location|{}|result|{}", name, function_name,
|
||||
mount_location, result);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::unmount_result> {
|
||||
static void to_json(json &data, const repertory::unmount_result &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["mount_location"] = value.mount_location;
|
||||
data["result"] = value.result;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::unmount_result &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("mount_location").get_to<std::string>(value.mount_location);
|
||||
data.at("result").get_to<std::int32_t>(value.result);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // defined(_WIN32)
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_UNMOUNT_RESULT_HPP_
|
77
repertory/librepertory/include/events/types/winfsp_event.hpp
Normal file
77
repertory/librepertory/include/events/types/winfsp_event.hpp
Normal 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_
|
@ -28,6 +28,11 @@ namespace repertory {
|
||||
class app_config;
|
||||
|
||||
class cache_size_mgr final {
|
||||
private:
|
||||
static constexpr const std::chrono::seconds cache_wait_secs{
|
||||
5s,
|
||||
};
|
||||
|
||||
public:
|
||||
cache_size_mgr(const cache_size_mgr &) = delete;
|
||||
cache_size_mgr(cache_size_mgr &&) = delete;
|
||||
@ -49,6 +54,9 @@ private:
|
||||
std::condition_variable notify_;
|
||||
stop_type stop_requested_{false};
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto expand(std::uint64_t size) -> api_error;
|
||||
|
||||
|
@ -1,86 +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_FILE_MANAGER_EVENTS_HPP_
|
||||
#define REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
||||
|
||||
#include "events/events.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
// clang-format off
|
||||
E_SIMPLE2(download_begin, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_end, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING,
|
||||
api_error, result, result, E_FROM_API_FILE_ERROR
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_progress, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING,
|
||||
double, progress, prog, E_FROM_DOUBLE_PRECISE
|
||||
);
|
||||
|
||||
E_SIMPLE2(download_restored, info, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_restore_failed, error, true,
|
||||
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, true,
|
||||
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, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(download_resume_removed, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE1(item_timeout, trace, true,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_type_selected, debug, true,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
download_type, download_type, type, E_FROM_DOWNLOAD_TYPE
|
||||
);
|
||||
// clang-format on
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "db/i_file_mgr_db.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/events.hpp"
|
||||
#include "events/types/file_upload_completed.hpp"
|
||||
#include "file_manager/i_file_manager.hpp"
|
||||
#include "file_manager/i_open_file.hpp"
|
||||
#include "file_manager/i_upload_manager.hpp"
|
||||
@ -39,6 +39,11 @@ class i_provider;
|
||||
class file_manager final : public i_file_manager, public i_upload_manager {
|
||||
E_CONSUMER();
|
||||
|
||||
private:
|
||||
static constexpr const std::chrono::seconds queue_wait_secs{
|
||||
5s,
|
||||
};
|
||||
|
||||
public:
|
||||
file_manager(app_config &config, i_provider &provider);
|
||||
|
||||
@ -72,15 +77,19 @@ private:
|
||||
|
||||
void close_timed_out_files();
|
||||
|
||||
auto get_open_file_by_handle(std::uint64_t handle) const
|
||||
[[nodiscard]] auto get_open_file_by_handle(std::uint64_t handle) const
|
||||
-> std::shared_ptr<i_closeable_open_file>;
|
||||
|
||||
auto get_open_file_count(const std::string &api_path) const -> std::size_t;
|
||||
[[nodiscard]] auto get_open_file_count(const std::string &api_path) const
|
||||
-> std::size_t;
|
||||
|
||||
auto open(const std::string &api_path, bool directory,
|
||||
const open_file_data &ofd, std::uint64_t &handle,
|
||||
std::shared_ptr<i_open_file> &file,
|
||||
std::shared_ptr<i_closeable_open_file> closeable_file) -> api_error;
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
[[nodiscard]] auto open(const std::string &api_path, bool directory,
|
||||
const open_file_data &ofd, std::uint64_t &handle,
|
||||
std::shared_ptr<i_open_file> &file,
|
||||
std::shared_ptr<i_closeable_open_file> closeable_file)
|
||||
-> api_error;
|
||||
|
||||
void queue_upload(const std::string &api_path, const std::string &source_path,
|
||||
bool no_lock);
|
||||
|
@ -78,8 +78,8 @@ private:
|
||||
stop_type stop_requested_{false};
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto adjust_cache_size(std::uint64_t file_size,
|
||||
bool shrink) -> api_error;
|
||||
[[nodiscard]] auto adjust_cache_size(std::uint64_t file_size, bool shrink)
|
||||
-> api_error;
|
||||
|
||||
[[nodiscard]] auto check_start() -> api_error;
|
||||
|
||||
@ -88,6 +88,8 @@ private:
|
||||
void download_range(std::size_t begin_chunk, std::size_t end_chunk,
|
||||
bool should_reset);
|
||||
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
void set_modified();
|
||||
|
||||
void set_read_state(std::size_t chunk);
|
||||
@ -111,12 +113,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto
|
||||
native_operation(native_operation_callback callback) -> api_error override;
|
||||
[[nodiscard]] auto native_operation(native_operation_callback callback)
|
||||
-> api_error override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
native_operation(std::uint64_t new_file_size,
|
||||
native_operation_callback callback) -> api_error override;
|
||||
[[nodiscard]] auto native_operation(std::uint64_t new_file_size,
|
||||
native_operation_callback callback)
|
||||
-> api_error override;
|
||||
|
||||
void remove(std::uint64_t handle) override;
|
||||
|
||||
|
@ -161,7 +161,7 @@ protected:
|
||||
|
||||
void set_source_path(std::string source_path);
|
||||
|
||||
void wait_for_io(stop_type &stop_requested);
|
||||
void wait_for_io(stop_type_callback stop_requested_cb);
|
||||
|
||||
public:
|
||||
void add(std::uint64_t handle, open_file_data ofd) override;
|
||||
@ -186,17 +186,17 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_handles() const -> std::vector<std::uint64_t> override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_open_data() -> std::map<std::uint64_t, open_file_data> & override;
|
||||
[[nodiscard]] auto get_open_data()
|
||||
-> std::map<std::uint64_t, open_file_data> & override;
|
||||
|
||||
[[nodiscard]] auto get_open_data() const
|
||||
-> const std::map<std::uint64_t, open_file_data> & override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_open_data(std::uint64_t handle) -> open_file_data & override;
|
||||
[[nodiscard]] auto get_open_data(std::uint64_t handle)
|
||||
-> open_file_data & override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_open_data(std::uint64_t handle) const -> const open_file_data & override;
|
||||
[[nodiscard]] auto get_open_data(std::uint64_t handle) const
|
||||
-> const open_file_data & override;
|
||||
|
||||
[[nodiscard]] auto get_open_file_count() const -> std::size_t override;
|
||||
|
||||
|
@ -44,8 +44,8 @@ public:
|
||||
ring_buffer_base(const ring_buffer_base &) noexcept = delete;
|
||||
ring_buffer_base(ring_buffer_base &&) noexcept = delete;
|
||||
auto operator=(ring_buffer_base &&) noexcept -> ring_buffer_base & = delete;
|
||||
auto
|
||||
operator=(const ring_buffer_base &) noexcept -> ring_buffer_base & = delete;
|
||||
auto operator=(const ring_buffer_base &) noexcept
|
||||
-> ring_buffer_base & = delete;
|
||||
|
||||
public:
|
||||
static constexpr const auto min_ring_size{5U};
|
||||
@ -73,6 +73,8 @@ private:
|
||||
|
||||
void update_position(std::size_t count, bool is_forward);
|
||||
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
protected:
|
||||
[[nodiscard]] auto has_reader_thread() const -> bool {
|
||||
return reader_thread_ != nullptr;
|
||||
@ -84,9 +86,9 @@ protected:
|
||||
|
||||
[[nodiscard]] virtual auto on_check_start() -> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
on_chunk_downloaded(std::size_t chunk,
|
||||
const data_buffer &buffer) -> api_error = 0;
|
||||
[[nodiscard]] virtual auto on_chunk_downloaded(std::size_t chunk,
|
||||
const data_buffer &buffer)
|
||||
-> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
on_read_chunk(std::size_t chunk, std::size_t read_size,
|
||||
@ -94,8 +96,8 @@ protected:
|
||||
std::size_t &bytes_read) -> api_error = 0;
|
||||
|
||||
[[nodiscard]] virtual auto
|
||||
use_buffer(std::size_t chunk,
|
||||
std::function<api_error(data_buffer &)> func) -> api_error = 0;
|
||||
use_buffer(std::size_t chunk, std::function<api_error(data_buffer &)> func)
|
||||
-> api_error = 0;
|
||||
|
||||
public:
|
||||
auto close() -> bool override;
|
||||
@ -139,9 +141,10 @@ public:
|
||||
|
||||
void set_api_path(const std::string &api_path) override;
|
||||
|
||||
[[nodiscard]] auto
|
||||
write(std::uint64_t /* write_offset */, const data_buffer & /* data */,
|
||||
std::size_t & /* bytes_written */) -> api_error override {
|
||||
[[nodiscard]] auto write(std::uint64_t /* write_offset */,
|
||||
const data_buffer & /* data */,
|
||||
std::size_t & /* bytes_written */)
|
||||
-> api_error override {
|
||||
return api_error::not_supported;
|
||||
}
|
||||
};
|
||||
|
@ -47,8 +47,8 @@ private:
|
||||
private:
|
||||
bool cancelled_{false};
|
||||
api_error error_{api_error::success};
|
||||
std::unique_ptr<std::thread> thread_;
|
||||
stop_type stop_requested_{false};
|
||||
std::unique_ptr<std::thread> thread_;
|
||||
|
||||
private:
|
||||
void upload_thread();
|
||||
|
@ -31,18 +31,18 @@ public:
|
||||
|
||||
private:
|
||||
const rpc_host_info host_info_;
|
||||
std::atomic<std::uint32_t> request_id_;
|
||||
std::atomic<std::uint32_t> request_id_{0U};
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_drive_information() -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto get_config() -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_config_value_by_name(const std::string &name) -> rpc_response;
|
||||
[[nodiscard]] auto get_config_value_by_name(const std::string &name)
|
||||
-> rpc_response;
|
||||
|
||||
[[nodiscard]] auto
|
||||
get_directory_items(const std::string &api_path) -> rpc_response;
|
||||
[[nodiscard]] auto get_directory_items(const std::string &api_path)
|
||||
-> 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
|
||||
set_config_value_by_name(const std::string &name,
|
||||
const std::string &value) -> rpc_response;
|
||||
[[nodiscard]] auto set_config_value_by_name(const std::string &name,
|
||||
const std::string &value)
|
||||
-> rpc_response;
|
||||
|
||||
[[nodiscard]] auto unmount() -> rpc_response;
|
||||
|
||||
|
@ -38,7 +38,6 @@ private:
|
||||
std::unique_ptr<httplib::Server> server_;
|
||||
std::unique_ptr<std::thread> server_thread_;
|
||||
std::mutex start_stop_mutex_;
|
||||
std::atomic<bool> started_ = false;
|
||||
|
||||
private:
|
||||
[[nodiscard]] auto check_authorization(const httplib::Request &req) -> bool;
|
||||
|
@ -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_s3_object_name_length{1024U};
|
||||
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_online_check_retry_secs{std::uint16_t(15U)};
|
||||
constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)};
|
||||
@ -246,6 +247,22 @@ download_type_from_string(std::string type,
|
||||
[[nodiscard]] auto download_type_to_string(const download_type &type)
|
||||
-> std::string;
|
||||
|
||||
enum class event_level {
|
||||
critical,
|
||||
error,
|
||||
warn,
|
||||
info,
|
||||
debug,
|
||||
trace,
|
||||
};
|
||||
|
||||
[[nodiscard]] auto
|
||||
event_level_from_string(std::string level,
|
||||
event_level default_level = event_level::info)
|
||||
-> event_level;
|
||||
|
||||
[[nodiscard]] auto event_level_to_string(event_level level) -> std::string;
|
||||
|
||||
enum class exit_code : std::int32_t {
|
||||
success = 0,
|
||||
communication_error = -1,
|
||||
@ -271,7 +288,9 @@ enum class exit_code : std::int32_t {
|
||||
enum http_error_codes : std::int32_t {
|
||||
ok = 200,
|
||||
multiple_choices = 300,
|
||||
unauthorized = 401,
|
||||
not_found = 404,
|
||||
internal_error = 500,
|
||||
};
|
||||
|
||||
enum class lock_result {
|
||||
@ -654,6 +673,18 @@ template <> struct adl_serializer<repertory::download_type> {
|
||||
value = repertory::download_type_from_string(data.get<std::string>());
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct adl_serializer<std::atomic<repertory::event_level>> {
|
||||
static void to_json(json &data,
|
||||
const std::atomic<repertory::event_level> &value) {
|
||||
data = repertory::event_level_to_string(value.load());
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
std::atomic<repertory::event_level> &value) {
|
||||
value.store(repertory::event_level_from_string(data.get<std::string>()));
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_TYPES_REPERTORY_HPP_
|
||||
|
@ -75,6 +75,8 @@ private:
|
||||
void frequency_thread(std::function<std::uint32_t()> get_frequency_seconds,
|
||||
frequency freq);
|
||||
|
||||
[[nodiscard]] auto get_stop_requested() const -> bool;
|
||||
|
||||
public:
|
||||
void remove_callback(const std::string &name);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user