Compare commits
145 Commits
master
...
6464c01d8b
Author | SHA1 | Date | |
---|---|---|---|
6464c01d8b | |||
58db36d628 | |||
f39c6550f2 | |||
400c97cebd | |||
a2ad258b7c | |||
c4b4fe83fb | |||
262fccf9a6 | |||
50898488f0 | |||
1acb3311b1 | |||
3fd3f85cc9 | |||
cbbd586347 | |||
57a591c51e | |||
29fb395758 | |||
b3f87e2828 | |||
7e06f810ea | |||
02e568b77a | |||
8b2bafc9f3 | |||
97e5f17049 | |||
124dc62250 | |||
5da4d4e940 | |||
b507643d23 | |||
1e25fb57f1 | |||
4d8e59f97f | |||
881778e485 | |||
3efb2b817f | |||
21d02534e5 | |||
1b11e500f3 | |||
f57bbdbb50 | |||
1c65f51ef4 | |||
f44bb6bcfc | |||
57d9884510 | |||
5da036e979 | |||
daa8b9df24 | |||
fe2a1b96b2 | |||
be678e8f9c | |||
b5ae3e4ed1 | |||
89a2d5866a | |||
5264d17ae8 | |||
1718464c60 | |||
85756ddd8c | |||
e8240948b7 | |||
77088e6608 | |||
ddbebef850 | |||
7cf636b8ed | |||
754dfc49db | |||
63b2d0e741 | |||
96ac72ae21 | |||
0bbf6b5942 | |||
74ef36956d | |||
bbe065819c | |||
3493054f1a | |||
743281497c | |||
eaa6a6f92e | |||
a25dd8178e | |||
71463bfee4 | |||
270df62dbe | |||
5bd7ded7d9 | |||
b5048a422f | |||
c27528fe73 | |||
c3978562d5 | |||
637892cff1 | |||
998a3d9d83 | |||
8ed8822625 | |||
196abaebcc | |||
653e8000ff | |||
ea362211aa | |||
a4a9d069d3 | |||
9cb7f9accf | |||
4e5454efb5 | |||
a8c3f31298 | |||
f3093c27cd | |||
4526a9d860 | |||
a1ada5aa8c | |||
1ae8b8b793 | |||
f44cc99a82 | |||
75657bec58 | |||
4fef036f10 | |||
ecb9783f4e | |||
bdf85908ca | |||
9cb3cdabb0 | |||
6cf082dfa7 | |||
1a140d4dfd | |||
1cc8571a04 | |||
cf8c631938 | |||
4cba2a16f9 | |||
7c5f074d5a | |||
a251cf6abf | |||
31f7a47889 | |||
23de2af98d | |||
2446f024ef | |||
45ddd528b2 | |||
36908f7da9 | |||
1a11d55782 | |||
e344eddbcb | |||
09da7a29a9 | |||
5b5ac0937c | |||
c69818fed6 | |||
81712e7a99 | |||
75d2d39e7c | |||
ccc4a30ad5 | |||
a9bb12015a | |||
474f90ee33 | |||
ae7d5fe284 | |||
bf700b9d59 | |||
0d4b3f5e7e | |||
67076458f0 | |||
a8479eefd1 | |||
e1eda99a72 | |||
ed4a4f0742 | |||
84e89d3b83 | |||
5e3efde376 | |||
f28e17f3e5 | |||
699ecafc22 | |||
247cc301ea | |||
bc43338127 | |||
4e86f2a7de | |||
b9fe2746e3 | |||
4fe9d09f0a | |||
777db300e1 | |||
62a303e856 | |||
ae573af89d | |||
0c41a3309e | |||
4cb3e22308 | |||
9d7d36922f | |||
3190c5f133 | |||
5fadb796d1 | |||
4a213e5ca5 | |||
9fea962563 | |||
ac6c333df3 | |||
4bbff47b6f | |||
f01daa4296 | |||
96c2f8ee1e | |||
9eb3e7a22d | |||
3c2c783683 | |||
2e24f9bb44 | |||
6bb3351cb8 | |||
6086a0ea12 | |||
b4b688d3b9 | |||
43bf3c0cb2 | |||
26897c256b | |||
a788563db6 | |||
9fb1c747a6 | |||
5982978879 | |||
5ca4584416 | |||
3eca1af971 |
@ -3,7 +3,6 @@ _mkgmtime
|
||||
_sh_denyno
|
||||
_sh_denyrd
|
||||
_sh_denyrw
|
||||
_spawnv
|
||||
aarch64
|
||||
advapi32
|
||||
armv8
|
||||
@ -115,7 +114,6 @@ googletest
|
||||
gpath
|
||||
gtest_version
|
||||
has_setxattr
|
||||
hkey
|
||||
httpapi
|
||||
httplib
|
||||
icudata
|
||||
@ -123,7 +121,6 @@ icui18n
|
||||
icuuc
|
||||
iostreams
|
||||
iphlpapi
|
||||
ipstream
|
||||
jthread
|
||||
libbitcoin
|
||||
libbitcoinsystem
|
||||
@ -131,7 +128,6 @@ libcurl
|
||||
libdsm
|
||||
libevent
|
||||
libexample
|
||||
libexpat
|
||||
libfuse3
|
||||
libgmock
|
||||
libgtest
|
||||
@ -144,13 +140,10 @@ libuuid
|
||||
libuuid_include_dirs
|
||||
libvlc
|
||||
linkflags
|
||||
localappdata
|
||||
lpbyte
|
||||
lptr
|
||||
lpwstr
|
||||
markdownlint
|
||||
mbig
|
||||
minio
|
||||
msvc
|
||||
msvcr120
|
||||
msys2
|
||||
@ -158,10 +151,8 @@ mtune
|
||||
musl-libc
|
||||
nana
|
||||
ncrypt
|
||||
nlohmann
|
||||
nlohmann_json
|
||||
nmakeprg
|
||||
nohup
|
||||
nominmax
|
||||
ntstatus
|
||||
nullptr
|
||||
@ -169,7 +160,6 @@ nuspell_version
|
||||
oleaut32
|
||||
openal_version
|
||||
openssldir
|
||||
pistream
|
||||
pkgconfig
|
||||
plarge_integer
|
||||
plex
|
||||
@ -199,7 +189,6 @@ secp256k1
|
||||
secur32
|
||||
sfml_project
|
||||
shlwapi
|
||||
skynet
|
||||
source_subdir
|
||||
spdlog
|
||||
spdlog_project
|
||||
@ -211,7 +200,6 @@ stduuid_project
|
||||
strequal
|
||||
ularge_integer
|
||||
uring
|
||||
url
|
||||
userenv
|
||||
utimens_impl
|
||||
utimensat
|
||||
|
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -1,4 +0,0 @@
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
50
CHANGELOG.md
50
CHANGELOG.md
@ -1,53 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## v2.0.5-rc
|
||||
|
||||
### Issues
|
||||
|
||||
* \#39 Create management portal in Flutter
|
||||
|
||||
### Changes from v2.0.4-rc
|
||||
|
||||
* Continue documentation updates
|
||||
* Fixed `-status` command erasing active mount information
|
||||
* Fixed overlapping HTTP REST API port's
|
||||
* Refactored/fixed instance locking
|
||||
* Removed passwords and secret key values from API calls
|
||||
* Renamed setting `ApiAuth` to `ApiPassword`
|
||||
* Require `--name,-na` option for encryption provider
|
||||
|
||||
## v2.0.4-rc
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `renterd` v2.0.0+ is now required. Prior versions will fail to mount.
|
||||
|
||||
<!-- markdownlint-disable-next-line -->
|
||||
### Issues
|
||||
|
||||
* \#35 [bug] Low frequency check is set to '0' instead of 1 hour by default
|
||||
* \#36 [bug] Max cache size bytes is set to '0' by default
|
||||
|
||||
### Changes from v2.0.3-rc
|
||||
|
||||
* Added Sia API version check prior to mounting
|
||||
* Added back `-cv` (check version) CLI option
|
||||
* Continue documentation updates
|
||||
* Fixed setting `ApiAuth` via `set_value_by_name`
|
||||
* Fixed setting `HostConfig.ApiUser` via `set_value_by_name`
|
||||
* Fixed setting `HostConfig.Path` via `set_value_by_name`
|
||||
* Fixed setting `HostConfig.Protocol` via `set_value_by_name`
|
||||
* Improved ring buffer read-ahead
|
||||
* Integrated `renterd` version 2.0.0
|
||||
* Prefer using local cache file when opening files
|
||||
* Refactored `app_config` unit tests
|
||||
* Refactored polling to be more accurate on scheduling tasks
|
||||
|
||||
## v2.0.3-rc
|
||||
|
||||
<!-- markdownlint-disable-next-line -->
|
||||
### 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
|
||||
@ -56,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
|
||||
|
@ -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}
|
||||
@ -58,10 +54,6 @@ if(PROJECT_IS_MINGW)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (PROJECT_ENABLE_V2_ERRORS)
|
||||
add_definitions(-DPROJECT_ENABLE_V2_ERRORS)
|
||||
endif()
|
||||
|
||||
include(cmake/settings.cmake)
|
||||
|
||||
include(cmake/flags.cmake)
|
||||
@ -147,7 +139,6 @@ endif()
|
||||
-DPROJECT_COPYRIGHT=${PROJECT_COPYRIGHT}
|
||||
-DPROJECT_DESC=${PROJECT_DESC}
|
||||
-DPROJECT_DIST_DIR=${PROJECT_DIST_DIR}
|
||||
-DPROJECT_ENABLE_V2_ERRORS=${PROJECT_ENABLE_V2_ERRORS}
|
||||
-DPROJECT_ENABLE_WIN32_LONG_PATH_NAMES=${PROJECT_ENABLE_WIN32_LONG_PATH_NAMES}
|
||||
-DPROJECT_ENABLE_BOOST=${PROJECT_ENABLE_BOOST}
|
||||
-DPROJECT_ENABLE_CPP_HTTPLIB=${PROJECT_ENABLE_CPP_HTTPLIB}
|
||||
@ -167,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}
|
||||
|
462
README.md
462
README.md
@ -1,456 +1,110 @@
|
||||
# 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.
|
||||
|
||||
## Contents
|
||||
|
||||
1. [Details and Features](#details-and-features)
|
||||
2. [Minimum Requirements](#minimum-requirements)
|
||||
1. [Supported Operating Systems](#supported-operating-systems)
|
||||
3. [GUI](#gui)
|
||||
4. [Usage](#usage)
|
||||
1. [Important Options](#important-options)
|
||||
2. [Sia](#sia)
|
||||
* [Sia Initial Configuration](#sia-initial-configuration)
|
||||
* [Sia Mounting](#sia-mounting)
|
||||
* [Sia Configuration File](#sia-configuration-file)
|
||||
3. [S3](#s3)
|
||||
* [S3 Initial Configuration](#s3-initial-configuration)
|
||||
* [S3 Mounting](#s3-mounting)
|
||||
* [S3 Configuration File](#s3-configuration-file)
|
||||
5. [Data Directories](#data-directories)
|
||||
1. [Linux Directories](#linux-directories)
|
||||
2. [Windows Directories](#windows-directories)
|
||||
6. [Remote Mounting](#remote-mounting)
|
||||
1. [Server Setup](#server-setup)
|
||||
* [Remote Mount Configuration File Section](#remote-mount-configuration-file-section)
|
||||
2. [Client Setup](#client-setup)
|
||||
* [Client Remote Mounting](#client-remote-mounting)
|
||||
* [Remote Mount Configuration File](#remote-mount-configuration-file)
|
||||
7. [Compiling](#compiling)
|
||||
1. [Linux Compilation](#linux-compilation)
|
||||
2. [Windows Setup](#windows-compilation)
|
||||
8. [Credits](#credits)
|
||||
9. [Developer Public Key](#developer-public-key)
|
||||
10. [Consult the Wiki for additional information](https://git.fifthgrid.com/BlockStorage/repertory/wiki)
|
||||
|
||||
## Details and Features
|
||||
|
||||
* Optimized for [Plex Media Server](https://www.plex.tv/)
|
||||
* 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) v2.0.0+ for Sia support
|
||||
* Linux requires `fusermount3`; otherwise, `repertory` must be manually compiled with `libfuse2` support
|
||||
* Windows requires the following dependencies to be installed:
|
||||
* [WinFSP 2023](https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi)
|
||||
* [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)
|
||||
|
||||
### Supported Operating Systems
|
||||
|
||||
Only 64-bit operating systems are supported
|
||||
## Supported Operating Systems
|
||||
|
||||
* Linux `arm64/aarch64`
|
||||
* Linux `amd64`
|
||||
* ~~OS X Mojave and above~~
|
||||
* Windows 64-bit 10, 11
|
||||
|
||||
## GUI
|
||||
|
||||
As of `v2.0.5-rc`, mounts can be managed using the `Repertory Management Portal`.
|
||||
To launch the portal, execute the following command:
|
||||
|
||||
* `repertory -ui`
|
||||
* The default username is `repertory`
|
||||
* The default password is `repertory`
|
||||
|
||||
After first launch, `ui.json` will be created in the appropriate data directory.
|
||||
See [Data Directories](#data-directories).
|
||||
You should modify this file directly or use the portal to change the default
|
||||
username and password.
|
||||
|
||||
### Screenshot
|
||||
|
||||
<a href="https://ibb.co/fVyJqnbF"><img src="https://i.ibb.co/fVyJqnbF/repertory-portal.png" alt="repertory-portal" border="0"></a>
|
||||
|
||||
## Usage
|
||||
|
||||
### Important Options
|
||||
### 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
|
||||
|
||||
* `-f`
|
||||
* Keep process in foreground on Linux.
|
||||
|
||||
* Display all mount utility options.
|
||||
* `--name, -na [name]`
|
||||
* Identifies a unique configuration name to support multiple mounts.
|
||||
* 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`.
|
||||
|
||||
### Sia
|
||||
|
||||
#### Sia Initial Configuration
|
||||
|
||||
* Required steps:
|
||||
* Set the appropriate bucket name and `renterd` API password in `repertory` configuration:
|
||||
* To use `default` as the bucket name and configuration name, you only need to set the `renterd` API password:
|
||||
* `repertory -set HostConfig.ApiPassword '<my password>'`
|
||||
* To specify a different bucket name while using `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>'`
|
||||
|
||||
* Optional steps:
|
||||
* Set a user name used during `renterd` basic authentication:
|
||||
* `repertory -set HostConfig.ApiUser '<my user>'`
|
||||
* `repertory --name '<my config name>' -set HostConfig.ApiUser '<my user>'`
|
||||
* Set a custom agent string (default `Sia-Agent`):
|
||||
* `repertory -set HostConfig.AgentString '<my agent>'`
|
||||
* `repertory --name '<my config name>' -set HostConfig.AgentString '<my agent>'`
|
||||
* Set the host name or IP of the `renterd` instance (default `localhost`):
|
||||
* `repertory -set HostConfig.HostNameOrIp '<my host name>'`
|
||||
* `repertory --name '<my config name>' -set HostConfig.HostNameOrIp '<my host name>'`
|
||||
* Set the `renterd` API port (default `9980`):
|
||||
* `repertory -set HostConfig.ApiPort 9981`
|
||||
* `repertory --name '<my config name>' -set HostConfig.ApiPort 9981`
|
||||
|
||||
* To verify/view all configuration options:
|
||||
* `repertory -dc`
|
||||
* `repertory --name '<my config name>' -dc`
|
||||
* Example:
|
||||
* `repertory --name default -dc`
|
||||
|
||||
#### Sia Mounting
|
||||
|
||||
* Linux:
|
||||
* Linux
|
||||
* `repertory /mnt/location`
|
||||
* `repertory --name '<my config name>' /mnt/location`
|
||||
* Example:
|
||||
* `repertory --name default /mnt/location`
|
||||
|
||||
* Windows:
|
||||
* `repertory t:`
|
||||
* `repertory --name '<my config name>' t:`
|
||||
* Example:
|
||||
* `repertory --name default t:`
|
||||
|
||||
#### Sia Configuration File
|
||||
|
||||
```json
|
||||
{
|
||||
"ApiPassword": "<random generated rpc password>",
|
||||
"ApiPort": 10000,
|
||||
"ApiUser": "repertory",
|
||||
"DatabaseType": "rocksdb",
|
||||
"DownloadTimeoutSeconds": 30,
|
||||
"EnableDownloadTimeout": true,
|
||||
"EnableDriveEvents": false,
|
||||
"EventLevel": "info",
|
||||
"EvictionDelayMinutes": 1,
|
||||
"EvictionUseAccessedTime": false,
|
||||
"HighFreqIntervalSeconds": 30,
|
||||
"HostConfig": {
|
||||
"AgentString": "Sia-Agent",
|
||||
"ApiPassword": "<renterd api password>",
|
||||
"ApiPort": 9980,
|
||||
"ApiUser": "",
|
||||
"HostNameOrIp": "localhost",
|
||||
"Path": "",
|
||||
"Protocol": "http",
|
||||
"TimeoutMs": 60000
|
||||
},
|
||||
"LowFreqIntervalSeconds": 3600,
|
||||
"MaxCacheSizeBytes": 21474836480,
|
||||
"MaxUploadCount": 5,
|
||||
"MedFreqIntervalSeconds": 120,
|
||||
"OnlineCheckRetrySeconds": 60,
|
||||
"PreferredDownloadType": "default",
|
||||
"RemoteMount": {
|
||||
"ApiPort": 20000,
|
||||
"ClientPoolSize": 20,
|
||||
"Enable": false,
|
||||
"EncryptionToken": ""
|
||||
},
|
||||
"RetryReadCount": 6,
|
||||
"RingBufferFileSize": 512,
|
||||
"SiaConfig": {
|
||||
"Bucket": "default"
|
||||
},
|
||||
"TaskWaitMs": 100,
|
||||
"Version": 1
|
||||
}
|
||||
```
|
||||
* `repertory --name default /mnt/location`
|
||||
* Windows
|
||||
* `repertory.exe t:`
|
||||
* `repertory.exe --name default t:`
|
||||
|
||||
### S3
|
||||
|
||||
#### S3 Initial Configuration
|
||||
|
||||
* Required 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`
|
||||
|
||||
#### S3 Mounting
|
||||
|
||||
* Linux:
|
||||
* `repertory -s3 --name '<my config name>' /mnt/location`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio /mnt/location`
|
||||
|
||||
* Windows:
|
||||
* `repertory -s3 --name '<my config name>' t:`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio t:`
|
||||
|
||||
#### S3 Configuration File
|
||||
|
||||
```json
|
||||
{
|
||||
"ApiPassword": "<random generated rpc password>",
|
||||
"ApiPort": 10100,
|
||||
"ApiUser": "repertory",
|
||||
"DatabaseType": "rocksdb",
|
||||
"DownloadTimeoutSeconds": 30,
|
||||
"EnableDownloadTimeout": true,
|
||||
"EnableDriveEvents": false,
|
||||
"EventLevel": "info",
|
||||
"EvictionDelayMinutes": 1,
|
||||
"EvictionUseAccessedTime": false,
|
||||
"HighFreqIntervalSeconds": 30,
|
||||
"LowFreqIntervalSeconds": 3600,
|
||||
"MaxCacheSizeBytes": 21474836480,
|
||||
"MaxUploadCount": 5,
|
||||
"MedFreqIntervalSeconds": 120,
|
||||
"OnlineCheckRetrySeconds": 60,
|
||||
"PreferredDownloadType": "default",
|
||||
"RemoteMount": {
|
||||
"ApiPort": 20100,
|
||||
"ClientPoolSize": 20,
|
||||
"Enable": false,
|
||||
"EncryptionToken": ""
|
||||
},
|
||||
"RetryReadCount": 6,
|
||||
"RingBufferFileSize": 512,
|
||||
"S3Config": {
|
||||
"AccessKey": "<my access key>",
|
||||
"Bucket": "<my bucket name>",
|
||||
"EncryptionToken": "",
|
||||
"Region": "any",
|
||||
"SecretKey": "<my secret key>",
|
||||
"TimeoutMs": 60000,
|
||||
"URL": "http://localhost:9000",
|
||||
"UsePathStyle": true,
|
||||
"UseRegionInURL": false
|
||||
},
|
||||
"TaskWaitMs": 100,
|
||||
"Version": 1
|
||||
}
|
||||
```
|
||||
|
||||
### Data Directories
|
||||
|
||||
#### Linux Directories
|
||||
|
||||
* `~/.local/repertory2/s3`
|
||||
* `~/.local/repertory2/sia`
|
||||
|
||||
#### Windows Directories
|
||||
|
||||
* `%LOCALAPPDATA%\repertory2\s3`
|
||||
* `%LOCALAPPDATA%\repertory2\sia`
|
||||
* Examples:
|
||||
* `C:\Users\Tom\AppData\Local\repertory2\s3`
|
||||
* `C:\Users\Tom\AppData\Local\repertory2\sia`
|
||||
* 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.
|
||||
|
||||
## Remote Mounting
|
||||
|
||||
`repertory` allows local mounts to be shared with other computers on your network
|
||||
or over the internet. This option is referred to as remote mounting.
|
||||
|
||||
### Server Setup
|
||||
|
||||
The following steps must be performed on the mount you wish to share with
|
||||
other systems. Changes to configuration will not take affect while a mount is
|
||||
active, so it is recommended to unmount beforehand.
|
||||
|
||||
* Required steps:
|
||||
* Enable remote mount:
|
||||
* Sia
|
||||
* `repertory -set RemoteMount.Enable true`
|
||||
* `repertory --name '<my config name>' -set RemoteMount.Enable true`
|
||||
* S3:
|
||||
* `repertory -s3 --name '<my config name>' -set RemoteMount.Enable true`
|
||||
* Set a secure encryption token:
|
||||
* Sia:
|
||||
* `repertory -set RemoteMount.EncryptionToken '<my secure password>'`
|
||||
* `repertory --name '<my config name>' -set RemoteMount.EncryptionToken '<my secure password>'`
|
||||
* S3:
|
||||
* `repertory -s3 --name '<my config name>' -set RemoteMount.EncryptionToken '<my secure password>'`
|
||||
|
||||
* Optional steps:
|
||||
* Change the port clients will use to connect to your mount:
|
||||
* Sia:
|
||||
* `repertory -set RemoteMount.ApiPort 20000`
|
||||
* `repertory --name '<my config name>' -set RemoteMount.ApiPort 20000`
|
||||
* S3:
|
||||
* `repertory -s3 --name '<my config name>' -set RemoteMount.ApiPort 20000`
|
||||
|
||||
* IMPORTANT:
|
||||
* Be sure to configure your firewall to allow incoming TCP connections on the port configured in `RemoteMount.ApiPort`.
|
||||
|
||||
#### Remote Mount Configuration File Section
|
||||
|
||||
```json
|
||||
{
|
||||
...
|
||||
"RemoteMount": {
|
||||
"ApiPort": 20000,
|
||||
"ClientPoolSize": 20,
|
||||
"Enable": true,
|
||||
"EncryptionToken": "<my secure password>"
|
||||
},
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Client Setup
|
||||
|
||||
Client configuration is provider agnostic, so there's no need to specify `-s3`
|
||||
for S3 providers.
|
||||
|
||||
* Required steps:
|
||||
* Set the encryption token to the same value configured during server setup:
|
||||
* `repertory -rm <host name or IP>:<port> -set RemoteConfig.EncryptionToken '<my secure password>'`
|
||||
* Replace `<host name or IP>` with the host name or IP of the server
|
||||
* Replace `<port>` with the value of `RemoteMount.ApiPort` used in the server configuration
|
||||
* Example:
|
||||
* `repertory -rm 192.168.1.10:20000 -set RemoteConfig.EncryptionToken '<my secure password>'`
|
||||
* `repertory -rm my.host.com:20000 -set RemoteConfig.EncryptionToken '<my secure password>'`
|
||||
|
||||
#### Client Remote Mounting
|
||||
|
||||
* Linux:
|
||||
* `repertory -rm <host name or IP>:<port> /mnt/location`
|
||||
* Example:
|
||||
* `repertory -rm 192.168.1.10:20000 /mnt/location`
|
||||
|
||||
* Windows:
|
||||
* `repertory -rm <host name or IP>:<port> t:`
|
||||
* Example:
|
||||
* `repertory -rm 192.168.1.10:20000 t:`
|
||||
|
||||
#### Remote Mount Configuration File
|
||||
|
||||
```json
|
||||
{
|
||||
"ApiPassword": "<random generated rpc password>",
|
||||
"ApiPort": 10010,
|
||||
"ApiUser": "repertory",
|
||||
"EnableDriveEvents": false,
|
||||
"EventLevel": "info",
|
||||
"RemoteConfig": {
|
||||
"ApiPort": 20000,
|
||||
"EncryptionToken": "<my secure password>",
|
||||
"HostNameOrIp": "192.168.1.10",
|
||||
"MaxConnections": 20,
|
||||
"ReceiveTimeoutMs": 120000,
|
||||
"SendTimeoutMs": 30000
|
||||
},
|
||||
"TaskWaitMs": 100,
|
||||
"Version": 1
|
||||
}
|
||||
```
|
||||
* Linux
|
||||
* `repertory --name storj -s3 /mnt/location`
|
||||
* Windows
|
||||
* `repertory.exe --name storj -s3 t:`
|
||||
|
||||
## Compiling
|
||||
|
||||
Successful compilation will result in all files required for execution to be placed
|
||||
in the `dist/` directory
|
||||
|
||||
### Linux Compilation
|
||||
|
||||
* Ensure `docker` is installed
|
||||
* For x86_64:
|
||||
* RelWithDebInfo: `scripts/make_unix.sh`
|
||||
* Release: `scripts/make_unix.sh x86_64 Release`
|
||||
* Debug: `scripts/make_unix.sh x86_64 Debug`
|
||||
|
||||
* For aarch64:
|
||||
* RelWithDebInfo: `scripts/make_unix.sh aarch64`
|
||||
* Release: `scripts/make_unix.sh aarch64 Release`
|
||||
* Debug: `scripts/make_unix.sh aarch64 Debug`
|
||||
|
||||
### Windows Compilation
|
||||
|
||||
* OFFICIAL: Cross-compiling on Linux
|
||||
* Successful compilation will result in all required files being placed in the `dist/` directory
|
||||
* Linux
|
||||
* Ensure `docker` is installed
|
||||
* RelWithDebInfo: `scripts/make_win32.sh`
|
||||
* Release: `scripts/make_win32.sh x86_64 Release`
|
||||
* Debug: `scripts/make_win32.sh x86_64 Debug`
|
||||
|
||||
* UNOFFICIAL: Compiling on Windows
|
||||
* Ensure latest [MSYS2](https://www.msys2.org/) is installed
|
||||
* RelWithDebInfo: `scripts\make_win32.cmd`
|
||||
* Release: `scripts\make_win32.cmd x86_64 Release`
|
||||
* Debug: `scripts\make_win32.cmd x86_64 Debug`
|
||||
* For x86_64:
|
||||
* RelWithDebInfo: `scripts/make_unix.sh`
|
||||
* Release: `scripts/make_unix.sh x86_64 Release`
|
||||
* Debug: `scripts/make_unix.sh x86_64 Debug`
|
||||
* For aarch64:
|
||||
* RelWithDebInfo: `scripts/make_unix.sh aarch64`
|
||||
* Release: `scripts/make_unix.sh aarch64 Release`
|
||||
* Debug: `scripts/make_unix.sh aarch64 Debug`
|
||||
* Windows
|
||||
* OFFICIAL: Cross-compiling on Linux
|
||||
* Ensure `docker` is installed
|
||||
* RelWithDebInfo: `scripts/make_win32.sh`
|
||||
* Release: `scripts/make_win32.sh x86_64 Release`
|
||||
* Debug: `scripts/make_win32.sh x86_64 Debug`
|
||||
* UNOFFICIAL: Compiling on Windows
|
||||
* Ensure latest [MSYS2](https://www.msys2.org/) is installed
|
||||
* RelWithDebInfo: `scripts\make_win32.cmd`
|
||||
* Release: `scripts\make_win32.cmd x86_64 Release`
|
||||
* Debug: `scripts\make_win32.cmd x86_64 Debug`
|
||||
|
||||
## 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/)
|
||||
|
@ -1,20 +1,20 @@
|
||||
set(BINUTILS_HASH b53606f443ac8f01d1d5fc9c39497f2af322d99e14cea5c0b4b124d630379365)
|
||||
set(BOOST2_HASH 7bd7ddceec1a1dfdcbdb3e609b60d01739c38390a5f956385a12f3122049f0ca)
|
||||
set(BOOST_HASH f55c340aa49763b1925ccf02b2e83f35fdcf634c9d5164a2acb87540173c741d)
|
||||
set(CPP_HTTPLIB_HASH c9b9e0524666e1cd088f0874c57c1ce7c0eaa8552f9f4e15c755d5201fc8c608)
|
||||
set(CURL_HASH 6edc063d1ebaf9cf3b3b46e9fef2f3cd8932694989ecd43d005d6e828426d09f)
|
||||
set(CPP_HTTPLIB_HASH 405abd8170f2a446fc8612ac635d0db5947c0d2e156e32603403a4496255ff00)
|
||||
set(CURL_HASH 5a231145114589491fc52da118f9c7ef8abee885d1cb1ced99c7290e9a352f07)
|
||||
set(EXPAT_HASH 372b18f6527d162fa9658f1c74d22a37429b82d822f5a1e1fc7e00f6045a06a2)
|
||||
set(GCC_HASH 7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293)
|
||||
set(GTEST_HASH 78c676fc63881529bf97bf9d45948d905a66833fbfa5318ea2cd7478cb98f399)
|
||||
set(GTEST_HASH 7b42b4d6ed48810c5362c265a17faebe90dc2373c885e5216439d37927f02926)
|
||||
set(ICU_HASH a2c443404f00098e9e90acf29dc318e049d2dc78d9ae5f46efb261934a730ce2)
|
||||
set(JSON_HASH 0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406)
|
||||
set(LIBSODIUM_HASH 8e5aeca07a723a27bbecc3beef14b0068d37e7fc0e97f51b3f1c82d2a58005c1)
|
||||
set(MINGW_HASH cc41898aac4b6e8dd5cffd7331b9d9515b912df4420a3a612b5ea2955bbeed2f)
|
||||
set(OPENSSL_HASH 002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3)
|
||||
set(MINGW_HASH 30e5aad2c48dd318150f79cff47661232c4175876d6b4d6b270961cf2b49a48b)
|
||||
set(OPENSSL_HASH e15dda82fe2fe8139dc2ac21a36d4ca01d5313c75f99f46c4e8a27709b7294bf)
|
||||
set(PKG_CONFIG_HASH 6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591)
|
||||
set(PUGIXML_HASH 655ade57fa703fb421c2eb9a0113b5064bddb145d415dd1f88c79353d90d511a)
|
||||
set(ROCKSDB_HASH fdccab16133c9d927a183c2648bcea8d956fb41eb1df2aacaa73eb0b95e43724)
|
||||
set(SPDLOG_HASH 25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc)
|
||||
set(SQLITE_HASH 6cebd1d8403fc58c30e93939b246f3e6e58d0765a5cd50546f16c00fd805d2c3)
|
||||
set(PUGIXML_HASH 2f10e276870c64b1db6809050a75e11a897a8d7456c4be5c6b2e35a11168a015)
|
||||
set(ROCKSDB_HASH 9b810c81731835fda0d4bbdb51d3199d901fa4395733ab63752d297da84c5a47)
|
||||
set(SPDLOG_HASH 9962648c9b4f1a7bbc76fd8d9172555bad1871fdb14ff4f842ef87949682caa5)
|
||||
set(SQLITE_HASH 77823cb110929c2bcb0f5d48e4833b5c59a8a6e40cdea3936b99e199dbbe5784)
|
||||
set(STDUUID_HASH b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3)
|
||||
set(ZLIB_HASH 17e88863f3600672ab49182f217281b6fc4d3c762bde361935e436a95214d05c)
|
||||
|
@ -120,11 +120,11 @@ if(PROJECT_ENABLE_BOOST)
|
||||
--with-libraries=atomic,chrono,date_time,filesystem,iostreams,locale,log,program_options,random,regex,serialization,system,test,thread
|
||||
BUILD_COMMAND
|
||||
./b2
|
||||
-j$ENV{CMAKE_BUILD_PARALLEL_LEVEL}
|
||||
-j1
|
||||
${BOOST_BUILD_ARGS}
|
||||
INSTALL_COMMAND
|
||||
./b2
|
||||
-j$ENV{CMAKE_BUILD_PARALLEL_LEVEL}
|
||||
-j1
|
||||
${BOOST_BUILD_ARGS}
|
||||
install
|
||||
)
|
||||
|
@ -15,13 +15,10 @@ if(PROJECT_ENABLE_CPP_HTTPLIB)
|
||||
CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
||||
-DBUILD_SHARED_LIBS=${PROJECT_BUILD_SHARED_LIBS}
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
-DHTTPLIB_REQUIRE_BROTLI=OFF
|
||||
-DHTTPLIB_REQUIRE_OPENSSL=ON
|
||||
-DHTTPLIB_REQUIRE_OPENSSL=${PROJECT_ENABLE_OPENSSL}
|
||||
-DHTTPLIB_REQUIRE_ZLIB=ON
|
||||
-DHTTPLIB_REQUIRE_BROTLI=OFF
|
||||
-DHTTPLIB_TEST=OFF
|
||||
-DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF
|
||||
-DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=ON
|
||||
-DHTTPLIB_USE_ZLIB_IF_AVAILABLE=ON
|
||||
-DOPENSSL_USE_STATIC_LIBS=${OPENSSL_USE_STATIC_LIBS}
|
||||
)
|
||||
|
||||
|
@ -18,9 +18,8 @@ if(PROJECT_ENABLE_CURL)
|
||||
URL ${PROJECT_3RD_PARTY_DIR}/curl-${CURL_VERSION}.tar.gz
|
||||
URL_HASH SHA256=${CURL_HASH}
|
||||
LIST_SEPARATOR |
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} --build . -- -j$ENV{CMAKE_BUILD_PARALLEL_LEVEL}
|
||||
CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
||||
CMAKE_ARGS
|
||||
${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
||||
-DBUILD_CURL_EXE=OFF
|
||||
-DBUILD_LIBCURL_DOCS=OFF
|
||||
-DBUILD_MISC_DOCS=OFF
|
||||
@ -29,7 +28,6 @@ if(PROJECT_ENABLE_CURL)
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
-DBUILD_TESTING=OFF
|
||||
-DCURL_BROTLI=OFF
|
||||
-DCURL_CA_BUNDLE=./cacert.pem
|
||||
-DCURL_CA_FALLBACK=ON
|
||||
-DCURL_DISABLE_LDAP=ON
|
||||
|
@ -9,8 +9,6 @@ if(PROJECT_ENABLE_ROCKSDB)
|
||||
URL ${PROJECT_3RD_PARTY_DIR}/rocksdb-${ROCKSDB_VERSION}.tar.gz
|
||||
URL_HASH SHA256=${ROCKSDB_HASH}
|
||||
LIST_SEPARATOR |
|
||||
BUILD_COMMAND
|
||||
${CMAKE_COMMAND} --build . -- -j$ENV{CMAKE_BUILD_PARALLEL_LEVEL}
|
||||
CMAKE_ARGS ${PROJECT_EXTERNAL_CMAKE_FLAGS}
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DBUILD_STATIC_LIBS=ON
|
||||
|
@ -2,7 +2,7 @@ if(PROJECT_ENABLE_SQLITE)
|
||||
if(PROJECT_BUILD)
|
||||
add_definitions(-DPROJECT_ENABLE_SQLITE)
|
||||
if (PROJECT_IS_MINGW AND NOT PROJECT_IS_MINGW_UNIX)
|
||||
pkg_check_modules(SQLITE3 REQUIRED sqlite3)
|
||||
pkg_check_modules(SQLITE3 REQUIRED sqlite3>=${SQLITE2_VERSION})
|
||||
include_directories(SYSTEM BEFORE ${SQLITE3_INCLUDE_DIRS})
|
||||
link_libraries(${SQLITE3_LIBRARIES})
|
||||
else()
|
||||
|
@ -1,28 +1,28 @@
|
||||
set(BINUTILS_VERSION 2.43)
|
||||
set(BOOST2_MAJOR_VERSION 1)
|
||||
set(BOOST2_MINOR_VERSION 76)
|
||||
set(BOOST2_PATCH_VERSION 0)
|
||||
set(BOOST_MAJOR_VERSION 1)
|
||||
set(BOOST_MINOR_VERSION 87)
|
||||
set(BOOST_PATCH_VERSION 0)
|
||||
set(CPP_HTTPLIB_VERSION 0.19.0)
|
||||
set(CURL2_VERSION 8_12_1)
|
||||
set(CURL_VERSION 8.12.1)
|
||||
set(EXPAT2_VERSION 2_6_4)
|
||||
set(BOOST2_MAJOR_VERSION 1)
|
||||
set(BOOST2_MINOR_VERSION 76)
|
||||
set(BOOST2_PATCH_VERSION 0)
|
||||
set(CPP_HTTPLIB_VERSION 0.18.1)
|
||||
set(CURL_VERSION 8.11.0)
|
||||
set(CURL2_VERSION 8_11_0)
|
||||
set(EXPAT_VERSION 2.6.4)
|
||||
set(EXPAT2_VERSION 2_6_4)
|
||||
set(GCC_VERSION 14.2.0)
|
||||
set(GTEST_VERSION 1.16.0)
|
||||
set(GTEST_VERSION 1.15.2)
|
||||
set(ICU_VERSION 76-1)
|
||||
set(JSON_VERSION 3.11.3)
|
||||
set(LIBSODIUM_VERSION 1.0.20)
|
||||
set(MESA_VERSION 23.3.3)
|
||||
set(MINGW_VERSION 12.0.0)
|
||||
set(OPENSSL_VERSION 3.4.1)
|
||||
set(OPENSSL_VERSION 3.4.0)
|
||||
set(PKG_CONFIG_VERSION 0.29.2)
|
||||
set(PUGIXML_VERSION 1.15)
|
||||
set(ROCKSDB_VERSION 9.10.0)
|
||||
set(SPDLOG_VERSION 1.15.1)
|
||||
set(SQLITE2_VERSION 3.49.1)
|
||||
set(SQLITE_VERSION 3490100)
|
||||
set(PUGIXML_VERSION 1.14)
|
||||
set(ROCKSDB_VERSION 9.7.4)
|
||||
set(SPDLOG_VERSION 1.15.0)
|
||||
set(SQLITE_VERSION 3460100)
|
||||
set(SQLITE2_VERSION 3.46.1)
|
||||
set(STDUUID_VERSION 1.2.3)
|
||||
set(ZLIB_VERSION 1.3.1)
|
||||
|
@ -10,7 +10,7 @@ PROJECT_DESC="Mount utility for Sia and S3"
|
||||
|
||||
PROJECT_MAJOR_VERSION=2
|
||||
PROJECT_MINOR_VERSION=0
|
||||
PROJECT_REVISION_VERSION=5
|
||||
PROJECT_REVISION_VERSION=3
|
||||
PROJECT_RELEASE_NUM=0
|
||||
PROJECT_RELEASE_ITER=rc
|
||||
|
||||
@ -19,8 +19,6 @@ PROJECT_APP_LIST=(${PROJECT_NAME})
|
||||
PROJECT_PRIVATE_KEY=${DEVELOPER_PRIVATE_KEY}
|
||||
PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY}
|
||||
|
||||
PROJECT_FLUTTER_BASE_HREF="/ui/"
|
||||
|
||||
PROJECT_ENABLE_WIN32_LONG_PATH_NAMES=OFF
|
||||
|
||||
PROJECT_ENABLE_BACKWARD_CPP=OFF
|
||||
|
@ -1,5 +1,4 @@
|
||||
#comment
|
||||
FROM arm64v8/alpine:3.21.3
|
||||
FROM arm64v8/alpine:3.21.0
|
||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||
CMD bash
|
||||
|
||||
@ -31,7 +30,6 @@ RUN apk add \
|
||||
gflags \
|
||||
gflags-dev \
|
||||
git \
|
||||
git-lfs \
|
||||
icu-dev \
|
||||
icu-libs \
|
||||
icu-static \
|
||||
|
@ -1,5 +1,4 @@
|
||||
#comment
|
||||
FROM alpine:3.21.3
|
||||
FROM alpine:3.21.0
|
||||
MAINTAINER Scott E. Graves <scott.e.graves@protonmail.com>
|
||||
CMD bash
|
||||
|
||||
@ -31,7 +30,6 @@ RUN apk add \
|
||||
gflags \
|
||||
gflags-dev \
|
||||
git \
|
||||
git-lfs \
|
||||
icu-dev \
|
||||
icu-libs \
|
||||
icu-static \
|
||||
|
@ -1,48 +0,0 @@
|
||||
FROM debian:latest
|
||||
|
||||
ARG UID=0
|
||||
ARG GID=0
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y \
|
||||
bash \
|
||||
curl \
|
||||
fonts-droid-fallback \
|
||||
gdb \
|
||||
git \
|
||||
lib32stdc++6 \
|
||||
libgconf-2-4 \
|
||||
libglu1-mesa \
|
||||
libstdc++6 \
|
||||
python3 \
|
||||
unzip \
|
||||
wget
|
||||
RUN apt-get clean
|
||||
|
||||
RUN git clone https://github.com/flutter/flutter.git /flutter
|
||||
RUN git config --system --add safe.directory /flutter
|
||||
|
||||
ENV PATH="/flutter/bin:/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
||||
|
||||
RUN flutter doctor -v
|
||||
RUN flutter channel master
|
||||
RUN flutter upgrade
|
||||
RUN flutter --disable-analytics
|
||||
|
||||
RUN flutter config --no-analytics
|
||||
RUN flutter config --enable-web
|
||||
RUN flutter config --no-cli-animations
|
||||
|
||||
RUN mkdir /nonexistent
|
||||
RUN chown -R $UID:$GID /nonexistent
|
||||
|
||||
RUN mkdir /.config
|
||||
RUN chown -R $UID:$GID /.config
|
||||
|
||||
RUN mkdir /.dart-tool
|
||||
RUN chown -R $UID:$GID /.dart-tool
|
||||
|
||||
RUN mkdir /.pub-cache
|
||||
RUN chown -R $UID:$GID /.pub-cache
|
||||
|
||||
RUN chown -R $UID:$GID /flutter
|
@ -1,5 +1,5 @@
|
||||
#comment
|
||||
FROM alpine:3.21.3
|
||||
FROM alpine:3.21.0
|
||||
|
||||
RUN apk update
|
||||
RUN apk upgrade
|
||||
@ -18,7 +18,6 @@ RUN apk add \
|
||||
gcc \
|
||||
gettext \
|
||||
git \
|
||||
git-lfs \
|
||||
gmp \
|
||||
gmp-dev \
|
||||
gperf \
|
||||
@ -680,7 +679,6 @@ RUN if [ -f "/3rd_party/curl-${MY_CURL_VERSION}.tar.gz" ]; then \
|
||||
-DCMAKE_CXX_STANDARD=${MY_CXX_STANDARD} \
|
||||
-DCMAKE_INSTALL_PREFIX=${MY_MINGW_DIR} \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${MY_TOOLCHAIN_FILE_CMAKE} \
|
||||
-DCURL_BROTLI=OFF \
|
||||
-DCURL_CA_BUNDLE=./cacert.pem \
|
||||
-DCURL_CA_FALLBACK=ON \
|
||||
-DCURL_DISABLE_LDAP=ON \
|
||||
@ -716,9 +714,6 @@ RUN if [ -f "/3rd_party/cpp-httplib-${MY_CPP_HTTPLIB_VERSION}.tar.gz" ]; then \
|
||||
-DHTTPLIB_REQUIRE_OPENSSL=ON \
|
||||
-DHTTPLIB_REQUIRE_ZLIB=ON \
|
||||
-DHTTPLIB_TEST=OFF \
|
||||
-DHTTPLIB_USE_BROTLI_IF_AVAILABLE=OFF \
|
||||
-DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=YES \
|
||||
-DHTTPLIB_USE_ZLIB_IF_AVAILABLE=ON \
|
||||
&& make -j${MY_NUM_JOBS} \
|
||||
&& make install \
|
||||
&& cd ${MY_WORKDIR} \
|
||||
|
@ -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"
|
||||
|
||||
@ -43,7 +44,8 @@ public:
|
||||
[[nodiscard]] static auto default_remote_api_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto default_rpc_port() -> 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;
|
||||
@ -51,8 +53,6 @@ public:
|
||||
[[nodiscard]] static auto get_provider_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
|
||||
[[nodiscard]] static auto get_root_data_directory() -> std::string;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto get_stop_requested() -> bool;
|
||||
|
||||
@ -72,7 +72,7 @@ public:
|
||||
|
||||
private:
|
||||
provider_type prov_;
|
||||
atomic<std::string> api_password_;
|
||||
atomic<std::string> api_auth_;
|
||||
std::atomic<std::uint16_t> api_port_;
|
||||
atomic<std::string> api_user_;
|
||||
std::atomic<bool> config_changed_;
|
||||
@ -92,6 +92,7 @@ private:
|
||||
std::atomic<std::uint8_t> max_upload_count_;
|
||||
std::atomic<std::uint16_t> med_freq_interval_secs_;
|
||||
std::atomic<std::uint16_t> online_check_retry_secs_;
|
||||
std::atomic<std::uint16_t> orphaned_file_retention_days_;
|
||||
std::atomic<download_type> preferred_download_type_;
|
||||
std::atomic<std::uint16_t> retry_read_count_;
|
||||
std::atomic<std::uint16_t> ring_buffer_file_size_;
|
||||
@ -122,7 +123,7 @@ private:
|
||||
auto set_value(dest &dst, const source &src) -> bool;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_api_password() const -> std::string;
|
||||
[[nodiscard]] auto get_api_auth() const -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_api_port() const -> std::uint16_t;
|
||||
|
||||
@ -172,6 +173,8 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_online_check_retry_secs() const -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] auto get_orphaned_file_retention_days() const -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] auto get_preferred_download_type() const -> download_type;
|
||||
|
||||
[[nodiscard]] auto get_provider_type() const -> provider_type;
|
||||
@ -193,14 +196,11 @@ public:
|
||||
[[nodiscard]] auto get_value_by_name(const std::string &name) const
|
||||
-> std::string;
|
||||
|
||||
[[nodiscard]] auto get_raw_value_by_name(const std::string &name) const
|
||||
-> std::string;
|
||||
|
||||
[[nodiscard]] auto get_version() const -> std::uint64_t;
|
||||
|
||||
void save();
|
||||
|
||||
void set_api_password(const std::string &value);
|
||||
void set_api_auth(const std::string &value);
|
||||
|
||||
void set_api_port(std::uint16_t value);
|
||||
|
||||
@ -240,6 +240,8 @@ public:
|
||||
|
||||
void set_online_check_retry_secs(std::uint16_t value);
|
||||
|
||||
void set_orphaned_file_retention_days(std::uint16_t value);
|
||||
|
||||
void set_preferred_download_type(const download_type &value);
|
||||
|
||||
void set_remote_config(remote::remote_config value);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ using json = nlohmann::json;
|
||||
inline constexpr const std::string_view REPERTORY = "repertory";
|
||||
inline constexpr const std::wstring_view REPERTORY_W = L"repertory";
|
||||
|
||||
inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 2ULL;
|
||||
inline constexpr const std::uint64_t REPERTORY_CONFIG_VERSION = 0ULL;
|
||||
inline constexpr const std::string_view REPERTORY_DATA_NAME = "repertory2";
|
||||
inline constexpr const std::string_view REPERTORY_MIN_REMOTE_VERSION = "2.0.0";
|
||||
|
||||
@ -221,25 +221,44 @@ using WCHAR = wchar_t;
|
||||
|
||||
#define MAX_PATH 260
|
||||
|
||||
#define STATUS_SUCCESS std::uint32_t{0U}
|
||||
#define STATUS_ACCESS_DENIED std::uint32_t{0xC0000022L}
|
||||
#define STATUS_DEVICE_BUSY std::uint32_t{0x80000011L}
|
||||
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES std::uint32_t{0xC0000468L}
|
||||
#define STATUS_DIRECTORY_NOT_EMPTY std::uint32_t{0xC0000101L}
|
||||
#define STATUS_FILE_IS_A_DIRECTORY std::uint32_t{0xC00000BAL}
|
||||
#define STATUS_FILE_TOO_LARGE std::uint32_t{0xC0000904L}
|
||||
#define STATUS_INSUFFICIENT_RESOURCES std::uint32_t{0xC000009AL}
|
||||
#define STATUS_INTERNAL_ERROR std::uint32_t{0xC00000E5L}
|
||||
#define STATUS_INVALID_ADDRESS std::uint32_t{0xC0000141L}
|
||||
#define STATUS_INVALID_HANDLE std::uint32_t{0xC0000006L}
|
||||
#define STATUS_INVALID_IMAGE_FORMAT std::uint32_t{0xC000007BL}
|
||||
#define STATUS_INVALID_PARAMETER std::uint32_t{0xC000000DL}
|
||||
#define STATUS_NO_MEMORY std::uint32_t{0xC0000017L}
|
||||
#define STATUS_NOT_IMPLEMENTED std::uint32_t{0xC0000002L}
|
||||
#define STATUS_OBJECT_NAME_EXISTS std::uint32_t{0x40000000L}
|
||||
#define STATUS_OBJECT_NAME_NOT_FOUND std::uint32_t{0xC0000034L}
|
||||
#define STATUS_OBJECT_PATH_INVALID std::uint32_t{0xC0000039L}
|
||||
#define STATUS_UNEXPECTED_IO_ERROR std::uint32_t{0xC00000E9L}
|
||||
#define STATUS_SUCCESS \
|
||||
std::uint32_t { 0U }
|
||||
#define STATUS_ACCESS_DENIED \
|
||||
std::uint32_t { 0xC0000022L }
|
||||
#define STATUS_DEVICE_BUSY \
|
||||
std::uint32_t { 0x80000011L }
|
||||
#define STATUS_DEVICE_INSUFFICIENT_RESOURCES \
|
||||
std::uint32_t { 0xC0000468L }
|
||||
#define STATUS_DIRECTORY_NOT_EMPTY \
|
||||
std::uint32_t { 0xC0000101L }
|
||||
#define STATUS_FILE_IS_A_DIRECTORY \
|
||||
std::uint32_t { 0xC00000BAL }
|
||||
#define STATUS_FILE_TOO_LARGE \
|
||||
std::uint32_t { 0xC0000904L }
|
||||
#define STATUS_INSUFFICIENT_RESOURCES \
|
||||
std::uint32_t { 0xC000009AL }
|
||||
#define STATUS_INTERNAL_ERROR \
|
||||
std::uint32_t { 0xC00000E5L }
|
||||
#define STATUS_INVALID_ADDRESS \
|
||||
std::uint32_t { 0xC0000141L }
|
||||
#define STATUS_INVALID_HANDLE \
|
||||
std::uint32_t { 0xC0000006L }
|
||||
#define STATUS_INVALID_IMAGE_FORMAT \
|
||||
std::uint32_t { 0xC000007BL }
|
||||
#define STATUS_INVALID_PARAMETER \
|
||||
std::uint32_t { 0xC000000DL }
|
||||
#define STATUS_NO_MEMORY \
|
||||
std::uint32_t { 0xC0000017L }
|
||||
#define STATUS_NOT_IMPLEMENTED \
|
||||
std::uint32_t { 0xC0000002L }
|
||||
#define STATUS_OBJECT_NAME_EXISTS \
|
||||
std::uint32_t { 0x40000000L }
|
||||
#define STATUS_OBJECT_NAME_NOT_FOUND \
|
||||
std::uint32_t { 0xC0000034L }
|
||||
#define STATUS_OBJECT_PATH_INVALID \
|
||||
std::uint32_t { 0xC0000039L }
|
||||
#define STATUS_UNEXPECTED_IO_ERROR \
|
||||
std::uint32_t { 0xC00000E9L }
|
||||
|
||||
#define CONVERT_STATUS_NOT_IMPLEMENTED(e) \
|
||||
((std::uint32_t(e) == STATUS_NOT_IMPLEMENTED) ? -ENOTSUP : e)
|
||||
|
@ -19,22 +19,23 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_I_EVENT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_I_EVENT_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class i_event {
|
||||
INTERFACE_SETUP(i_event);
|
||||
// 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
|
||||
);
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto get_event_level() const -> event_level = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_name() const -> std::string_view = 0;
|
||||
|
||||
[[nodiscard]] virtual auto get_single_line() const -> std::string = 0;
|
||||
};
|
||||
E_SIMPLE1(fuse_args_parsed, info,
|
||||
std::string, arguments, args, E_FROM_STRING
|
||||
);
|
||||
// clang-format on
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
||||
#endif // REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
|
@ -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_;
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "comm/packet/packet_client.hpp"
|
||||
#include "drives/remote/remote_open_file_table.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "types/remote.hpp"
|
||||
|
||||
namespace repertory {
|
||||
class app_config;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -19,43 +19,41 @@
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_CLI_UI_HPP_
|
||||
#define REPERTORY_INCLUDE_CLI_UI_HPP_
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
#include "ui/handlers.hpp"
|
||||
#include "ui/mgmt_app_config.hpp"
|
||||
#include "utils/cli_utils.hpp"
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/string.hpp"
|
||||
|
||||
namespace repertory::cli::actions {
|
||||
[[nodiscard]] inline auto
|
||||
ui(std::vector<const char *> args, const std::string & /*data_directory*/,
|
||||
const provider_type & /* prov */, const std::string & /* unique_id */,
|
||||
std::string /* user */, std::string /* password */) -> exit_code {
|
||||
namespace repertory {
|
||||
class event {
|
||||
protected:
|
||||
event() = default;
|
||||
|
||||
ui::mgmt_app_config config{};
|
||||
event(const std::stringstream &ss, json j)
|
||||
: ss_(ss.str()), j_(std::move(j)) {}
|
||||
|
||||
std::string data;
|
||||
auto res = utils::cli::parse_string_option(
|
||||
args, utils::cli::options::ui_port_option, data);
|
||||
if (res == exit_code::success && not data.empty()) {
|
||||
config.set_api_port(utils::string::to_uint16(data));
|
||||
}
|
||||
public:
|
||||
event(const event &) = delete;
|
||||
event(event &&) = delete;
|
||||
auto operator=(const event &) -> event & = delete;
|
||||
auto operator=(event &&) -> event & = delete;
|
||||
virtual ~event() = default;
|
||||
|
||||
if (not utils::file::change_to_process_directory()) {
|
||||
return exit_code::ui_mount_failed;
|
||||
}
|
||||
protected:
|
||||
std::stringstream ss_;
|
||||
json j_{};
|
||||
|
||||
httplib::Server server;
|
||||
if (not server.set_mount_point("/ui", "./web")) {
|
||||
return exit_code::ui_mount_failed;
|
||||
}
|
||||
public:
|
||||
[[nodiscard]] virtual auto clone() const -> std::shared_ptr<event> = 0;
|
||||
|
||||
ui::handlers handlers(&config, &server);
|
||||
return exit_code::success;
|
||||
}
|
||||
} // namespace repertory::cli::actions
|
||||
[[nodiscard]] virtual auto get_event_level() const -> event_level = 0;
|
||||
|
||||
#endif // REPERTORY_INCLUDE_CLI_UI_HPP_
|
||||
[[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_
|
@ -22,120 +22,211 @@
|
||||
#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 {
|
||||
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_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(event, callback) \
|
||||
#define E_SUBSCRIBE(name, callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
event::name, [this](const i_event &evt) { \
|
||||
callback(dynamic_cast<const event &>(evt)); \
|
||||
#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 i_event &evt) { callback(evt); }))
|
||||
[this](const event &evt) { callback(evt); }))
|
||||
} // namespace repertory
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||
|
295
repertory/librepertory/include/events/events.hpp
Normal file
295
repertory/librepertory/include/events/events.hpp
Normal 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_
|
249
repertory/librepertory/include/events/t_event_system.hpp
Normal file
249
repertory/librepertory/include/events/t_event_system.hpp
Normal 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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_PRODIVER_INVALID_VERSION_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_PRODIVER_INVALID_VERSION_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct provider_invalid_version final : public i_event {
|
||||
provider_invalid_version() = default;
|
||||
provider_invalid_version(std::string_view function_name_,
|
||||
std::string required_version_,
|
||||
std::string returned_version_)
|
||||
: function_name(std::string(function_name_)),
|
||||
required_version(std::move(required_version_)),
|
||||
returned_version(std::move(returned_version_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::error};
|
||||
static constexpr const std::string_view name{"provider_invalid_version"};
|
||||
|
||||
std::string function_name;
|
||||
std::string required_version;
|
||||
std::string returned_version;
|
||||
|
||||
[[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|{}|required|{}|returned|{}", name,
|
||||
function_name, required_version, returned_version);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::provider_invalid_version> {
|
||||
static void to_json(json &data,
|
||||
const repertory::provider_invalid_version &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["required_version"] = value.required_version;
|
||||
data["returned_version"] = value.returned_version;
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
repertory::provider_invalid_version &value) {
|
||||
data.at("function_name").get_to(value.function_name);
|
||||
data.at("required_version").get_to(value.required_version);
|
||||
data.at("returned_version").get_to(value.returned_version);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_PRODIVER_INVALID_VERSION_HPP_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
@ -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_
|
86
repertory/librepertory/include/file_manager/events.hpp
Normal file
86
repertory/librepertory/include/file_manager/events.hpp
Normal 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_
|
@ -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"
|
||||
|
@ -22,13 +22,6 @@
|
||||
#ifndef REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||
#define REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
[[nodiscard]] auto create_lock_id(provider_type prov,
|
||||
std::string_view unique_id)->std::string;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include "platform/win32_platform.hpp"
|
||||
#include "utils/windows.hpp"
|
||||
|
@ -30,45 +30,38 @@ class i_provider;
|
||||
|
||||
class lock_data final {
|
||||
public:
|
||||
lock_data(provider_type prov, std::string_view unique_id);
|
||||
explicit lock_data(const provider_type &pt, std::string unique_id /*= ""*/);
|
||||
|
||||
lock_data(const lock_data &) = delete;
|
||||
lock_data(lock_data &&) = delete;
|
||||
|
||||
auto operator=(const lock_data &) -> lock_data & = delete;
|
||||
auto operator=(lock_data &&) -> lock_data & = delete;
|
||||
lock_data();
|
||||
|
||||
~lock_data();
|
||||
|
||||
private:
|
||||
std::string mutex_id_;
|
||||
|
||||
private:
|
||||
int handle_{};
|
||||
int lock_status_{EWOULDBLOCK};
|
||||
const provider_type pt_;
|
||||
const std::string unique_id_;
|
||||
const std::string mutex_id_;
|
||||
int lock_fd_;
|
||||
int lock_status_ = EWOULDBLOCK;
|
||||
|
||||
private:
|
||||
[[nodiscard]] static auto get_state_directory() -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_lock_data_file() const -> std::string;
|
||||
[[nodiscard]] static auto get_lock_data_file() -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_lock_file() const -> std::string;
|
||||
[[nodiscard]] auto get_lock_file() -> std::string;
|
||||
|
||||
private:
|
||||
[[nodiscard]] static auto wait_for_lock(int handle,
|
||||
std::uint8_t retry_count = 30U)
|
||||
-> int;
|
||||
[[nodiscard]] static auto
|
||||
wait_for_lock(int fd, std::uint8_t retry_count = 30u) -> int;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_mount_state(json &mount_state) -> bool;
|
||||
|
||||
[[nodiscard]] auto grab_lock(std::uint8_t retry_count = 30U) -> lock_result;
|
||||
|
||||
void release();
|
||||
[[nodiscard]] auto grab_lock(std::uint8_t retry_count = 30u) -> lock_result;
|
||||
|
||||
[[nodiscard]] auto set_mount_state(bool active,
|
||||
std::string_view mount_location, int pid)
|
||||
-> bool;
|
||||
const std::string &mount_location,
|
||||
int pid) -> bool;
|
||||
};
|
||||
|
||||
[[nodiscard]] auto create_meta_attributes(
|
||||
@ -83,5 +76,5 @@ public:
|
||||
const api_file &file) -> api_error;
|
||||
} // namespace repertory
|
||||
|
||||
#endif // !defined(_WIN32)
|
||||
#endif // _WIN32
|
||||
#endif // REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
@ -30,32 +31,43 @@ class i_provider;
|
||||
|
||||
class lock_data final {
|
||||
public:
|
||||
explicit lock_data(provider_type prov, std::string unique_id);
|
||||
lock_data(const lock_data &) = delete;
|
||||
lock_data(lock_data &&) = delete;
|
||||
explicit lock_data(const provider_type &pt, std::string unique_id /*= ""*/)
|
||||
: pt_(pt),
|
||||
unique_id_(std::move(unique_id)),
|
||||
mutex_id_("repertory_" + app_config::get_provider_name(pt) + "_" +
|
||||
unique_id_),
|
||||
mutex_handle_(::CreateMutex(nullptr, FALSE, &mutex_id_[0u])) {}
|
||||
|
||||
~lock_data();
|
||||
lock_data()
|
||||
: pt_(provider_type::sia),
|
||||
unique_id_(""),
|
||||
mutex_id_(""),
|
||||
mutex_handle_(INVALID_HANDLE_VALUE) {}
|
||||
|
||||
auto operator=(const lock_data &) -> lock_data & = delete;
|
||||
auto operator=(lock_data &&) -> lock_data & = delete;
|
||||
~lock_data() { release(); }
|
||||
|
||||
private:
|
||||
std::string mutex_id_;
|
||||
HANDLE mutex_handle_{INVALID_HANDLE_VALUE};
|
||||
DWORD mutex_state_{WAIT_FAILED};
|
||||
|
||||
[[nodiscard]] auto get_current_mount_state(json &mount_state) -> bool;
|
||||
const provider_type pt_;
|
||||
const std::string unique_id_;
|
||||
const std::string mutex_id_;
|
||||
HANDLE mutex_handle_;
|
||||
DWORD mutex_state_ = WAIT_FAILED;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_mount_state(const provider_type &pt,
|
||||
json &mount_state) -> bool;
|
||||
|
||||
[[nodiscard]] auto get_mount_state(json &mount_state) -> bool;
|
||||
|
||||
[[nodiscard]] auto grab_lock(std::uint8_t retry_count = 30U) -> lock_result;
|
||||
[[nodiscard]] auto get_unique_id() const -> std::string { return unique_id_; }
|
||||
|
||||
[[nodiscard]] auto grab_lock(std::uint8_t retry_count = 30) -> lock_result;
|
||||
|
||||
void release();
|
||||
|
||||
[[nodiscard]] auto set_mount_state(bool active,
|
||||
std::string_view mount_location,
|
||||
std::int64_t pid) -> bool;
|
||||
const std::string &mount_location,
|
||||
const std::int64_t &pid) -> bool;
|
||||
};
|
||||
|
||||
[[nodiscard]] auto create_meta_attributes(
|
||||
|
@ -85,13 +85,6 @@ private:
|
||||
void remove_deleted_files(stop_type &stop_requested);
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto check_version(std::string &required_version,
|
||||
std::string &returned_version) const
|
||||
-> bool override {
|
||||
required_version = returned_version = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto create_directory(const std::string &api_path,
|
||||
api_meta_map &meta) -> api_error override;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user