145 Commits

Author SHA1 Message Date
6464c01d8b updated CHANGELOG.md
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2025-01-22 14:44:36 -06:00
58db36d628 updated CHANGELOG.md 2025-01-22 13:39:40 -06:00
f39c6550f2 refactor 2025-01-22 13:37:48 -06:00
400c97cebd refactor 2025-01-22 13:29:08 -06:00
a2ad258b7c refactor 2025-01-22 13:23:52 -06:00
c4b4fe83fb refactor 2025-01-22 13:21:44 -06:00
262fccf9a6 refactor 2025-01-22 13:21:31 -06:00
50898488f0 refactor 2025-01-22 13:13:36 -06:00
1acb3311b1 refactor 2025-01-22 13:12:18 -06:00
3fd3f85cc9 refactor 2025-01-22 13:07:10 -06:00
cbbd586347 refactor 2025-01-22 13:01:36 -06:00
57a591c51e refactor 2025-01-22 12:58:02 -06:00
29fb395758 revert change 2025-01-22 12:47:24 -06:00
b3f87e2828 refactor 2025-01-22 12:42:00 -06:00
7e06f810ea refactor 2025-01-22 12:41:28 -06:00
02e568b77a fix memory leak 2025-01-22 12:37:00 -06:00
8b2bafc9f3 refactor 2025-01-22 08:47:56 -06:00
97e5f17049 refactor 2025-01-22 08:06:54 -06:00
124dc62250 refactor 2025-01-22 08:05:35 -06:00
5da4d4e940 refactor 2025-01-22 08:01:35 -06:00
b507643d23 limit directory cache to directory operations 2025-01-22 07:39:41 -06:00
1e25fb57f1 refactor 2025-01-22 07:31:02 -06:00
4d8e59f97f refactor 2025-01-22 07:24:25 -06:00
881778e485 refactor events 2025-01-22 07:14:21 -06:00
3efb2b817f refactor 2025-01-21 15:24:39 -06:00
21d02534e5 refactor system stop 2025-01-21 15:19:33 -06:00
1b11e500f3 refactor winfsp system stop 2025-01-21 15:05:04 -06:00
f57bbdbb50 refactor 2025-01-21 14:59:11 -06:00
1c65f51ef4 refactor system stop 2025-01-21 14:57:13 -06:00
f44bb6bcfc force stop 2025-01-21 14:52:51 -06:00
57d9884510 refactor 2025-01-21 13:46:51 -06:00
5da036e979 refactor system stop 2025-01-21 13:29:56 -06:00
daa8b9df24 refactor system stop 2025-01-21 13:18:22 -06:00
fe2a1b96b2 rocksdb cache adjustments 2025-01-21 09:23:43 -06:00
be678e8f9c refactor 2025-01-21 08:01:15 -06:00
b5ae3e4ed1 updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-16 19:52:51 -06:00
89a2d5866a updated CHANGELOG.md
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-01-16 19:48:33 -06:00
5264d17ae8 remote fixes
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-16 19:45:41 -06:00
1718464c60 updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-05 20:12:02 -06:00
85756ddd8c updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2025-01-05 20:06:09 -06:00
e8240948b7 updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2025-01-05 20:01:45 -06:00
77088e6608 updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-05 14:55:44 -06:00
ddbebef850 updated build system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2025-01-04 15:22:49 -06:00
7cf636b8ed updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-02 20:30:25 -06:00
754dfc49db updated build system
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2025-01-02 20:28:51 -06:00
63b2d0e741 updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-02 20:19:27 -06:00
96ac72ae21 fix comment
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-02 17:39:48 -06:00
0bbf6b5942 refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-02 14:24:58 -06:00
74ef36956d re-enable cleanup 2025-01-02 14:22:40 -06:00
bbe065819c refactor 2025-01-02 14:22:17 -06:00
3493054f1a handle remove error 2025-01-02 14:20:20 -06:00
743281497c refactor 2025-01-02 14:14:21 -06:00
eaa6a6f92e refactor cleanup 2025-01-02 14:01:16 -06:00
a25dd8178e refactor cleanup 2025-01-02 13:43:22 -06:00
71463bfee4 refactor 2025-01-02 12:07:01 -06:00
270df62dbe refactor 2025-01-02 12:01:45 -06:00
5bd7ded7d9 refactor 2025-01-02 11:59:01 -06:00
b5048a422f refactor 2025-01-02 11:56:12 -06:00
c27528fe73 begin working on better handling of removed files 2025-01-02 10:27:52 -06:00
c3978562d5 cleanup 2025-01-02 08:59:19 -06:00
637892cff1 refactor 2025-01-02 08:58:02 -06:00
998a3d9d83 updated test 2025-01-02 08:50:44 -06:00
8ed8822625 refactor 2025-01-02 08:38:43 -06:00
196abaebcc refactor 2025-01-02 08:36:55 -06:00
653e8000ff refactor 2025-01-02 08:34:51 -06:00
ea362211aa fix 2025-01-02 08:32:42 -06:00
a4a9d069d3 fix 2025-01-02 08:27:45 -06:00
9cb7f9accf updated CHANGELOG.md 2025-01-02 08:19:42 -06:00
4e5454efb5 always use direct for read-only providers 2025-01-02 08:19:10 -06:00
a8c3f31298 refactor 2025-01-02 07:59:07 -06:00
f3093c27cd refactor 2025-01-02 07:57:07 -06:00
4526a9d860 refactor 2025-01-02 07:50:58 -06:00
a1ada5aa8c refactor 2025-01-02 07:48:56 -06:00
1ae8b8b793 refactor 2025-01-02 07:45:08 -06:00
f44cc99a82 refactor 2025-01-02 07:08:12 -06:00
75657bec58 fix
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-01 01:35:45 -06:00
4fef036f10 refactor
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2025-01-01 01:19:59 -06:00
ecb9783f4e refactor 2025-01-01 01:15:11 -06:00
bdf85908ca updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-31 17:30:20 -06:00
9cb3cdabb0 cleanup
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-31 14:49:26 -06:00
6cf082dfa7 refactor 2024-12-31 14:45:52 -06:00
1a140d4dfd refactor 2024-12-31 14:45:11 -06:00
1cc8571a04 refactor 2024-12-31 14:42:57 -06:00
cf8c631938 refactor 2024-12-31 14:42:24 -06:00
4cba2a16f9 updated CHANGELOG.md 2024-12-31 14:29:55 -06:00
7c5f074d5a [bug] Address slow directory responses in S3 mounts for deep nested directories #28 2024-12-31 14:22:55 -06:00
a251cf6abf exception handling 2024-12-31 13:42:50 -06:00
31f7a47889 exception handling 2024-12-31 13:41:38 -06:00
23de2af98d exception handling 2024-12-31 13:41:00 -06:00
2446f024ef exception handling 2024-12-31 13:39:29 -06:00
45ddd528b2 exception handling 2024-12-31 13:37:55 -06:00
36908f7da9 [bug] Sia provider error responses are not being logged #30 2024-12-31 13:34:08 -06:00
1a11d55782 updated CHANGELOG.md 2024-12-31 13:20:50 -06:00
e344eddbcb [bug] Sia provider error responses are not being logged #30 2024-12-31 13:19:42 -06:00
09da7a29a9 [bug] Sia provider error responses are not being logged #30 2024-12-31 13:13:17 -06:00
5b5ac0937c [bug] Sia provider error responses are not being logged #30 2024-12-31 13:12:49 -06:00
c69818fed6 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 12:56:13 -06:00
81712e7a99 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 12:55:52 -06:00
75d2d39e7c refactor 2024-12-31 12:53:08 -06:00
ccc4a30ad5 spelling 2024-12-31 11:35:27 -06:00
a9bb12015a fix missing request headers 2024-12-31 11:32:47 -06:00
474f90ee33 fix missing request headers 2024-12-31 11:31:03 -06:00
ae7d5fe284 fix missing request headers 2024-12-31 11:29:05 -06:00
bf700b9d59 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 11:05:20 -06:00
0d4b3f5e7e [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 10:55:33 -06:00
67076458f0 updated CHANGELOG.md 2024-12-31 10:28:57 -06:00
a8479eefd1 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 10:22:49 -06:00
e1eda99a72 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 10:15:21 -06:00
ed4a4f0742 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 10:14:13 -06:00
84e89d3b83 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 09:50:20 -06:00
5e3efde376 [bug] S3 provider should limit max key size to 1024 #31 2024-12-31 09:39:20 -06:00
f28e17f3e5 updated CHANGELOG.md 2024-12-31 08:53:55 -06:00
699ecafc22 updated CHANGELOG.md 2024-12-31 08:53:00 -06:00
247cc301ea [bug] S3 error responses are not being logged #29 2024-12-31 08:47:28 -06:00
bc43338127 [bug] S3 error responses are not being logged #29 2024-12-31 08:46:17 -06:00
4e86f2a7de refactor 2024-12-31 08:42:22 -06:00
b9fe2746e3 refactor 2024-12-31 08:31:36 -06:00
4fe9d09f0a updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-30 19:37:41 -06:00
777db300e1 fix
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-30 18:44:21 -06:00
62a303e856 [bug] Address slow directory responses in S3 mounts for deep nested directories #28
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
[bug] S3 error responses are not being logged #29
2024-12-30 12:09:52 -06:00
ae573af89d updated CHANGELOG.md
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-29 17:49:12 -06:00
0c41a3309e fix invalid error
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2024-12-29 17:43:09 -06:00
4cb3e22308 moved event to debug
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2024-12-29 14:44:19 -06:00
9d7d36922f updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-29 12:18:01 -06:00
3190c5f133 updated build system
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
2024-12-29 12:04:17 -06:00
5fadb796d1 fix CHANGELOG.md
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2024-12-29 09:57:29 -06:00
4a213e5ca5 updated CHANGELOG.md 2024-12-29 09:57:14 -06:00
9fea962563 updated CHANGELOG.md 2024-12-29 09:43:54 -06:00
ac6c333df3 updated CHANGELOG.md 2024-12-29 09:41:37 -06:00
4bbff47b6f updated build system 2024-12-29 09:21:56 -06:00
f01daa4296 [Unit Test] Complete FUSE unit tests #22
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-29 07:09:49 -06:00
96c2f8ee1e [Unit Test] Complete FUSE unit tests #22 2024-12-29 07:08:25 -06:00
9eb3e7a22d [Unit Test] Complete FUSE unit tests #22 2024-12-29 07:06:19 -06:00
3c2c783683 [Unit Test] Complete FUSE unit tests #22 2024-12-29 06:41:55 -06:00
2e24f9bb44 updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
2024-12-28 22:23:27 -06:00
6bb3351cb8 fix deliver script
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2024-12-28 22:08:24 -06:00
6086a0ea12 cleanup 2024-12-28 19:36:25 -06:00
b4b688d3b9 refactor 2024-12-28 19:35:17 -06:00
43bf3c0cb2 refactor 2024-12-28 19:33:42 -06:00
26897c256b call shutdown before close 2024-12-28 19:31:02 -06:00
a788563db6 cleanup 2024-12-28 19:27:36 -06:00
9fb1c747a6 updated CHANGELOG.md
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2024-12-28 16:30:32 -06:00
5982978879 updated CHANGELOG.md
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
2024-12-28 16:25:22 -06:00
5ca4584416 updated copyright 2024-12-28 16:20:41 -06:00
3eca1af971 updated version 2024-12-28 16:04:38 -06:00
147 changed files with 2151 additions and 6565 deletions

View File

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

View File

@ -4,6 +4,10 @@
### 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
@ -12,13 +16,11 @@
### 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

View File

@ -3,10 +3,6 @@ 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}
@ -162,7 +158,6 @@ 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
View File

@ -1,22 +1,23 @@
# Repertory
Repertory allows you to mount S3 and Sia via FUSE on Linux or via WinFSP
Repertory allows you to mount AWS S3 and Sia via FUSE on Linux ~~/OS X~~ or via WinFSP
on Windows.
## Details and Features
* Optimized for [Plex Media Server](https://www.plex.tv/)
* 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
* 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)
## 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)
@ -24,103 +25,47 @@ 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.
* `-dc`
* Display mount configuration
* For Sia, `--name` is optional
* For S3, the `-s3` option is required along with `--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`.
### Data Directories
### Sia
* Linux
* `~/.local/repertory2`
* `repertory /mnt/location`
* `repertory --name default /mnt/location`
* Windows
* `%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.
* `repertory.exe t:`
* `repertory.exe --name default t:`
## Remote Mounting
### S3
`Repertory` allows local mounts to be shared with other computers on your network.
This option is referred to as remote mounting. Instructions TBD.
* Linux
* `repertory --name storj -s3 /mnt/location`
* Windows
* `repertory.exe --name storj -s3 t:`
## Compiling
@ -149,26 +94,17 @@ This option is referred to as remote mounting. Instructions TBD.
## 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/)
* [docker](https://www.docker.com/)
* ~~[FUSE for macOS](https://osxfuse.github.io/)~~
* [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/)

View File

@ -22,6 +22,7 @@
#ifndef REPERTORY_INCLUDE_APP_CONFIG_HPP_
#define REPERTORY_INCLUDE_APP_CONFIG_HPP_
#include "events/event.hpp"
#include "types/remote.hpp"
#include "types/repertory.hpp"
@ -31,26 +32,26 @@ private:
static stop_type stop_requested;
public:
[[nodiscard]] static auto
default_agent_name(const provider_type &prov) -> std::string;
[[nodiscard]] static auto default_agent_name(const provider_type &prov)
-> std::string;
[[nodiscard]] static auto
default_api_port(const provider_type &prov) -> std::uint16_t;
[[nodiscard]] static auto default_api_port(const provider_type &prov)
-> std::uint16_t;
[[nodiscard]] static auto
default_data_directory(const provider_type &prov) -> std::string;
[[nodiscard]] static auto default_data_directory(const provider_type &prov)
-> std::string;
[[nodiscard]] static auto
default_remote_api_port(const provider_type &prov) -> std::uint16_t;
[[nodiscard]] static auto default_remote_api_port(const provider_type &prov)
-> std::uint16_t;
[[nodiscard]] static auto
default_rpc_port(const provider_type &prov) -> std::uint16_t;
[[nodiscard]] static auto default_rpc_port(const provider_type &prov)
-> std::uint16_t;
[[nodiscard]] static auto
get_provider_display_name(const provider_type &prov) -> std::string;
[[nodiscard]] static auto get_provider_display_name(const provider_type &prov)
-> std::string;
[[nodiscard]] static auto
get_provider_name(const provider_type &prov) -> std::string;
[[nodiscard]] static auto get_provider_name(const provider_type &prov)
-> std::string;
public:
[[nodiscard]] static auto get_stop_requested() -> bool;
@ -192,8 +193,8 @@ public:
[[nodiscard]] auto get_task_wait_ms() const -> std::uint16_t;
[[nodiscard]] auto
get_value_by_name(const std::string &name) const -> std::string;
[[nodiscard]] auto get_value_by_name(const std::string &name) const
-> std::string;
[[nodiscard]] auto get_version() const -> std::uint64_t;

View File

@ -26,7 +26,7 @@
#include "comm/curl/multi_request.hpp"
#include "comm/i_http_comm.hpp"
#include "events/event_system.hpp"
#include "events/types/curl_error.hpp"
#include "events/events.hpp"
#include "utils/encryption.hpp"
namespace repertory {
@ -137,8 +137,6 @@ 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,
@ -225,8 +223,7 @@ public:
}
if (curl_code != CURLE_OK) {
event_system::instance().raise<curl_error>(curl_code, function_name,
url);
event_system::instance().raise<curl_error>(url, curl_code);
return false;
}

View File

@ -0,0 +1,41 @@
/*
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,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
int, result, res, E_FROM_INT32
);
E_SIMPLE1(fuse_args_parsed, info,
std::string, arguments, args, E_FROM_STRING
);
// clang-format on
} // namespace repertory
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_

View File

@ -24,7 +24,7 @@
#if !defined(_WIN32)
#include "events/event_system.hpp"
#include "types/repertory.hpp"
#include "utils/path.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_;

View File

@ -69,96 +69,97 @@ private:
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,
uint32_t flags) -> api_error override;
[[nodiscard]] auto chflags_impl(std::string api_path, uint32_t flags)
-> api_error override;
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
chmod_impl(std::string api_path, mode_t mode,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode,
struct fuse_file_info *file_info)
-> api_error override;
#else
[[nodiscard]] auto chmod_impl(std::string api_path,
mode_t mode) -> api_error override;
[[nodiscard]] auto chmod_impl(std::string api_path, mode_t mode)
-> api_error override;
#endif
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info *file_info)
-> api_error override;
#else
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid,
gid_t gid) -> api_error override;
[[nodiscard]] auto chown_impl(std::string api_path, uid_t uid, gid_t gid)
-> api_error override;
#endif
[[nodiscard]] auto
create_impl(std::string api_path, mode_t mode,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto create_impl(std::string api_path, mode_t mode,
struct fuse_file_info *file_info)
-> api_error override;
void destroy_impl(void *ptr) override;
[[nodiscard]] auto
fallocate_impl(std::string api_path, int mode, off_t offset, off_t length,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto fallocate_impl(std::string api_path, int mode,
off_t offset, off_t length,
struct fuse_file_info *file_info)
-> api_error override;
[[nodiscard]] auto
fgetattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto fgetattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info)
-> api_error override;
#if defined(__APPLE__)
[[nodiscard]] auto
fsetattr_x_impl(std::string api_path, struct setattr_x *attr,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto fsetattr_x_impl(std::string api_path,
struct setattr_x *attr,
struct fuse_file_info *file_info)
-> api_error override;
#endif // __APPLE__
[[nodiscard]] auto
fsync_impl(std::string api_path, int datasync,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto fsync_impl(std::string api_path, int datasync,
struct fuse_file_info *file_info)
-> api_error override;
#if FUSE_USE_VERSION < 30
[[nodiscard]] auto
ftruncate_impl(std::string api_path, off_t size,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto ftruncate_impl(std::string api_path, off_t size,
struct fuse_file_info *file_info)
-> api_error override;
#endif
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info *file_info)
-> api_error override;
#else
[[nodiscard]] auto getattr_impl(std::string api_path,
struct stat *unix_st) -> api_error override;
[[nodiscard]] auto getattr_impl(std::string api_path, struct stat *unix_st)
-> api_error override;
#endif
#if defined(__APPLE__)
[[nodiscard]] auto
getxtimes_impl(std::string api_path, struct timespec *bkuptime,
struct timespec *crtime) -> api_error override;
[[nodiscard]] auto getxtimes_impl(std::string api_path,
struct timespec *bkuptime,
struct timespec *crtime)
-> api_error override;
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto init_impl(struct fuse_conn_info *conn,
struct fuse_config *cfg) -> void * override;
auto init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
-> void * override;
#else
auto init_impl(struct fuse_conn_info *conn) -> void * override;
#endif
[[nodiscard]] auto mkdir_impl(std::string api_path,
mode_t mode) -> api_error override;
[[nodiscard]] auto mkdir_impl(std::string api_path, mode_t mode)
-> api_error override;
void notify_fuse_main_exit(int &ret) override;
[[nodiscard]] auto
open_impl(std::string api_path,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto open_impl(std::string api_path,
struct fuse_file_info *file_info)
-> api_error override;
[[nodiscard]] auto
opendir_impl(std::string api_path,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto opendir_impl(std::string api_path,
struct fuse_file_info *file_info)
-> api_error override;
[[nodiscard]] auto read_impl(std::string api_path, char *buffer,
size_t read_size, off_t read_offset,
@ -166,29 +167,30 @@ protected:
std::size_t &bytes_read) -> api_error override;
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
readdir_impl(std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
off_t offset, struct fuse_file_info *file_info,
fuse_readdir_flags flags) -> api_error override;
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
fuse_fill_dir_t fuse_fill_dir, off_t offset,
struct fuse_file_info *file_info,
fuse_readdir_flags flags)
-> api_error override;
#else
[[nodiscard]] auto
readdir_impl(std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
off_t offset,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto readdir_impl(std::string api_path, void *buf,
fuse_fill_dir_t fuse_fill_dir, off_t offset,
struct fuse_file_info *file_info)
-> api_error override;
#endif
[[nodiscard]] auto
release_impl(std::string api_path,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto release_impl(std::string api_path,
struct fuse_file_info *file_info)
-> api_error override;
[[nodiscard]] auto
releasedir_impl(std::string api_path,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto releasedir_impl(std::string api_path,
struct fuse_file_info *file_info)
-> api_error override;
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto rename_impl(std::string from_api_path,
std::string to_api_path,
unsigned int flags) -> api_error override;
std::string to_api_path, unsigned int flags)
-> api_error override;
#else
[[nodiscard]] auto rename_impl(std::string from_api_path,
std::string to_api_path) -> api_error override;
@ -199,8 +201,8 @@ protected:
#if defined(HAS_SETXATTR)
[[nodiscard]] auto getxattr_common(std::string api_path, const char *name,
char *value, size_t size,
int &attribute_size,
uint32_t *position) -> api_error;
int &attribute_size, uint32_t *position)
-> api_error;
#if defined(__APPLE__)
[[nodiscard]] auto getxattr_impl(std::string api_path, const char *name,
@ -216,8 +218,8 @@ protected:
size_t size, int &required_size,
bool &return_size) -> api_error override;
[[nodiscard]] auto removexattr_impl(std::string api_path,
const char *name) -> api_error override;
[[nodiscard]] auto removexattr_impl(std::string api_path, const char *name)
-> api_error override;
#if defined(__APPLE__)
[[nodiscard]] auto setxattr_impl(std::string api_path, const char *name,
@ -225,62 +227,64 @@ protected:
uint32_t position) -> api_error override;
#else // __APPLE__
[[nodiscard]] auto setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size,
int flags) -> api_error override;
const char *value, size_t size, int flags)
-> api_error override;
#endif // __APPLE__
#endif // HAS_SETXATTR
#if defined(__APPLE__)
[[nodiscard]] auto
setattr_x_impl(std::string api_path,
struct setattr_x *attr) -> api_error override;
[[nodiscard]] auto setattr_x_impl(std::string api_path,
struct setattr_x *attr)
-> api_error override;
[[nodiscard]] auto
setbkuptime_impl(std::string api_path,
const struct timespec *bkuptime) -> api_error override;
[[nodiscard]] auto setbkuptime_impl(std::string api_path,
const struct timespec *bkuptime)
-> api_error override;
[[nodiscard]] auto
setchgtime_impl(std::string api_path,
const struct timespec *chgtime) -> api_error override;
[[nodiscard]] auto setchgtime_impl(std::string api_path,
const struct timespec *chgtime)
-> api_error override;
[[nodiscard]] auto
setcrtime_impl(std::string api_path,
const struct timespec *crtime) -> api_error override;
[[nodiscard]] auto setcrtime_impl(std::string api_path,
const struct timespec *crtime)
-> api_error override;
[[nodiscard]] auto setvolname_impl(const char *volname) -> api_error override;
[[nodiscard]] auto statfs_x_impl(std::string api_path,
struct statfs *stbuf) -> api_error override;
[[nodiscard]] auto statfs_x_impl(std::string api_path, struct statfs *stbuf)
-> api_error override;
#else // __APPLE__
[[nodiscard]] auto statfs_impl(std::string api_path,
struct statvfs *stbuf) -> api_error override;
[[nodiscard]] auto statfs_impl(std::string api_path, struct statvfs *stbuf)
-> api_error override;
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
truncate_impl(std::string api_path, off_t size,
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size,
struct fuse_file_info *file_info)
-> api_error override;
#else
[[nodiscard]] auto truncate_impl(std::string api_path,
off_t size) -> api_error override;
[[nodiscard]] auto truncate_impl(std::string api_path, off_t size)
-> api_error override;
#endif
[[nodiscard]] auto unlink_impl(std::string api_path) -> api_error override;
#if FUSE_USE_VERSION >= 30
[[nodiscard]] auto
utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info *file_info) -> api_error override;
[[nodiscard]] auto utimens_impl(std::string api_path,
const struct timespec tv[2],
struct fuse_file_info *file_info)
-> api_error override;
#else
[[nodiscard]] auto
utimens_impl(std::string api_path,
const struct timespec tv[2]) -> api_error override;
[[nodiscard]] auto utimens_impl(std::string api_path,
const struct timespec tv[2])
-> api_error override;
#endif
[[nodiscard]] auto
write_impl(std::string api_path, const char *buffer, size_t write_size,
off_t write_offset, struct fuse_file_info *file_info,
std::size_t &bytes_written) -> api_error override;
[[nodiscard]] auto write_impl(std::string api_path, const char *buffer,
size_t write_size, off_t write_offset,
struct fuse_file_info *file_info,
std::size_t &bytes_written)
-> api_error override;
public:
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
@ -289,16 +293,17 @@ public:
[[nodiscard]] auto get_directory_items(const std::string &api_path) const
-> directory_item_list override;
[[nodiscard]] auto
get_file_size(const std::string &api_path) const -> std::uint64_t override;
[[nodiscard]] auto get_file_size(const std::string &api_path) const
-> std::uint64_t override;
[[nodiscard]] auto
get_item_meta(const std::string &api_path,
api_meta_map &meta) const -> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
api_meta_map &meta) const
-> api_error override;
[[nodiscard]] auto
get_item_meta(const std::string &api_path, const std::string &name,
std::string &value) const -> api_error override;
[[nodiscard]] auto get_item_meta(const std::string &api_path,
const std::string &name,
std::string &value) const
-> api_error override;
[[nodiscard]] auto get_total_drive_space() const -> std::uint64_t override;
@ -309,16 +314,16 @@ public:
void get_volume_info(UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) const override;
[[nodiscard]] auto
is_processing(const std::string &api_path) const -> bool override;
[[nodiscard]] auto is_processing(const std::string &api_path) const
-> bool override;
[[nodiscard]] auto
rename_directory(const std::string &from_api_path,
const std::string &to_api_path) -> int override;
[[nodiscard]] auto rename_directory(const std::string &from_api_path,
const std::string &to_api_path)
-> int override;
[[nodiscard]] auto rename_file(const std::string &from_api_path,
const std::string &to_api_path,
bool overwrite) -> int override;
const std::string &to_api_path, bool overwrite)
-> int override;
void set_item_meta(const std::string &api_path, const std::string &key,
const std::string &value) override;

View File

@ -30,10 +30,7 @@
#include "drives/remote/remote_open_file_table.hpp"
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
#include "events/event_system.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 "events/events.hpp"
#include "types/remote.hpp"
#include "types/repertory.hpp"
#include "utils/base64.hpp"
@ -58,10 +55,7 @@ public:
drive_(drv),
mount_location_(std::move(mount_location)),
client_pool_(config.get_remote_mount().client_pool_size) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>(function_name,
"remote_server_base");
event_system::instance().raise<service_started>("remote_server_base");
handler_lookup_.insert(
{"::winfsp_can_delete",
[this](std::uint32_t, const std::string &, std::uint64_t,
@ -1378,19 +1372,14 @@ public:
method, request, response,
message_complete);
});
event_system::instance().raise<service_start_end>(function_name,
"remote_server_base");
}
~remote_server_base() override {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_stop_begin>(function_name,
"remote_server_base");
event_system::instance().raise<service_shutdown_begin>(
"remote_server_base");
client_pool_.shutdown();
packet_server_.reset();
event_system::instance().raise<service_stop_end>(function_name,
"remote_server_base");
event_system::instance().raise<service_shutdown_end>("remote_server_base");
}
public:

View File

@ -23,7 +23,6 @@
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
#include "events/event_system.hpp"
#include "types/repertory.hpp"
namespace repertory {
class console_consumer final {
@ -37,7 +36,7 @@ public:
~console_consumer();
private:
static void process_event(const i_event &evt);
void process_event(const event &e) const;
};
} // namespace repertory

View File

@ -23,10 +23,9 @@
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
#include "events/event_system.hpp"
#include "types/repertory.hpp"
namespace repertory {
class logging_consumer final {
class logging_consumer {
E_CONSUMER();
public:
@ -40,7 +39,7 @@ private:
5ULL};
private:
static void process_event(const i_event &evt);
void process_event(const event &event) const;
};
} // namespace repertory

View File

@ -0,0 +1,59 @@
/*
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_
#include "types/repertory.hpp"
namespace repertory {
class event {
protected:
event() = default;
event(const std::stringstream &ss, json j)
: 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;
protected:
std::stringstream ss_;
json j_{};
public:
[[nodiscard]] virtual auto clone() const -> std::shared_ptr<event> = 0;
[[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
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_

View File

@ -1,141 +1,232 @@
/*
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_
/*
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"
#include "types/repertory.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) : event(ss, j) {} \
\
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_)); \
}
#define E_END() }
#define E_SIMPLE(event_name, el) \
E_BEGIN(event_name, el) \
public: \
event_name() {} \
E_END()
#define E_SIMPLE1(event_name, el, type, name, short_name, tc) \
E_BEGIN(event_name, el) \
explicit event_name(const type &tv) { init_##short_name(tv); } \
E_PROP(type, name, short_name, tc) \
E_END()
#define E_SIMPLE2(event_name, el, type, name, short_name, tc, type2, name2, \
short_name2, tc2) \
E_BEGIN(event_name, el) \
explicit event_name(const type &tv, const type2 &tv2) { \
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, 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) { \
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, 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) { \
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, 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) { \
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, 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) { \
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, 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) { \
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_

View File

@ -0,0 +1,295 @@
/*
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,
std::string, url, url, E_FROM_STRING,
CURLcode, res, res, E_FROM_CURL_CODE
);
E_SIMPLE3(debug_log, debug,
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,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE2(directory_removed_externally, warn,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE2(directory_remove_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE2(drive_mount_failed, error,
std::string, location, loc, E_FROM_STRING,
std::string, result, res, E_FROM_STRING
);
E_SIMPLE1(drive_mounted, info,
std::string, location, loc, E_FROM_STRING
);
E_SIMPLE1(drive_mount_result, info,
std::string, result, res, E_FROM_STRING
);
E_SIMPLE1(drive_unmount_pending, info,
std::string, location, loc, E_FROM_STRING
);
E_SIMPLE1(drive_unmounted, info,
std::string, location, loc, E_FROM_STRING
);
E_SIMPLE1(event_level_changed, info,
std::string, new_event_level, level, E_FROM_STRING
);
E_SIMPLE1(failed_upload_queued, error,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE1(failed_upload_removed, warn,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE1(failed_upload_retry, info,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE2(file_get_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE1(file_get_api_list_failed, error,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE1(file_pinned, info,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE3(file_read_bytes_failed, error,
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,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE2(file_removed_externally, warn,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE2(file_remove_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE3(file_rename_failed, error,
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,
std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE3(filesystem_item_added, debug,
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,
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,
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,
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,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE3(filesystem_item_opened, trace,
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,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE4(file_upload_completed, info,
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,
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,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE2(file_upload_queued, info,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE1(file_upload_removed, debug,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE3(file_upload_retry, info,
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,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE1(orphaned_file_deleted, warn,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE1(orphaned_file_detected, warn,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE3(orphaned_file_processing_failed, error,
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,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE1(orphaned_source_file_removed, info,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE1(polling_item_begin, debug,
std::string, item_name, item, E_FROM_STRING
);
E_SIMPLE1(polling_item_end, debug,
std::string, item_name, item, E_FROM_STRING
);
E_SIMPLE2(provider_offline, error,
std::string, host_name_or_ip, host, E_FROM_STRING,
std::uint16_t, port, port, E_FROM_UINT16
);
E_SIMPLE2(provider_upload_begin, info,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING
);
E_SIMPLE3(provider_upload_end, info,
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,
std::string, function, func, E_FROM_STRING,
std::string, message, msg, E_FROM_STRING
);
E_SIMPLE1(rpc_server_exception, error,
std::string, exception, exception, E_FROM_STRING
);
E_SIMPLE1(service_shutdown_begin, debug,
std::string, service, svc, E_FROM_STRING
);
E_SIMPLE1(service_shutdown_end, debug,
std::string, service, svc, E_FROM_STRING
);
E_SIMPLE1(service_started, debug,
std::string, service, svc, E_FROM_STRING
);
E_SIMPLE(unmount_requested, info);
#if !defined(_WIN32)
E_SIMPLE2(unmount_result, info,
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_

View File

@ -0,0 +1,249 @@
/*
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 "app_config.hpp"
#include "events/event.hpp"
#include "utils/collection.hpp"
#include "utils/utils.hpp"
namespace repertory {
template <typename event_type> class t_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() * 4UL,
};
static constexpr const std::chrono::seconds queue_wait_secs{
5s,
};
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:
[[nodiscard]] auto get_stop_requested() const -> bool {
return stop_requested_ || app_config::get_stop_requested();
}
void process_events() {
std::vector<std::shared_ptr<event_type>> events;
unique_mutex_lock lock(event_mutex_);
const auto lock_and_notify = [this, &lock]() {
lock.lock();
event_notify_.notify_all();
lock.unlock();
};
if (not get_stop_requested() && event_list_.empty()) {
event_notify_.wait_for(lock, queue_wait_secs);
}
if (not event_list_.empty()) {
events.insert(events.end(), event_list_.begin(), event_list_.end());
event_list_.clear();
}
lock.unlock();
if (events.empty()) {
lock_and_notify();
return;
}
const auto notify_events = [this](const std::string &name,
const event_type &event) {
std::deque<std::future<void>> futures;
recur_mutex_lock consumer_lock(consumer_mutex_);
for (auto *consumer : event_consumers_[name]) {
futures.emplace_back(
std::async(std::launch::async, [consumer, &event]() {
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());
}
lock_and_notify();
}
void queue_event(std::shared_ptr<event_type> evt) {
unique_mutex_lock lock(event_mutex_);
event_list_.push_back(std::move(evt));
auto size = event_list_.size();
event_notify_.notify_all();
lock.unlock();
for (std::uint8_t retry{0U};
size > max_queue_size && retry < max_queue_retry &&
not get_stop_requested();
++retry) {
lock.lock();
size = event_list_.size();
if (size > max_queue_size) {
event_notify_.wait_for(lock, queue_wait_secs);
size = event_list_.size();
}
event_notify_.notify_all();
lock.unlock();
}
}
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 (event_thread_) {
event_notify_.notify_all();
return;
}
stop_requested_ = false;
event_thread_ = std::make_unique<std::thread>([this]() {
while (not get_stop_requested()) {
process_events();
}
});
event_notify_.notify_all();
}
void stop() {
unique_mutex_lock lock(run_mutex_);
if (not event_thread_) {
event_notify_.notify_all();
return;
}
stop_requested_ = true;
std::unique_ptr<std::thread> thread{nullptr};
std::swap(thread, event_thread_);
event_notify_.notify_all();
lock.unlock();
thread->join();
thread.reset();
process_events();
}
};
} // namespace repertory
#endif // REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_

View File

@ -1,74 +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_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_

View File

@ -1,68 +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_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_

View File

@ -1,78 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,78 +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_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_

View File

@ -1,75 +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_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_

View File

@ -1,80 +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_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_

View File

@ -1,79 +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_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_

View File

@ -1,81 +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_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_restore_failed final : public i_event {
download_restore_failed() = default;
download_restore_failed(std::string api_path_, std::string dest_path_,
std::string error_, std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"download_restore_failed"};
std::string api_path;
std::string dest_path;
std::string error;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|error|{}", name, function_name,
api_path, dest_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_restore_failed> {
static void to_json(json &data,
const repertory::download_restore_failed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_restore_failed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("error").get_to<std::string>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORE_FAILED_HPP_

View File

@ -1,75 +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_TYPES_DOWNLOAD_RESTORED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_restored final : public i_event {
download_restored() = default;
download_restored(std::string api_path_, std::string dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"download_restored"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_restored> {
static void to_json(json &data, const repertory::download_restored &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::download_restored &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESTORED_HPP_

View File

@ -1,82 +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_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_resume_add_failed final : public i_event {
download_resume_add_failed() = default;
download_resume_add_failed(std::string api_path_, std::string dest_path_,
std::string error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
error(std::move(error_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::error};
static constexpr const std::string_view name{"download_resume_add_failed"};
std::string api_path;
std::string dest_path;
std::string error;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|error|{}", name, function_name,
api_path, dest_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_add_failed> {
static void to_json(json &data,
const repertory::download_resume_add_failed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_add_failed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("error").get_to<std::string>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADD_FAILED_HPP_

View File

@ -1,77 +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_TYPES_DOWNLOAD_RESUME_ADDED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADDED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_resume_added final : public i_event {
download_resume_added() = default;
download_resume_added(std::string api_path_, std::string dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_resume_added"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_added> {
static void to_json(json &data,
const repertory::download_resume_added &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_added &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_ADDED_HPP_

View File

@ -1,77 +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_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_resume_removed final : public i_event {
download_resume_removed() = default;
download_resume_removed(std::string api_path_, std::string dest_path_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_resume_removed"};
std::string api_path;
std::string dest_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}", name, function_name, api_path,
dest_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_resume_removed> {
static void to_json(json &data,
const repertory::download_resume_removed &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::download_resume_removed &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_RESUME_REMOVED_HPP_

View File

@ -1,82 +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_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct download_type_selected final : public i_event {
download_type_selected() = default;
download_type_selected(std::string api_path_, std::string dest_path_,
std::string_view function_name_, download_type type_)
: api_path(std::move(api_path_)),
dest_path(std::move(dest_path_)),
function_name(std::string(function_name_)),
type(type_) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"download_type_selected"};
std::string api_path;
std::string dest_path;
std::string function_name;
download_type type{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|dp|{}|type|{}", name, function_name,
api_path, dest_path, download_type_to_string(type));
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::download_type_selected> {
static void to_json(json &data,
const repertory::download_type_selected &value) {
data["api_path"] = value.api_path;
data["dest_path"] = value.dest_path;
data["function_name"] = value.function_name;
data["type"] = repertory::download_type_to_string(value.type);
}
static void from_json(const json &data,
repertory::download_type_selected &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("dest_path").get_to<std::string>(value.dest_path);
data.at("function_name").get_to<std::string>(value.function_name);
value.type = repertory::download_type_from_string(
data.at("type").get<std::string>());
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DOWNLOAD_TYPE_SELECTED_HPP_

View File

@ -1,78 +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_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_

View File

@ -1,76 +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_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_

View File

@ -1,70 +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_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_

View File

@ -1,67 +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_TYPES_DRIVE_STOP_TIMED_OUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_STOP_TIMED_OUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct drive_stop_timed_out final : public i_event {
drive_stop_timed_out() = default;
drive_stop_timed_out(std::string_view function_name_)
: function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"drive_stop_timed_out"};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}", name, function_name);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::drive_stop_timed_out> {
static void to_json(json &data,
const repertory::drive_stop_timed_out &value) {
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::drive_stop_timed_out &value) {
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_DRIVE_STOP_TIMED_OUT_HPP_

View File

@ -1,73 +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_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_

View File

@ -1,70 +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_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_

View File

@ -1,71 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,77 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,78 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,88 +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_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_

View File

@ -1,80 +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_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_

View File

@ -1,77 +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_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_

View File

@ -1,76 +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_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_

View File

@ -1,70 +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_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_

View File

@ -1,80 +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_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_

View File

@ -1,81 +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_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_

View File

@ -1,87 +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_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_

View File

@ -1,78 +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_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_

View File

@ -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_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_

View File

@ -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_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_

View File

@ -1,82 +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_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_

View File

@ -1,70 +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_TYPES_FUSE_ARGS_PARSED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_ARGS_PARSED_HPP_
#if !defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct fuse_args_parsed final : public i_event {
fuse_args_parsed() = default;
fuse_args_parsed(std::string_view args_, std::string_view function_name_)
: args(std::move(args_)), function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::info};
static constexpr const std::string_view name{"fuse_args_parsed"};
std::string args;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|args|{}", name, function_name, args);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::fuse_args_parsed> {
static void to_json(json &data, const repertory::fuse_args_parsed &value) {
data["args"] = value.args;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::fuse_args_parsed &value) {
data.at("args").get_to<std::string>(value.args);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // !defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_ARGS_PARSED_HPP_

View File

@ -1,77 +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_TYPES_FUSE_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_EVENT_HPP_
#if !defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct fuse_event final : public i_event {
fuse_event() = default;
fuse_event(std::string_view api_path_, std::int32_t error_,
std::string_view function_name_)
: api_path(std::string{api_path_}),
error(error_),
function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"fuse_event"};
std::string api_path;
std::int32_t error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::fuse_event> {
static void to_json(json &data, const repertory::fuse_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::fuse_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<std::int32_t>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // !defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_FUSE_EVENT_HPP_

View File

@ -1,76 +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_TYPES_INVALID_CACHE_SIZE_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_INVALID_CACHE_SIZE_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct invalid_cache_size final : public i_event {
invalid_cache_size() = default;
invalid_cache_size(std::uint64_t cache_size_, std::string_view function_name_,
std::uint64_t invalid_size_)
: cache_size(cache_size_),
function_name(std::string{function_name_}),
invalid_size(invalid_size_) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"invalid_cache_size"};
std::uint64_t cache_size{};
std::string function_name;
std::uint64_t invalid_size{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|size|{}|by|{}", name, function_name,
cache_size, invalid_size);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::invalid_cache_size> {
static void to_json(json &data, const repertory::invalid_cache_size &value) {
data["cache_size"] = value.cache_size;
data["function_name"] = value.function_name;
data["invalid_size"] = value.invalid_size;
}
static void from_json(const json &data,
repertory::invalid_cache_size &value) {
data.at("cache_size").get_to<std::uint64_t>(value.cache_size);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("invalid_size").get_to<std::uint64_t>(value.invalid_size);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_INVALID_CACHE_SIZE_HPP_

View File

@ -1,69 +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_TYPES_ITEM_TIMEOUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_ITEM_TIMEOUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct item_timeout final : public i_event {
item_timeout() = default;
item_timeout(std::string api_path_, std::string_view function_name_)
: api_path(std::move(api_path_)),
function_name(std::string(function_name_)) {}
static constexpr const event_level level{event_level::trace};
static constexpr const std::string_view name{"item_timeout"};
std::string api_path;
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}", name, function_name, api_path);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::item_timeout> {
static void to_json(json &data, const repertory::item_timeout &value) {
data["api_path"] = value.api_path;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::item_timeout &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_ITEM_TIMEOUT_HPP_

View File

@ -1,78 +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_TYPES_MAX_CACHE_SIZE_REACHED_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_MAX_CACHE_SIZE_REACHED_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct max_cache_size_reached final : public i_event {
max_cache_size_reached() = default;
max_cache_size_reached(std::uint64_t cache_size_,
std::string_view function_name_,
std::uint64_t max_cache_size_)
: cache_size(cache_size_),
function_name(std::string{function_name_}),
max_cache_size(max_cache_size_) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"max_cache_size_reached"};
std::uint64_t cache_size{};
std::string function_name;
std::uint64_t max_cache_size{};
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|size|{}|max|{}", name, function_name,
cache_size, max_cache_size);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::max_cache_size_reached> {
static void to_json(json &data,
const repertory::max_cache_size_reached &value) {
data["cache_size"] = value.cache_size;
data["function_name"] = value.function_name;
data["max_cache_size"] = value.max_cache_size;
}
static void from_json(const json &data,
repertory::max_cache_size_reached &value) {
data.at("cache_size").get_to<std::uint64_t>(value.cache_size);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("max_cache_size").get_to<std::uint64_t>(value.max_cache_size);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_MAX_CACHE_SIZE_REACHED_HPP_

View File

@ -1,72 +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_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_

View File

@ -1,84 +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_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_

View File

@ -1,72 +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_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_

View File

@ -1,72 +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_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_

View File

@ -1,77 +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_TYPES_PACKET_CLIENT_TIMEOUT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_PACKET_CLIENT_TIMEOUT_HPP_
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct packet_client_timeout final : public i_event {
packet_client_timeout() = default;
packet_client_timeout(std::string event_name_,
std::string_view function_name_, std::string msg_)
: event_name(std::move(event_name_)),
function_name(std::string(function_name_)),
msg(std::move(msg_)) {}
static constexpr const event_level level{event_level::warn};
static constexpr const std::string_view name{"packet_client_timeout"};
std::string event_name;
std::string function_name;
std::string msg;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|event|{}|msg|{}", name, function_name,
event_name, msg);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::packet_client_timeout> {
static void to_json(json &data,
const repertory::packet_client_timeout &value) {
data["event_name"] = value.event_name;
data["function_name"] = value.function_name;
data["msg"] = value.msg;
}
static void from_json(const json &data,
repertory::packet_client_timeout &value) {
data.at("event_name").get_to<std::string>(value.event_name);
data.at("function_name").get_to<std::string>(value.function_name);
data.at("msg").get_to<std::string>(value.msg);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PACKET_CLIENT_TIMEOUT_HPP_

View File

@ -1,70 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,75 +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_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_

View File

@ -1,77 +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_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_

View File

@ -1,81 +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_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_

View File

@ -1,77 +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_TYPES_REMOTE_SERVER_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_REMOTE_SERVER_EVENT_HPP_
#include "comm/packet/packet.hpp"
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct remote_server_event final : public i_event {
remote_server_event() = default;
remote_server_event(std::string api_path_, packet::error_type error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"remote_server_event"};
std::string api_path;
packet::error_type error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::remote_server_event> {
static void to_json(json &data, const repertory::remote_server_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data,
repertory::remote_server_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<repertory::packet::error_type>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_REMOTE_SERVER_EVENT_HPP_

View File

@ -1,69 +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_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_

View File

@ -1,71 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,70 +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_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_

View File

@ -1,69 +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_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_

View File

@ -1,65 +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_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_

View File

@ -1,77 +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_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_

View File

@ -1,77 +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_TYPES_WINFSP_EVENT_HPP_
#define REPERTORY_INCLUDE_EVENTS_TYPES_WINFSP_EVENT_HPP_
#if defined(_WIN32)
#include "events/i_event.hpp"
#include "types/repertory.hpp"
namespace repertory {
struct winfsp_event final : public i_event {
winfsp_event() = default;
winfsp_event(std::string api_path_, NTSTATUS error_,
std::string_view function_name_)
: api_path(std::move(api_path_)),
error(error_),
function_name(std::string{function_name_}) {}
static constexpr const event_level level{event_level::debug};
static constexpr const std::string_view name{"winfsp_event"};
std::string api_path;
NTSTATUS error{};
std::string function_name;
[[nodiscard]] auto get_event_level() const -> event_level override {
return level;
}
[[nodiscard]] auto get_name() const -> std::string_view override {
return name;
}
[[nodiscard]] auto get_single_line() const -> std::string override {
return fmt::format("{}|func|{}|ap|{}|error|{}", name, function_name,
api_path, error);
}
};
} // namespace repertory
NLOHMANN_JSON_NAMESPACE_BEGIN
template <> struct adl_serializer<repertory::winfsp_event> {
static void to_json(json &data, const repertory::winfsp_event &value) {
data["api_path"] = value.api_path;
data["error"] = value.error;
data["function_name"] = value.function_name;
}
static void from_json(const json &data, repertory::winfsp_event &value) {
data.at("api_path").get_to<std::string>(value.api_path);
data.at("error").get_to<NTSTATUS>(value.error);
data.at("function_name").get_to<std::string>(value.function_name);
}
};
NLOHMANN_JSON_NAMESPACE_END
#endif // defined(_WIN32)
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_WINFSP_EVENT_HPP_

View File

@ -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_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,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE3(download_end, info,
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,
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,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE3(download_restore_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE3(download_resume_add_failed, error,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_FROM_STRING
);
E_SIMPLE2(download_resume_added, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE2(download_resume_removed, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_FROM_STRING
);
E_SIMPLE1(item_timeout, trace,
std::string, api_path, ap, E_FROM_STRING
);
E_SIMPLE3(download_type_selected, debug,
std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_FROM_STRING,
download_type, download_type, type, E_FROM_DOWNLOAD_TYPE
);
// clang-format on
} // namespace repertory
#endif // REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_

View File

@ -24,7 +24,7 @@
#include "db/i_file_mgr_db.hpp"
#include "events/event_system.hpp"
#include "events/types/file_upload_completed.hpp"
#include "events/events.hpp"
#include "file_manager/i_file_manager.hpp"
#include "file_manager/i_open_file.hpp"
#include "file_manager/i_upload_manager.hpp"

View File

@ -31,18 +31,18 @@ public:
private:
const rpc_host_info host_info_;
std::atomic<std::uint32_t> request_id_{0U};
std::atomic<std::uint32_t> request_id_;
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;

View File

@ -43,8 +43,7 @@ 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)};
@ -288,9 +287,7 @@ 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 {

View File

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

View File

@ -22,7 +22,7 @@
#include "app_config.hpp"
#include "events/event_system.hpp"
#include "events/types/event_level_changed.hpp"
#include "events/events.hpp"
#include "file_manager/cache_size_mgr.hpp"
#include "platform/platform.hpp"
#include "types/startup_exception.hpp"
@ -1146,10 +1146,9 @@ void app_config::set_enable_mount_manager(bool value) {
#endif // defined(_WIN32)
void app_config::set_event_level(const event_level &value) {
REPERTORY_USES_FUNCTION_NAME();
if (set_value(event_level_, value)) {
event_system::instance().raise<event_level_changed>(function_name, value);
event_system::instance().raise<event_level_changed>(
event_level_to_string(value));
}
}

View File

@ -22,10 +22,7 @@
#include "comm/packet/client_pool.hpp"
#include "events/event_system.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 "events/events.hpp"
#include "platform/platform.hpp"
#include "utils/error_utils.hpp"
@ -46,8 +43,7 @@ void client_pool::pool::execute(
client_pool::pool::pool(std::uint8_t pool_size) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>(function_name,
"client_pool");
event_system::instance().raise<service_started>("client_pool");
for (std::uint8_t i = 0U; i < pool_size; i++) {
pool_queues_.emplace_back(std::make_unique<work_queue>());
@ -109,9 +105,6 @@ client_pool::pool::pool(std::uint8_t pool_size) {
queue_lock.unlock();
});
}
event_system::instance().raise<service_start_end>(function_name,
"client_pool");
}
void client_pool::pool::shutdown() {
@ -153,14 +146,11 @@ void client_pool::remove_client(const std::string &client_id) {
}
void client_pool::shutdown() {
REPERTORY_USES_FUNCTION_NAME();
if (shutdown_) {
return;
}
event_system::instance().raise<service_stop_begin>(function_name,
"client_pool");
event_system::instance().raise<service_shutdown_begin>("client_pool");
unique_mutex_lock pool_lock(pool_mutex_);
if (not shutdown_) {
shutdown_ = true;
@ -170,7 +160,6 @@ void client_pool::shutdown() {
pool_lookup_.clear();
}
pool_lock.unlock();
event_system::instance().raise<service_stop_end>(function_name,
"client_pool");
event_system::instance().raise<service_shutdown_end>("client_pool");
}
} // namespace repertory

View File

@ -22,7 +22,6 @@
#include "comm/packet/packet_client.hpp"
#include "events/event_system.hpp"
#include "events/types/packet_client_timeout.hpp"
#include "platform/platform.hpp"
#include "types/repertory.hpp"
#include "utils/collection.hpp"
@ -32,6 +31,13 @@
#include "version.hpp"
namespace repertory {
// clang-format off
E_SIMPLE2(packet_client_timeout, error,
std::string, event_name, en, E_FROM_STRING,
std::string, message, msg, E_FROM_STRING
);
// clang-format on
packet_client::packet_client(remote::remote_config cfg)
: cfg_(std::move(cfg)), unique_id_(utils::create_uuid_string()) {}
@ -185,7 +191,7 @@ auto packet_client::send(std::string_view method, packet &request,
timeout request_timeout(
[method, current_client]() {
event_system::instance().raise<packet_client_timeout>(
"request", function_name, std::string{method});
"request", std::string{method});
packet_client::close(*current_client);
},
std::chrono::milliseconds(cfg_.send_timeout_ms));
@ -207,7 +213,7 @@ auto packet_client::send(std::string_view method, packet &request,
timeout response_timeout(
[method, current_client]() {
event_system::instance().raise<packet_client_timeout>(
"response", function_name, std::string{method});
"response", std::string{method});
packet_client::close(*current_client);
},
std::chrono::milliseconds(cfg_.recv_timeout_ms));

View File

@ -23,10 +23,7 @@
#include "comm/packet/packet.hpp"
#include "events/event_system.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 "events/events.hpp"
#include "platform/platform.hpp"
#include "types/repertory.hpp"
#include "utils/error_utils.hpp"
@ -40,20 +37,12 @@ packet_server::packet_server(std::uint16_t port, std::string token,
: encryption_token_(std::move(token)),
closed_(std::move(closed)),
message_handler_(std::move(message_handler)) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_start_begin>(function_name,
"packet_server");
initialize(port, pool_size);
event_system::instance().raise<service_start_end>(function_name,
"packet_server");
event_system::instance().raise<service_started>("packet_server");
}
packet_server::~packet_server() {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<service_stop_begin>(function_name,
"packet_server");
event_system::instance().raise<service_shutdown_begin>("packet_server");
std::thread([this]() {
for (std::size_t i = 0U; i < service_threads_.size(); i++) {
io_context_.stop();
@ -62,8 +51,7 @@ packet_server::~packet_server() {
server_thread_->join();
server_thread_.reset();
event_system::instance().raise<service_stop_end>(function_name,
"packet_server");
event_system::instance().raise<service_shutdown_end>("packet_server");
}
void packet_server::add_client(connection &conn, const std::string &client_id) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,11 +24,9 @@
#include "drives/fuse/fuse_base.hpp"
#include "app_config.hpp"
#include "drives/fuse/events.hpp"
#include "events/event_system.hpp"
#include "events/types/fuse_args_parsed.hpp"
#include "events/types/fuse_event.hpp"
#include "events/types/unmount_requested.hpp"
#include "events/types/unmount_result.hpp"
#include "events/events.hpp"
#include "initialize.hpp"
#include "platform/platform.hpp"
#include "utils/collection.hpp"
@ -92,7 +90,7 @@ fuse_base::fuse_base(app_config &config) : config_(config) {
fuse_ops_.flag_reserved = 0;
#endif // FUSE_USE_VERSION < 30
E_SUBSCRIBE(unmount_requested, [this](const unmount_requested &) {
E_SUBSCRIBE_EXACT(unmount_requested, [this](const unmount_requested &) {
std::thread([this]() { this->shutdown(); }).detach();
});
}
@ -603,17 +601,12 @@ auto fuse_base::listxattr_(const char *path, char *buffer, size_t size) -> int {
}
void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<fuse_args_parsed>(
std::accumulate(args.begin(), args.end(), std::string(),
[](auto &&command_line, auto &&arg) -> auto {
command_line +=
(command_line.empty() ? arg
: (" " + std::string(arg)));
return command_line;
}),
function_name);
event_system::instance().raise<fuse_args_parsed>(std::accumulate(
args.begin(), args.end(), std::string(),
[](auto &&command_line, auto &&arg) -> auto {
command_line += (command_line.empty() ? arg : (" " + std::string(arg)));
return command_line;
}));
}
auto fuse_base::parse_args(std::vector<std::string> &args) -> int {
@ -708,7 +701,7 @@ void fuse_base::raise_fuse_event(std::string_view function_name,
(config_.get_event_level() >= event_level::trace)) {
std::string func{function_name};
event_system::instance().raise<fuse_event>(
api_path, ret, utils::string::right_trim(func, '_'));
utils::string::right_trim(func, '_'), std::string{api_path}, ret);
}
}
@ -757,11 +750,9 @@ auto fuse_base::setxattr_(const char *path, const char *name, const char *value,
#endif // HAS_SETXATTR
void fuse_base::shutdown() {
REPERTORY_USES_FUNCTION_NAME();
auto res = unmount(get_mount_location());
event_system::instance().raise<unmount_result>(function_name,
get_mount_location(), res);
const auto res = unmount(get_mount_location());
event_system::instance().raise<unmount_result>(get_mount_location(),
std::to_string(res));
}
#if defined(__APPLE__)

View File

@ -31,11 +31,7 @@
#include "events/consumers/console_consumer.hpp"
#include "events/consumers/logging_consumer.hpp"
#include "events/event_system.hpp"
#include "events/types/drive_mount_result.hpp"
#include "events/types/drive_mounted.hpp"
#include "events/types/drive_stop_timed_out.hpp"
#include "events/types/drive_unmount_pending.hpp"
#include "events/types/drive_unmounted.hpp"
#include "events/events.hpp"
#include "platform/platform.hpp"
#include "providers/i_provider.hpp"
#include "rpc/server/full_server.hpp"
@ -85,8 +81,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::chown_impl(std::string api_path, uid_t uid,
gid_t gid) -> api_error {
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
-> api_error {
#endif
return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
@ -282,7 +278,6 @@ void fuse_drive::stop_all() {
});
if (future.wait_for(30s) == std::future_status::timeout) {
event_system::instance().raise<drive_stop_timed_out>(function_name);
app_config::set_stop_requested();
future.wait();
}
@ -295,8 +290,7 @@ void fuse_drive::stop_all() {
void fuse_drive::destroy_impl(void *ptr) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_unmount_pending>(function_name,
get_mount_location());
event_system::instance().raise<drive_unmount_pending>(get_mount_location());
stop_all();
@ -304,8 +298,7 @@ void fuse_drive::destroy_impl(void *ptr) {
fuse_base::destroy_impl(ptr);
event_system::instance().raise<drive_unmounted>(function_name,
get_mount_location());
event_system::instance().raise<drive_unmounted>(get_mount_location());
}
auto fuse_drive::fallocate_impl(std::string /*api_path*/, int mode,
@ -494,8 +487,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::getattr_impl(std::string api_path,
struct stat *unix_st) -> api_error {
auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
-> api_error {
#endif
auto parent = utils::path::get_parent_api_path(api_path);
@ -561,8 +554,8 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
#endif // __APPLE__
#if FUSE_USE_VERSION >= 30
auto fuse_drive::init_impl(struct fuse_conn_info *conn,
struct fuse_config *cfg) -> void * {
auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
-> void * {
#else
void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
#endif
@ -618,8 +611,7 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
utils::error::raise_error(function_name, "failed to set mount state");
}
event_system::instance().raise<drive_mounted>(function_name,
get_mount_location());
event_system::instance().raise<drive_mounted>(get_mount_location());
} catch (const std::exception &e) {
utils::error::raise_error(function_name, e, "exception during fuse init");
@ -666,17 +658,12 @@ auto fuse_drive::mkdir_impl(std::string api_path, mode_t mode) -> api_error {
}
void fuse_drive::notify_fuse_main_exit(int &ret) {
REPERTORY_USES_FUNCTION_NAME();
if (not was_mounted_) {
return;
if (was_mounted_) {
event_system::instance().raise<drive_mount_result>(std::to_string(ret));
event_system::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();
}
event_system::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret));
event_system::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();
}
auto fuse_drive::open_impl(std::string api_path,
@ -804,8 +791,9 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
return api_error::success;
}
auto fuse_drive::releasedir_impl(
std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error {
auto fuse_drive::releasedir_impl(std::string /*api_path*/,
struct fuse_file_info *file_info)
-> api_error {
auto iter = directory_cache_->get_directory(file_info->fh);
if (iter == nullptr) {
return api_error::invalid_handle;
@ -823,8 +811,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
}
auto fuse_drive::rename_file(const std::string &from_api_path,
const std::string &to_api_path,
bool overwrite) -> int {
const std::string &to_api_path, bool overwrite)
-> int {
auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
errno = std::abs(utils::from_api_error(res));
return (res == api_error::success) ? 0 : -1;
@ -834,8 +822,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
unsigned int /*flags*/) -> api_error {
#else
auto fuse_drive::rename_impl(std::string from_api_path,
std::string to_api_path) -> api_error {
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path)
-> api_error {
#endif
auto res = check_parent_access(to_api_path, W_OK | X_OK);
if (res != api_error::success) {
@ -937,15 +925,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
}
#else // __APPLE__
auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
char *value, size_t size,
int &attribute_size) -> api_error {
char *value, size_t size, int &attribute_size)
-> api_error {
return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
}
#endif // __APPLE__
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
int &required_size,
bool &return_size) -> api_error {
int &required_size, bool &return_size)
-> api_error {
auto check_size = (size == 0);
auto res = check_parent_access(api_path, X_OK);
@ -985,8 +973,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
return res;
}
auto fuse_drive::removexattr_impl(std::string api_path,
const char *name) -> api_error {
auto fuse_drive::removexattr_impl(std::string api_path, const char *name)
-> api_error {
std::string attribute_name;
#if defined(__APPLE__)
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
@ -1014,8 +1002,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
uint32_t position) -> api_error {
#else // __APPLE__
auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
const char *value, size_t size,
int flags) -> api_error {
const char *value, size_t size, int flags)
-> api_error {
#endif
std::string attribute_name;
#if defined(__APPLE__)
@ -1093,8 +1081,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
}
#if defined(__APPLE__)
auto fuse_drive::setattr_x_impl(std::string api_path,
struct setattr_x *attr) -> api_error {
auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
-> api_error {
bool exists{};
auto res = provider_.is_file(api_path, exists);
if (res != api_error::success) {
@ -1148,7 +1136,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
ts[0].tv_sec = attr->acctime.tv_sec;
ts[0].tv_nsec = attr->acctime.tv_nsec;
} else {
struct timeval tv {};
struct timeval tv{};
gettimeofday(&tv, NULL);
ts[0].tv_sec = tv.tv_sec;
ts[0].tv_nsec = tv.tv_usec * 1000;
@ -1193,8 +1181,9 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
return api_error::success;
}
auto fuse_drive::setbkuptime_impl(
std::string api_path, const struct timespec *bkuptime) -> api_error {
auto fuse_drive::setbkuptime_impl(std::string api_path,
const struct timespec *bkuptime)
-> api_error {
return check_and_perform(
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
auto nanos = bkuptime->tv_nsec +
@ -1230,8 +1219,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
return api_error::success;
}
auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
struct statfs *stbuf) -> api_error {
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
-> api_error {
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
return api_error::os_error;
}
@ -1256,8 +1245,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
return api_error::success;
}
#else // __APPLE__
auto fuse_drive::statfs_impl(std::string /*api_path*/,
struct statvfs *stbuf) -> api_error {
auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf)
-> api_error {
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
return api_error::os_error;
}
@ -1341,8 +1330,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
struct fuse_file_info * /*file_info*/)
-> api_error {
#else
auto fuse_drive::utimens_impl(std::string api_path,
const struct timespec tv[2]) -> api_error {
auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2])
-> api_error {
#endif
api_meta_map meta;
auto res = provider_.get_item_meta(api_path, meta);

View File

@ -23,11 +23,10 @@
#include "drives/fuse/fuse_drive_base.hpp"
#include "events/events.hpp"
#include "platform/platform.hpp"
#include "providers/i_provider.hpp"
#include "utils/common.hpp"
#include "utils/path.hpp"
#include "utils/string.hpp"
#include "utils/time.hpp"
namespace repertory {

View File

@ -24,14 +24,11 @@
#include "drives/fuse/remotefuse/remote_fuse_drive.hpp"
#include "app_config.hpp"
#include "drives/fuse/events.hpp"
#include "events/consumers/console_consumer.hpp"
#include "events/consumers/logging_consumer.hpp"
#include "events/event_system.hpp"
#include "events/types/drive_mount_result.hpp"
#include "events/types/drive_mounted.hpp"
#include "events/types/drive_unmount_pending.hpp"
#include "events/types/drive_unmounted.hpp"
#include "events/types/unmount_requested.hpp"
#include "events/events.hpp"
#include "platform/platform.hpp"
#include "rpc/server/server.hpp"
#include "types/remote.hpp"
@ -93,8 +90,7 @@ auto remote_fuse_drive::create_impl(std::string api_path, mode_t mode,
void remote_fuse_drive::destroy_impl(void *ptr) {
REPERTORY_USES_FUNCTION_NAME();
event_system::instance().raise<drive_unmount_pending>(function_name,
get_mount_location());
event_system::instance().raise<drive_unmount_pending>(get_mount_location());
if (server_) {
server_->stop();
@ -115,8 +111,7 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
utils::error::raise_error(function_name, "failed to set mount state");
}
event_system::instance().raise<drive_unmounted>(function_name,
get_mount_location());
event_system::instance().raise<drive_unmounted>(get_mount_location());
fuse_base::destroy_impl(ptr);
}
@ -262,8 +257,7 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
} else {
server_ = std::make_shared<server>(config_);
server_->start();
event_system::instance().raise<drive_mounted>(function_name,
get_mount_location());
event_system::instance().raise<drive_mounted>(get_mount_location());
}
return ret;
@ -276,11 +270,8 @@ auto remote_fuse_drive::mkdir_impl(std::string api_path,
}
void remote_fuse_drive::notify_fuse_main_exit(int &ret) {
REPERTORY_USES_FUNCTION_NAME();
if (was_mounted_) {
event_system::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret));
event_system::instance().raise<drive_mount_result>(std::to_string(ret));
event_system::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();

View File

@ -28,7 +28,6 @@
#include "drives/directory_iterator.hpp"
#include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp"
#include "events/types/remote_server_event.hpp"
#include "platform/platform.hpp"
#include "types/remote.hpp"
#include "types/repertory.hpp"
@ -37,15 +36,23 @@
#include "utils/file.hpp"
#include "utils/path.hpp"
#include "utils/time.hpp"
#include "utils/utils.hpp"
namespace repertory::remote_fuse {
#define RAISE_REMOTE_FUSE_SERVER_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= remote_server_event::level) && \
(((config_.get_event_level() >= remote_fuse_server_event::level) && \
((ret) < 0)) || \
(config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<remote_server_event>(file, ret, func)
event_system::instance().raise<remote_fuse_server_event>(std::string{func}, \
file, ret)
// clang-format off
E_SIMPLE3(remote_fuse_server_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
// clang-format on
remote_server::remote_server(app_config &config, i_fuse_drive &drive,
const std::string &mount_location)

View File

@ -22,6 +22,7 @@
#include "drives/remote/remote_open_file_table.hpp"
#include "events/event_system.hpp"
#include "events/events.hpp"
#include "utils/collection.hpp"
#include "utils/config.hpp"
#include "utils/utils.hpp"

View File

@ -24,14 +24,28 @@
#include "app_config.hpp"
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
#include "events/event_system.hpp"
#include "events/types/drive_mounted.hpp"
#include "events/types/drive_unmount_pending.hpp"
#include "events/types/drive_unmounted.hpp"
#include "events/events.hpp"
#include "types/repertory.hpp"
#include "utils/path.hpp"
#include "version.hpp"
namespace repertory::remote_winfsp {
#define RAISE_REMOTE_WINFSP_CLIENT_EVENT(func, file, ret) \
if (config_.get_enable_drive_events() && \
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \
((ret) != STATUS_SUCCESS)) || \
(config_.get_event_level() >= event_level::trace))) \
event_system::instance().raise<remote_winfsp_client_event>( \
std::string{func}, file, ret)
// clang-format off
E_SIMPLE3(remote_winfsp_client_event, debug,
std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32
);
// clang-format on
remote_client::remote_client(const app_config &config)
: config_(config), packet_client_(config.get_remote_config()) {}
@ -48,6 +62,9 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
packet_client_.send(function_name, request, service_flags),
};
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name,
utils::path::create_api_path(utils::string::to_utf8(file_name)), ret);
return ret;
}
@ -68,6 +85,7 @@ auto remote_client::json_create_directory_snapshot(const std::string &path,
ret = packet::decode_json(response, json_data);
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret;
}
@ -90,6 +108,7 @@ auto remote_client::json_read_directory_snapshot(
ret = packet::decode_json(response, json_data);
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret;
}
@ -107,6 +126,7 @@ auto remote_client::json_release_directory_snapshot(
packet_client_.send(function_name, request, service_flags),
};
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
return ret;
}
@ -141,6 +161,7 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
remove_all(file_path);
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
return ret;
}
@ -165,6 +186,7 @@ auto remote_client::winfsp_close(PVOID file_desc) -> packet::error_type {
if ((ret == STATUS_SUCCESS) ||
(ret == static_cast<packet::error_type>(STATUS_INVALID_HANDLE))) {
remove_open_info(handle);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
}
}
@ -215,6 +237,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
}
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(*file_desc)), ret);
return ret;
}
@ -232,6 +256,8 @@ auto remote_client::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
};
DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -261,6 +287,8 @@ auto remote_client::winfsp_get_file_info(PVOID file_desc,
};
DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -293,6 +321,8 @@ auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
DECODE_OR_IGNORE(&response, *attributes);
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name,
utils::string::to_utf8(file_name), ret);
return ret;
}
@ -331,8 +361,9 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
auto mount_location{
utils::string::to_utf8(location),
};
event_system::instance().raise<drive_mounted>(function_name, mount_location);
event_system::instance().raise<drive_mounted>(mount_location);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
return ret;
}
@ -371,6 +402,8 @@ auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
}
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(*file_desc)), ret);
return ret;
}
@ -394,6 +427,8 @@ auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
};
DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -423,6 +458,11 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
#endif
}
if (ret != STATUS_SUCCESS) {
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
}
return ret;
}
@ -445,6 +485,8 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
ret = packet::decode_json(response, item_list);
}
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -465,6 +507,11 @@ auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name,
packet_client_.send(function_name, request, service_flags),
};
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name,
utils::path::create_api_path(utils::string::to_utf8(file_name)) + "|" +
utils::path::create_api_path(utils::string::to_utf8(new_file_name)),
ret);
return ret;
}
@ -489,6 +536,8 @@ auto remote_client::winfsp_set_basic_info(
};
DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -510,6 +559,8 @@ auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
};
DECODE_OR_IGNORE(&response, *file_info);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
return ret;
}
@ -520,8 +571,7 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
auto mount_location{
utils::string::to_utf8(location),
};
event_system::instance().raise<drive_unmount_pending>(function_name,
mount_location);
event_system::instance().raise<drive_unmount_pending>(mount_location);
packet request;
request.encode(location);
@ -529,9 +579,9 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
auto ret{
packet_client_.send(function_name, request, service_flags),
};
event_system::instance().raise<drive_unmounted>(function_name,
mount_location);
event_system::instance().raise<drive_unmounted>(mount_location);
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
return ret;
}
@ -561,6 +611,10 @@ auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
DECODE_OR_IGNORE(&response, *bytes_transferred);
DECODE_OR_IGNORE(&response, *file_info);
if (ret != STATUS_SUCCESS) {
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
function_name, get_open_file_path(to_handle(file_desc)), ret);
}
return ret;
}

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