Compare commits
170 Commits
v2.0.4-rc
...
3b4767290b
Author | SHA1 | Date | |
---|---|---|---|
3b4767290b | |||
eb26f59059 | |||
efcb319d8c | |||
52e7f675fc | |||
78e9c95054 | |||
8fa3ccf97c | |||
1311d665b5 | |||
62e45894b8 | |||
094aec0afb | |||
3b46a48078 | |||
8c53a07d64 | |||
03485935b7 | |||
4b3582cbb0 | |||
8272ec2f8a | |||
7309ca477a | |||
e8ef11cef4 | |||
80b77daa8a | |||
cb75efd96f | |||
631a1bc914 | |||
5064ec3f9a | |||
7c072f98dd | |||
d732bfb224 | |||
4241adb4d3 | |||
e1c35624f6 | |||
9b75618fb3 | |||
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 |
@ -128,7 +128,6 @@ libcurl
|
||||
libdsm
|
||||
libevent
|
||||
libexample
|
||||
libexpat
|
||||
libfuse3
|
||||
libgmock
|
||||
libgtest
|
||||
@ -141,12 +140,10 @@ libuuid
|
||||
libuuid_include_dirs
|
||||
libvlc
|
||||
linkflags
|
||||
localappdata
|
||||
lptr
|
||||
lpwstr
|
||||
markdownlint
|
||||
mbig
|
||||
minio
|
||||
msvc
|
||||
msvcr120
|
||||
msys2
|
||||
@ -192,7 +189,6 @@ secp256k1
|
||||
secur32
|
||||
sfml_project
|
||||
shlwapi
|
||||
skynet
|
||||
source_subdir
|
||||
spdlog
|
||||
spdlog_project
|
||||
@ -204,7 +200,6 @@ stduuid_project
|
||||
strequal
|
||||
ularge_integer
|
||||
uring
|
||||
url
|
||||
userenv
|
||||
utimens_impl
|
||||
utimensat
|
||||
|
32
CHANGELOG.md
32
CHANGELOG.md
@ -1,36 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## v2.0.4-rc
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* `renterd` v2.0.0+ is now required. Prior versions will fail to mount.
|
||||
|
||||
### 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
|
||||
@ -39,7 +16,6 @@
|
||||
### 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
|
||||
|
@ -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}
|
||||
|
128
README.md
128
README.md
@ -1,22 +1,23 @@
|
||||
# Repertory
|
||||
|
||||
Repertory allows you to mount S3 and Sia via FUSE on Linux or via WinFSP
|
||||
Repertory allows you to mount AWS S3 and Sia via FUSE on Linux ~~/OS X~~ or via WinFSP
|
||||
on Windows.
|
||||
|
||||
## Details and Features
|
||||
|
||||
* Optimized for [Plex Media Server](https://www.plex.tv/)
|
||||
* Single application to mount S3 and/or Sia
|
||||
* Remote mounting of Repertory instances on Linux and Windows
|
||||
* Securely share your mounts over TCP/IP via `XChaCha20-Poly1305` with other systems on your network or over the internet.
|
||||
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64, Windows 64-bit)
|
||||
* Optionally encrypt file names and file data via `XChaCha20-Poly1305` in S3 mounts
|
||||
* Single application to mount AWS S3 and/or Sia
|
||||
* Remote mounting of Repertory instances on Linux ~~, OS X~~ and Windows
|
||||
* Securely share your mounts over TCP/IP (`XChaCha20-Poly1305` stream cipher)
|
||||
* Cross-platform support (Linux 64-bit, Linux arm64/aarch64, ~~OS X,~~ Windows 64-bit)
|
||||
|
||||
## Minimum Requirements
|
||||
|
||||
* [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v2.0.0+ for Sia support
|
||||
* [Sia renterd](https://github.com/SiaFoundation/renterd/releases) v0.4.0+ for Sia support
|
||||
* Only 64-bit operating systems are supported
|
||||
* By default, Linux requires `fusermount3`; otherwise, `repertory` must be manually compiled with `libfuse2` support
|
||||
* ~~OS X requires the following dependency to be installed:~~
|
||||
* ~~[FUSE for macOS v4.5.0](https://github.com/osxfuse/osxfuse/releases/download/macfuse-4.5.0/macfuse-4.5.0.dmg)~~
|
||||
* Windows requires the following dependencies to be installed:
|
||||
* [WinFSP 2023](https://github.com/winfsp/winfsp/releases/download/v2.0/winfsp-2.0.23075.msi)
|
||||
|
||||
@ -24,103 +25,47 @@ on Windows.
|
||||
|
||||
* Linux `arm64/aarch64`
|
||||
* Linux `amd64`
|
||||
* ~~OS X Mojave and above~~
|
||||
* Windows 64-bit 10, 11
|
||||
|
||||
## Usage
|
||||
|
||||
### Sia
|
||||
|
||||
* Initial Configuration
|
||||
* Sia steps:
|
||||
* Set the appropriate bucket name and `renterd` API password in `repertory` configuration:
|
||||
* To use `default` as the bucket name and configuration name:
|
||||
* `repertory -set HostConfig.ApiPassword '<my password>'`
|
||||
* To use a different bucket name with `default` as the configuration name:
|
||||
* `repertory -set HostConfig.ApiPassword '<my password>'`
|
||||
* `repertory -set SiaConfig.Bucket '<my bucket>'`
|
||||
* For all other configurations:
|
||||
* `repertory --name '<my config name>' -set HostConfig.ApiPassword '<my password>'`
|
||||
* `repertory --name '<my config name>' -set SiaConfig.Bucket '<my bucket name>'`
|
||||
* To verify/view all configuration options:
|
||||
* `repertory -dc`
|
||||
* `repertory --name '<my config name>' -dc`
|
||||
* Example:
|
||||
* `repertory --name default -dc`
|
||||
* Mounting on Linux:
|
||||
* `repertory /mnt/location`
|
||||
* `repertory --name '<my config name>' /mnt/location`
|
||||
* Example:
|
||||
* `repertory --name default /mnt/location`
|
||||
* Mounting on Windows:
|
||||
* `repertory t:`
|
||||
* `repertory --name '<my config name>' t:`
|
||||
* Example:
|
||||
* `repertory --name default t:`
|
||||
|
||||
### S3
|
||||
|
||||
* Initial Configuration
|
||||
* S3 steps:
|
||||
* Set the appropriate base URL:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.URL '<my url>'`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio -set S3Config.URL 'http://localhost:9000'`
|
||||
* Set the appropriate bucket name:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.Bucket '<my bucket name>'`
|
||||
* Set the appropriate access key:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.AccessKey '<my access key>'`
|
||||
* Set the appropriate secret key:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.SecretKey '<my secret key>'`
|
||||
* For Sia and most local S3 gateway instances, enable path style URL's:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.UsePathStyle true`
|
||||
* Optional steps:
|
||||
* Set an appropriate region. Default is set to `any`:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.Region '<my region>'`
|
||||
* Enable encrypted file names and file data. Set a strong, random encryption token and be sure to store it in a secure backup location:
|
||||
* `repertory -s3 --name '<my config name>' -set S3Config.EncryptionToken '<my strong password>'`
|
||||
* To verify/view all configuration options:
|
||||
* `repertory -s3 --name '<my config name>' -dc`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio -dc`
|
||||
* Mounting on Linux:
|
||||
* `repertory -s3 --name '<my config name>' /mnt/location`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio /mnt/location`
|
||||
* Mounting on Windows:
|
||||
* `repertory -s3 --name '<my config name>' t:`
|
||||
* Example:
|
||||
* `repertory -s3 --name minio t:`
|
||||
|
||||
### Notable Options
|
||||
|
||||
* `-dc`
|
||||
* Display mount configuration.
|
||||
* For Sia, `--name` is optional
|
||||
* For S3, the `-s3` option is required along with `--name`
|
||||
* `--help`
|
||||
* Display all mount utility options
|
||||
* Display all mount utility options.
|
||||
* `--name, -na [name]`
|
||||
* The `--name` option can be set to any valid value allowed as a file name for your filesystem.
|
||||
* For Sia, the bucket name will be set to the same value if it is empty in the configuration file.
|
||||
* If the `--name` option is not specified, `default` will be used.
|
||||
* For S3, the `--name` option is required and does not affect the bucket name.
|
||||
* `-dc`
|
||||
* Display mount configuration
|
||||
* For Sia, `--name` is optional
|
||||
* For S3, the `-s3` option is required along with `--name`
|
||||
* `-set SiaConfig.Bucket`
|
||||
* Set Sia bucket name for the mount.
|
||||
* Can be used in combination with `--name` to target a unique configuration.
|
||||
* `-set S3Config.Bucket`
|
||||
* S3 bucket name for the mount.
|
||||
* Must be used in combination with `--name` to target a unique configuration.
|
||||
* Must be used in combination with `-s3`.
|
||||
|
||||
### Data Directories
|
||||
### Sia
|
||||
|
||||
* Linux
|
||||
* `~/.local/repertory2`
|
||||
* `repertory /mnt/location`
|
||||
* `repertory --name default /mnt/location`
|
||||
* Windows
|
||||
* `%LOCALAPPDATA%\repertory2`
|
||||
* Example:
|
||||
* `C:\Users\Tom\AppData\Local\repertory2`
|
||||
* IMPORTANT:
|
||||
* It is highly recommended to exclude this folder from any anti-virus/anti-malware applications as severe performance issues may arise.
|
||||
* Excluding the mounted drive letter is also highly recommended.
|
||||
* `repertory.exe t:`
|
||||
* `repertory.exe --name default t:`
|
||||
|
||||
## Remote Mounting
|
||||
### S3
|
||||
|
||||
`Repertory` allows local mounts to be shared with other computers on your network.
|
||||
This option is referred to as remote mounting. Instructions TBD.
|
||||
* Linux
|
||||
* `repertory --name storj -s3 /mnt/location`
|
||||
* Windows
|
||||
* `repertory.exe --name storj -s3 t:`
|
||||
|
||||
## Compiling
|
||||
|
||||
@ -149,26 +94,17 @@ This option is referred to as remote mounting. Instructions TBD.
|
||||
|
||||
## Credits
|
||||
|
||||
* [binutils](https://www.gnu.org/software/binutils/)
|
||||
* [boost c++ libraries](https://www.boost.org/)
|
||||
* [cpp-httplib](https://github.com/yhirose/cpp-httplib)
|
||||
* [curl](https://curl.haxx.se/)
|
||||
* [docker](https://www.docker.com/)
|
||||
* ~~[FUSE for macOS](https://osxfuse.github.io/)~~
|
||||
* [Google Test](https://github.com/google/googletest)
|
||||
* [ICU](https://icu.unicode.org/)
|
||||
* [JSON for Modern C++](https://github.com/nlohmann/json)
|
||||
* [libexpat](https://github.com/libexpat/libexpat)
|
||||
* [libfuse](https://github.com/libfuse/libfuse)
|
||||
* [libsodium](https://doc.libsodium.org/)
|
||||
* [mingw-w64](https://www.mingw-w64.org/)
|
||||
* [MSYS2](https://www.msys2.org)
|
||||
* [OpenSSL](https://www.openssl.org/)
|
||||
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/)
|
||||
* [pugixml](https://pugixml.org/)
|
||||
* [RocksDB](https://rocksdb.org)
|
||||
* [ScPrime](https://scpri.me/)
|
||||
* [Sia Decentralized Cloud Storage](https://sia.tech/)
|
||||
* [spdlog](https://github.com/gabime/spdlog)
|
||||
* [SQLite](https://www.sqlite.org)
|
||||
* [stduuid](https://github.com/mariusbancila/stduuid)
|
||||
* [Storj](https://storj.io/)
|
||||
|
@ -10,7 +10,7 @@ PROJECT_DESC="Mount utility for Sia and S3"
|
||||
|
||||
PROJECT_MAJOR_VERSION=2
|
||||
PROJECT_MINOR_VERSION=0
|
||||
PROJECT_REVISION_VERSION=4
|
||||
PROJECT_REVISION_VERSION=3
|
||||
PROJECT_RELEASE_NUM=0
|
||||
PROJECT_RELEASE_ITER=rc
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#comment
|
||||
FROM alpine:3.21.3
|
||||
FROM alpine:3.21.0
|
||||
|
||||
RUN apk update
|
||||
RUN apk upgrade
|
||||
|
@ -31,26 +31,26 @@ private:
|
||||
static stop_type stop_requested;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto default_agent_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
default_agent_name(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto default_api_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_api_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto default_data_directory(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
default_data_directory(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto default_remote_api_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_remote_api_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto default_rpc_port(const provider_type &prov)
|
||||
-> std::uint16_t;
|
||||
[[nodiscard]] static auto
|
||||
default_rpc_port(const provider_type &prov) -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] static auto get_provider_display_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
get_provider_display_name(const provider_type &prov) -> std::string;
|
||||
|
||||
[[nodiscard]] static auto get_provider_name(const provider_type &prov)
|
||||
-> std::string;
|
||||
[[nodiscard]] static auto
|
||||
get_provider_name(const provider_type &prov) -> std::string;
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto get_stop_requested() -> bool;
|
||||
@ -91,6 +91,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_;
|
||||
@ -171,6 +172,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;
|
||||
@ -189,11 +192,8 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_task_wait_ms() const -> std::uint16_t;
|
||||
|
||||
[[nodiscard]] auto get_value_by_name(const std::string &name) const
|
||||
-> std::string;
|
||||
|
||||
[[nodiscard]] auto get_raw_value_by_name(const std::string &name) const
|
||||
-> std::string;
|
||||
[[nodiscard]] auto
|
||||
get_value_by_name(const std::string &name) const -> std::string;
|
||||
|
||||
[[nodiscard]] auto get_version() const -> std::uint64_t;
|
||||
|
||||
@ -239,6 +239,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);
|
||||
|
@ -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 = 1ULL;
|
||||
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)
|
||||
|
@ -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;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
~console_consumer();
|
||||
|
||||
private:
|
||||
static void process_event(const i_event &evt);
|
||||
static void process_event2(const i_event &evt);
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
5ULL};
|
||||
|
||||
private:
|
||||
static void process_event(const i_event &evt);
|
||||
static void process_event2(const i_event &evt);
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
|
@ -127,10 +127,14 @@ private: \
|
||||
|
||||
#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 i_event &evt) { callback(evt); }))
|
||||
|
||||
#define E_SUBSCRIBE_EXACT(name, callback) \
|
||||
event_consumers_.emplace_back(std::make_shared<repertory::event_consumer>( \
|
||||
#name, [this](const i_event &evt) { \
|
||||
callback(dynamic_cast<const name &>(evt)); \
|
||||
}))
|
||||
|
||||
#define E_SUBSCRIBE_ALL(callback) \
|
||||
|
120
repertory/librepertory/include/events/events.hpp
Normal file
120
repertory/librepertory/include/events/events.hpp
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
||||
#if 0
|
||||
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
// clang-format off
|
||||
E_SIMPLE2(download_restored, info,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_restore_failed, error,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_resume_add_failed, error,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING,
|
||||
std::string, error, err, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(download_resume_added, debug,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(download_resume_removed, debug,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, dest_path, dest, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(download_type_selected, debug,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
std::string, source, src, E_FROM_STRING,
|
||||
download_type, download_type, type, E_FROM_DOWNLOAD_TYPE
|
||||
);
|
||||
|
||||
E_SIMPLE1(item_timeout, trace,
|
||||
std::string, api_path, ap, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE2(invalid_cache_size, warn,
|
||||
std::uint64_t, cache_size, sz, E_FROM_UINT64,
|
||||
std::uint64_t, by, by, E_FROM_UINT64
|
||||
);
|
||||
|
||||
E_SIMPLE2(max_cache_size_reached, warn,
|
||||
std::uint64_t, cache_size, sz, E_FROM_UINT64,
|
||||
std::uint64_t, max_cache_size, max, E_FROM_UINT64
|
||||
);
|
||||
|
||||
E_SIMPLE2(packet_client_timeout, error,
|
||||
std::string, event_name, en, E_FROM_STRING,
|
||||
std::string, message, msg, E_FROM_STRING
|
||||
);
|
||||
|
||||
//FUSE
|
||||
E_SIMPLE3(fuse_event, debug,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
int, result, res, E_FROM_INT32
|
||||
);
|
||||
|
||||
E_SIMPLE1(fuse_args_parsed, info,
|
||||
std::string, arguments, args, E_FROM_STRING
|
||||
);
|
||||
|
||||
E_SIMPLE3(remote_fuse_server_event, debug,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
packet::error_type, result, res, E_FROM_INT32
|
||||
);
|
||||
|
||||
//WINFSP
|
||||
E_SIMPLE3(winfsp_event, debug,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
NTSTATUS, result, res, E_FROM_INT32
|
||||
);
|
||||
E_SIMPLE(drive_stop_timed_out, info);
|
||||
E_SIMPLE3(remote_winfsp_client_event, debug,
|
||||
std::string, function, func, E_FROM_STRING,
|
||||
std::string, api_path, ap, E_FROM_STRING,
|
||||
packet::error_type, result, res, E_FROM_INT32
|
||||
);
|
||||
E_SIMPLE3(remote_winfsp_server_event, debug,
|
||||
std::string, function, FUNC, E_FROM_STRING,
|
||||
std::string, api_path, AP, E_FROM_STRING,
|
||||
packet::error_type, result, RES, E_FROM_INT32
|
||||
);
|
||||
// clang-format on
|
||||
} // namespace repertory
|
||||
|
||||
#endif // 0
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
|
@ -33,7 +33,6 @@ struct curl_error final : public i_event {
|
||||
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{};
|
||||
@ -41,7 +40,7 @@ struct curl_error final : public i_event {
|
||||
std::string url;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::error;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -31,14 +31,13 @@ struct debug_log final : public i_event {
|
||||
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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct directory_remove_failed final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct directory_remove_failed final : public i_event {
|
||||
std::string function_name;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::error;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct directory_removed final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct directory_removed_externally final : public i_event {
|
||||
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;
|
||||
@ -43,7 +42,7 @@ struct directory_removed_externally final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct download_begin final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct download_begin final : public i_event {
|
||||
std::string function_name;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct download_end final : public i_event {
|
||||
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;
|
||||
@ -44,7 +43,7 @@ struct download_end final : public i_event {
|
||||
std::string function_name;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct download_progress final : public i_event {
|
||||
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;
|
||||
@ -44,7 +43,7 @@ struct download_progress final : public i_event {
|
||||
double progress{};
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -29,21 +29,20 @@
|
||||
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_)) {}
|
||||
drive_mount_failed(std::string_view function_name_,
|
||||
std::string mount_location_, NTSTATUS status_)
|
||||
: function_name(std::string(function_name_)),
|
||||
mount_location(std::move(mount_location_)),
|
||||
status(status_) {}
|
||||
|
||||
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;
|
||||
NTSTATUS status{};
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::error;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
@ -52,7 +51,7 @@ struct drive_mount_failed final : public i_event {
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|location|{}|status|{}", name, function_name,
|
||||
mount_location, error);
|
||||
mount_location, status);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
@ -60,16 +59,16 @@ struct drive_mount_failed final : public i_event {
|
||||
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;
|
||||
data["status"] = value.status;
|
||||
}
|
||||
|
||||
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);
|
||||
data.at("status").get_to<NTSTATUS>(value.status);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
@ -34,7 +34,6 @@ struct drive_mount_result final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct drive_mount_result final : public i_event {
|
||||
std::string result;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct drive_mounted final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -33,14 +33,13 @@ struct drive_unmount_pending final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct drive_unmounted final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -28,17 +28,16 @@
|
||||
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_) {}
|
||||
event_level_changed(std::string_view function_name_, event_level level_)
|
||||
: function_name(std::string(function_name_)), level(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{};
|
||||
event_level level{};
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
@ -47,7 +46,7 @@ struct event_level_changed final : public i_event {
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|level|{}", name, function_name,
|
||||
event_level_to_string(new_level));
|
||||
event_level_to_string(level));
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
@ -55,14 +54,14 @@ struct event_level_changed final : public i_event {
|
||||
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["event_level"] = repertory::event_level_to_string(value.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>());
|
||||
value.level = repertory::event_level_from_string(
|
||||
data.at("event_level").get<std::string>());
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
}
|
||||
};
|
||||
|
@ -32,14 +32,13 @@ struct file_pinned final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct file_remove_failed final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct file_remove_failed final : public i_event {
|
||||
std::string function_name;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::error;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct file_removed final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct file_removed_externally final : public i_event {
|
||||
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;
|
||||
@ -43,7 +42,7 @@ struct file_removed_externally final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct file_unpinned final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -37,7 +37,6 @@ struct file_upload_completed final : public i_event {
|
||||
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;
|
||||
@ -47,7 +46,7 @@ struct file_upload_completed final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct file_upload_failed final : public i_event {
|
||||
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;
|
||||
@ -44,7 +43,7 @@ struct file_upload_failed final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct file_upload_not_found final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct file_upload_not_found final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct file_upload_queued final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct file_upload_queued final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct file_upload_removed final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -28,23 +28,22 @@
|
||||
namespace repertory {
|
||||
struct file_upload_retry final : public i_event {
|
||||
file_upload_retry() = default;
|
||||
file_upload_retry(std::string api_path_, api_error error_,
|
||||
file_upload_retry(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_retry"};
|
||||
|
||||
std::string api_path;
|
||||
api_error error{};
|
||||
std::string error;
|
||||
std::string function_name;
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
@ -52,8 +51,8 @@ struct file_upload_retry final : public i_event {
|
||||
}
|
||||
|
||||
[[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));
|
||||
return fmt::format("{}|func|{}|ap|{}|error|{}|sp|{}", name, function_name,
|
||||
api_path, error, source_path);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
@ -62,15 +61,14 @@ 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["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_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("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);
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ struct filesystem_item_added final : public i_event {
|
||||
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;
|
||||
@ -44,7 +43,7 @@ struct filesystem_item_added final : public i_event {
|
||||
std::string function_name;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -37,7 +37,6 @@ struct filesystem_item_closed final : public i_event {
|
||||
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;
|
||||
@ -47,7 +46,7 @@ struct filesystem_item_closed final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::trace;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct filesystem_item_evicted final : public i_event {
|
||||
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;
|
||||
@ -43,7 +42,7 @@ struct filesystem_item_evicted final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -39,7 +39,6 @@ struct filesystem_item_handle_closed final : public i_event {
|
||||
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;
|
||||
@ -50,7 +49,7 @@ struct filesystem_item_handle_closed final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::trace;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -37,7 +37,6 @@ struct filesystem_item_handle_opened final : public i_event {
|
||||
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;
|
||||
@ -47,7 +46,7 @@ struct filesystem_item_handle_opened final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::trace;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -36,7 +36,6 @@ struct filesystem_item_opened final : public i_event {
|
||||
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;
|
||||
@ -45,7 +44,7 @@ struct filesystem_item_opened final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::trace;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -33,14 +33,13 @@ struct orphaned_file_detected final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -36,10 +36,8 @@ struct orphaned_file_processing_failed final : public i_event {
|
||||
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",
|
||||
};
|
||||
"orphaned_file_processing_failed"};
|
||||
|
||||
std::string dest_path;
|
||||
std::string error;
|
||||
@ -47,7 +45,7 @@ struct orphaned_file_processing_failed final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -33,14 +33,13 @@ struct orphaned_source_file_detected final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -33,14 +33,13 @@ struct orphaned_source_file_removed final : public i_event {
|
||||
: 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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -32,14 +32,13 @@ struct polling_item_begin final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct polling_item_end final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -34,7 +34,6 @@ struct provider_offline final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct provider_offline final : public i_event {
|
||||
std::uint16_t port{};
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -34,7 +34,6 @@ struct provider_upload_begin final : public i_event {
|
||||
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;
|
||||
@ -42,7 +41,7 @@ struct provider_upload_begin final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::warn;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct provider_upload_end final : public i_event {
|
||||
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;
|
||||
@ -44,7 +43,7 @@ struct provider_upload_end final : public i_event {
|
||||
std::string source_path;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -31,14 +31,13 @@ struct repertory_exception final : public i_event {
|
||||
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;
|
||||
return event_level::error;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -33,14 +33,13 @@ struct service_start_begin final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct service_start_end final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct service_stop_begin final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -32,14 +32,13 @@ struct service_stop_end final : public i_event {
|
||||
: 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;
|
||||
return event_level::debug;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -31,13 +31,12 @@ struct unmount_requested final : public i_event {
|
||||
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;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -35,7 +35,6 @@ struct unmount_result final : public i_event {
|
||||
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;
|
||||
@ -43,7 +42,7 @@ struct unmount_result final : public i_event {
|
||||
std::int32_t result{};
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
return event_level::info;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
|
@ -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_
|
@ -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;
|
||||
|
||||
|
@ -31,10 +31,6 @@ class i_provider {
|
||||
INTERFACE_SETUP(i_provider);
|
||||
|
||||
public:
|
||||
[[nodiscard]] virtual auto check_version(std::string &required_version,
|
||||
std::string &returned_version) const
|
||||
-> bool = 0;
|
||||
|
||||
[[nodiscard]] virtual auto create_directory(const std::string &api_path,
|
||||
api_meta_map &meta)
|
||||
-> api_error = 0;
|
||||
|
@ -113,13 +113,6 @@ protected:
|
||||
-> api_error override;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto check_version(std::string &required_version,
|
||||
std::string &returned_version) const
|
||||
-> bool override {
|
||||
required_version = returned_version = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]] static auto convert_api_date(std::string_view date)
|
||||
-> std::uint64_t;
|
||||
|
||||
|
@ -80,10 +80,6 @@ protected:
|
||||
-> api_error override;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto check_version(std::string &required_version,
|
||||
std::string &returned_version) const
|
||||
-> bool override;
|
||||
|
||||
[[nodiscard]] auto get_directory_item_count(const std::string &api_path) const
|
||||
-> std::uint64_t override;
|
||||
|
||||
|
@ -31,18 +31,18 @@ public:
|
||||
|
||||
private:
|
||||
const rpc_host_info host_info_;
|
||||
std::atomic<std::uint32_t> request_id_{0U};
|
||||
std::atomic<std::uint32_t> request_id_;
|
||||
|
||||
public:
|
||||
[[nodiscard]] auto get_drive_information() -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto get_config() -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto get_config_value_by_name(const std::string &name)
|
||||
-> rpc_response;
|
||||
[[nodiscard]] auto
|
||||
get_config_value_by_name(const std::string &name) -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto get_directory_items(const std::string &api_path)
|
||||
-> rpc_response;
|
||||
[[nodiscard]] auto
|
||||
get_directory_items(const std::string &api_path) -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto get_open_files() -> rpc_response;
|
||||
|
||||
@ -52,9 +52,9 @@ public:
|
||||
|
||||
[[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto set_config_value_by_name(const std::string &name,
|
||||
const std::string &value)
|
||||
-> rpc_response;
|
||||
[[nodiscard]] auto
|
||||
set_config_value_by_name(const std::string &name,
|
||||
const std::string &value) -> rpc_response;
|
||||
|
||||
[[nodiscard]] auto unmount() -> rpc_response;
|
||||
|
||||
|
@ -24,27 +24,29 @@
|
||||
|
||||
namespace repertory {
|
||||
constexpr const auto default_api_auth_size{48U};
|
||||
constexpr const auto default_download_timeout_secs{30U};
|
||||
constexpr const auto default_download_timeout_ces{30U};
|
||||
constexpr const auto default_eviction_delay_mins{1U};
|
||||
constexpr const auto default_high_freq_interval_secs{std::uint16_t{30U}};
|
||||
constexpr const auto default_low_freq_interval_secs{std::uint16_t(60U * 60U)};
|
||||
constexpr const auto default_high_freq_interval_secs{30U};
|
||||
constexpr const auto default_low_freq_interval_secs{0U * 60U};
|
||||
constexpr const auto default_max_cache_size_bytes{
|
||||
std::uint64_t(20ULL * 1024ULL * 1024ULL * 1024ULL),
|
||||
std::uint64_t(20UL * 1024UL * 1024UL * 1024UL),
|
||||
};
|
||||
constexpr const auto default_max_upload_count{5U};
|
||||
constexpr const auto default_med_freq_interval_secs{std::uint16_t{2U * 60U}};
|
||||
constexpr const auto default_med_freq_interval_secs{2U * 60U};
|
||||
constexpr const auto default_online_check_retry_secs{60U};
|
||||
constexpr const auto default_orphaned_file_retention_days{15U};
|
||||
constexpr const auto default_retry_read_count{6U};
|
||||
constexpr const auto default_ring_buffer_file_size{512U};
|
||||
constexpr const auto default_task_wait_ms{100U};
|
||||
constexpr const auto default_timeout_ms{60000U};
|
||||
constexpr const auto max_orphaned_file_retention_days{std::uint16_t(31U)};
|
||||
constexpr const auto max_ring_buffer_file_size{std::uint16_t(1024U)};
|
||||
constexpr const auto max_s3_object_name_length{1024U};
|
||||
constexpr const auto min_cache_size_bytes{
|
||||
std::uint64_t(100ULL * 1024ULL * 1024ULL),
|
||||
};
|
||||
std::uint64_t(100UL * 1024UL * 1024UL)};
|
||||
constexpr const auto min_download_timeout_secs{std::uint8_t(5U)};
|
||||
constexpr const auto min_online_check_retry_secs{std::uint16_t(15U)};
|
||||
constexpr const auto min_orphaned_file_retention_days{std::uint16_t(1U)};
|
||||
constexpr const auto min_retry_read_count{std::uint16_t(2U)};
|
||||
constexpr const auto min_ring_buffer_file_size{std::uint16_t(64U)};
|
||||
constexpr const auto min_task_wait_ms{std::uint16_t(50U)};
|
||||
@ -330,6 +332,7 @@ struct directory_item final {
|
||||
bool directory{false};
|
||||
std::uint64_t size{};
|
||||
api_meta_map meta;
|
||||
bool resolved{false};
|
||||
};
|
||||
|
||||
struct encrypt_config final {
|
||||
@ -489,6 +492,8 @@ inline constexpr const auto JSON_MED_FREQ_INTERVAL_SECS{
|
||||
inline constexpr const auto JSON_META{"Meta"};
|
||||
inline constexpr const auto JSON_ONLINE_CHECK_RETRY_SECS{
|
||||
"OnlineCheckRetrySeconds"};
|
||||
inline constexpr const auto JSON_ORPHANED_FILE_RETENTION_DAYS{
|
||||
"OrphanedFileRetentionDays"};
|
||||
inline constexpr const auto JSON_PATH{"Path"};
|
||||
inline constexpr const auto JSON_PREFERRED_DOWNLOAD_TYPE{
|
||||
"PreferredDownloadType"};
|
||||
@ -613,16 +618,6 @@ template <typename data_t> struct adl_serializer<repertory::atomic<data_t>> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct adl_serializer<std::atomic<std::uint64_t>> {
|
||||
static void to_json(json &data, const std::atomic<std::uint64_t> &value) {
|
||||
data = value.load();
|
||||
}
|
||||
|
||||
static void from_json(const json &data, std::atomic<std::uint64_t> &value) {
|
||||
value.store(data.get<std::uint64_t>());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename primitive_t>
|
||||
struct adl_serializer<std::atomic<primitive_t>> {
|
||||
static void to_json(json &data, const std::atomic<primitive_t> &value) {
|
||||
@ -646,18 +641,6 @@ template <> struct adl_serializer<std::atomic<repertory::database_type>> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct adl_serializer<std::atomic<repertory::event_level>> {
|
||||
static void to_json(json &data,
|
||||
const std::atomic<repertory::event_level> &value) {
|
||||
data = repertory::event_level_to_string(value.load());
|
||||
}
|
||||
|
||||
static void from_json(const json &data,
|
||||
std::atomic<repertory::event_level> &value) {
|
||||
value.store(repertory::event_level_from_string(data.get<std::string>()));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct adl_serializer<std::atomic<repertory::download_type>> {
|
||||
static void to_json(json &data,
|
||||
const std::atomic<repertory::download_type> &value) {
|
||||
@ -690,13 +673,15 @@ template <> struct adl_serializer<repertory::download_type> {
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct adl_serializer<repertory::event_level> {
|
||||
static void to_json(json &data, const repertory::event_level &value) {
|
||||
data = repertory::event_level_to_string(value);
|
||||
template <> struct adl_serializer<std::atomic<repertory::event_level>> {
|
||||
static void to_json(json &data,
|
||||
const std::atomic<repertory::event_level> &value) {
|
||||
data = repertory::event_level_to_string(value.load());
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::event_level &value) {
|
||||
value = repertory::event_level_from_string(data.get<std::string>());
|
||||
static void from_json(const json &data,
|
||||
std::atomic<repertory::event_level> &value) {
|
||||
value.store(repertory::event_level_from_string(data.get<std::string>()));
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
@ -32,13 +32,13 @@ public:
|
||||
|
||||
public:
|
||||
timeout(std::function<void()> timeout_callback,
|
||||
std::chrono::system_clock::duration duration);
|
||||
const std::chrono::system_clock::duration &duration = 10s);
|
||||
|
||||
~timeout() { disable(); }
|
||||
|
||||
private:
|
||||
std::atomic<bool> timeout_killed_;
|
||||
std::unique_ptr<std::thread> timeout_thread_{nullptr};
|
||||
std::unique_ptr<std::thread> timeout_thread_;
|
||||
std::mutex timeout_mutex_;
|
||||
std::condition_variable timeout_notify_;
|
||||
|
||||
|
@ -70,7 +70,7 @@ app_config::app_config(const provider_type &prov,
|
||||
api_port_(default_rpc_port(prov)),
|
||||
api_user_(std::string{REPERTORY}),
|
||||
config_changed_(false),
|
||||
download_timeout_secs_(default_download_timeout_secs),
|
||||
download_timeout_secs_(default_download_timeout_ces),
|
||||
enable_download_timeout_(true),
|
||||
enable_drive_events_(false),
|
||||
#if defined(_WIN32)
|
||||
@ -85,6 +85,7 @@ app_config::app_config(const provider_type &prov,
|
||||
max_upload_count_(default_max_upload_count),
|
||||
med_freq_interval_secs_(default_med_freq_interval_secs),
|
||||
online_check_retry_secs_(default_online_check_retry_secs),
|
||||
orphaned_file_retention_days_(default_orphaned_file_retention_days),
|
||||
preferred_download_type_(download_type::default_),
|
||||
retry_read_count_(default_retry_read_count),
|
||||
ring_buffer_file_size_(default_ring_buffer_file_size),
|
||||
@ -165,14 +166,8 @@ app_config::app_config(const provider_type &prov,
|
||||
[this]() { return get_host_config().api_password; }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_API_PORT),
|
||||
[this]() { return std::to_string(get_host_config().api_port); }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_API_USER),
|
||||
[this]() { return get_host_config().api_user; }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_HOST_NAME_OR_IP),
|
||||
[this]() { return get_host_config().host_name_or_ip; }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_PATH),
|
||||
[this]() { return get_host_config().path; }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_PROTOCOL),
|
||||
[this]() { return get_host_config().protocol; }},
|
||||
{fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_TIMEOUT_MS),
|
||||
[this]() { return std::to_string(get_host_config().timeout_ms); }},
|
||||
{JSON_LOW_FREQ_INTERVAL_SECS,
|
||||
@ -185,6 +180,8 @@ app_config::app_config(const provider_type &prov,
|
||||
[this]() { return std::to_string(get_med_frequency_interval_secs()); }},
|
||||
{JSON_ONLINE_CHECK_RETRY_SECS,
|
||||
[this]() { return std::to_string(get_online_check_retry_secs()); }},
|
||||
{JSON_ORPHANED_FILE_RETENTION_DAYS,
|
||||
[this]() { return std::to_string(get_orphaned_file_retention_days()); }},
|
||||
{JSON_PREFERRED_DOWNLOAD_TYPE,
|
||||
[this]() {
|
||||
return download_type_to_string(get_preferred_download_type());
|
||||
@ -253,7 +250,7 @@ app_config::app_config(const provider_type &prov,
|
||||
|
||||
value_set_lookup_ = {
|
||||
{
|
||||
JSON_API_AUTH,
|
||||
JSON_API_PATH,
|
||||
[this](const std::string &value) {
|
||||
set_api_auth(value);
|
||||
return get_api_auth();
|
||||
@ -352,7 +349,7 @@ app_config::app_config(const provider_type &prov,
|
||||
{
|
||||
JSON_HIGH_FREQ_INTERVAL_SECS,
|
||||
[this](const std::string &value) {
|
||||
set_high_frequency_interval_secs(utils::string::to_uint16(value));
|
||||
set_high_frequency_interval_secs(utils::string::to_uint8(value));
|
||||
return std::to_string(get_high_frequency_interval_secs());
|
||||
},
|
||||
},
|
||||
@ -383,15 +380,6 @@ app_config::app_config(const provider_type &prov,
|
||||
return std::to_string(get_host_config().api_port);
|
||||
},
|
||||
},
|
||||
{
|
||||
fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_API_USER),
|
||||
[this](const std::string &value) {
|
||||
auto cfg = get_host_config();
|
||||
cfg.api_user = value;
|
||||
set_host_config(cfg);
|
||||
return get_host_config().api_user;
|
||||
},
|
||||
},
|
||||
{
|
||||
fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_HOST_NAME_OR_IP),
|
||||
[this](const std::string &value) {
|
||||
@ -401,24 +389,6 @@ app_config::app_config(const provider_type &prov,
|
||||
return get_host_config().host_name_or_ip;
|
||||
},
|
||||
},
|
||||
{
|
||||
fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_PATH),
|
||||
[this](const std::string &value) {
|
||||
auto cfg = get_host_config();
|
||||
cfg.path = value;
|
||||
set_host_config(cfg);
|
||||
return get_host_config().path;
|
||||
},
|
||||
},
|
||||
{
|
||||
fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_PROTOCOL),
|
||||
[this](const std::string &value) {
|
||||
auto cfg = get_host_config();
|
||||
cfg.protocol = value;
|
||||
set_host_config(cfg);
|
||||
return get_host_config().protocol;
|
||||
},
|
||||
},
|
||||
{
|
||||
fmt::format("{}.{}", JSON_HOST_CONFIG, JSON_TIMEOUT_MS),
|
||||
[this](const std::string &value) {
|
||||
@ -431,14 +401,14 @@ app_config::app_config(const provider_type &prov,
|
||||
{
|
||||
JSON_LOW_FREQ_INTERVAL_SECS,
|
||||
[this](const std::string &value) {
|
||||
set_low_frequency_interval_secs(utils::string::to_uint16(value));
|
||||
set_low_frequency_interval_secs(utils::string::to_uint8(value));
|
||||
return std::to_string(get_low_frequency_interval_secs());
|
||||
},
|
||||
},
|
||||
{
|
||||
JSON_MED_FREQ_INTERVAL_SECS,
|
||||
[this](const std::string &value) {
|
||||
set_med_frequency_interval_secs(utils::string::to_uint16(value));
|
||||
set_med_frequency_interval_secs(utils::string::to_uint8(value));
|
||||
return std::to_string(get_med_frequency_interval_secs());
|
||||
},
|
||||
},
|
||||
@ -463,6 +433,13 @@ app_config::app_config(const provider_type &prov,
|
||||
return std::to_string(get_online_check_retry_secs());
|
||||
},
|
||||
},
|
||||
{
|
||||
JSON_ORPHANED_FILE_RETENTION_DAYS,
|
||||
[this](const std::string &value) {
|
||||
set_orphaned_file_retention_days(utils::string::to_uint16(value));
|
||||
return std::to_string(get_orphaned_file_retention_days());
|
||||
},
|
||||
},
|
||||
{
|
||||
JSON_PREFERRED_DOWNLOAD_TYPE,
|
||||
[this](const std::string &value) {
|
||||
@ -835,6 +812,7 @@ auto app_config::get_json() const -> json {
|
||||
{JSON_MAX_UPLOAD_COUNT, max_upload_count_},
|
||||
{JSON_MED_FREQ_INTERVAL_SECS, med_freq_interval_secs_},
|
||||
{JSON_ONLINE_CHECK_RETRY_SECS, online_check_retry_secs_},
|
||||
{JSON_ORPHANED_FILE_RETENTION_DAYS, orphaned_file_retention_days_},
|
||||
{JSON_PREFERRED_DOWNLOAD_TYPE, preferred_download_type_},
|
||||
{JSON_REMOTE_CONFIG, remote_config_},
|
||||
{JSON_REMOTE_MOUNT, remote_mount_},
|
||||
@ -856,6 +834,7 @@ auto app_config::get_json() const -> json {
|
||||
ret.erase(JSON_MAX_CACHE_SIZE_BYTES);
|
||||
ret.erase(JSON_MAX_UPLOAD_COUNT);
|
||||
ret.erase(JSON_ONLINE_CHECK_RETRY_SECS);
|
||||
ret.erase(JSON_ORPHANED_FILE_RETENTION_DAYS);
|
||||
ret.erase(JSON_PREFERRED_DOWNLOAD_TYPE);
|
||||
ret.erase(JSON_REMOTE_CONFIG);
|
||||
ret.erase(JSON_RETRY_READ_COUNT);
|
||||
@ -877,6 +856,7 @@ auto app_config::get_json() const -> json {
|
||||
ret.erase(JSON_MAX_UPLOAD_COUNT);
|
||||
ret.erase(JSON_MED_FREQ_INTERVAL_SECS);
|
||||
ret.erase(JSON_ONLINE_CHECK_RETRY_SECS);
|
||||
ret.erase(JSON_ORPHANED_FILE_RETENTION_DAYS);
|
||||
ret.erase(JSON_PREFERRED_DOWNLOAD_TYPE);
|
||||
ret.erase(JSON_REMOTE_MOUNT);
|
||||
ret.erase(JSON_RETRY_READ_COUNT);
|
||||
@ -932,6 +912,12 @@ auto app_config::get_online_check_retry_secs() const -> std::uint16_t {
|
||||
return std::max(min_online_check_retry_secs, online_check_retry_secs_.load());
|
||||
}
|
||||
|
||||
auto app_config::get_orphaned_file_retention_days() const -> std::uint16_t {
|
||||
return std::min(max_orphaned_file_retention_days,
|
||||
std::max(min_orphaned_file_retention_days,
|
||||
orphaned_file_retention_days_.load()));
|
||||
}
|
||||
|
||||
auto app_config::get_preferred_download_type() const -> download_type {
|
||||
return preferred_download_type_;
|
||||
}
|
||||
@ -1067,6 +1053,8 @@ auto app_config::load() -> bool {
|
||||
med_freq_interval_secs_, found);
|
||||
get_value(json_document, JSON_ONLINE_CHECK_RETRY_SECS,
|
||||
online_check_retry_secs_, found);
|
||||
get_value(json_document, JSON_ORPHANED_FILE_RETENTION_DAYS,
|
||||
orphaned_file_retention_days_, found);
|
||||
get_value(json_document, JSON_PREFERRED_DOWNLOAD_TYPE,
|
||||
preferred_download_type_, found);
|
||||
get_value(json_document, JSON_REMOTE_CONFIG, remote_config_, found);
|
||||
@ -1081,17 +1069,10 @@ auto app_config::load() -> bool {
|
||||
std::uint64_t version{};
|
||||
get_value(json_document, JSON_VERSION, version, found);
|
||||
|
||||
// Handle configuration defaults for new config versions
|
||||
if (version != REPERTORY_CONFIG_VERSION) {
|
||||
version_ = REPERTORY_CONFIG_VERSION;
|
||||
if (version_ == 1U) {
|
||||
if (low_freq_interval_secs_ == 0UL) {
|
||||
set_value(low_freq_interval_secs_, default_low_freq_interval_secs);
|
||||
}
|
||||
|
||||
if (max_cache_size_bytes_ == 0UL) {
|
||||
set_value(max_cache_size_bytes_, default_max_cache_size_bytes);
|
||||
}
|
||||
}
|
||||
// TODO upgrade future version
|
||||
found = false;
|
||||
}
|
||||
|
||||
@ -1218,6 +1199,10 @@ void app_config::set_online_check_retry_secs(std::uint16_t value) {
|
||||
set_value(online_check_retry_secs_, value);
|
||||
}
|
||||
|
||||
void app_config::set_orphaned_file_retention_days(std::uint16_t value) {
|
||||
set_value(orphaned_file_retention_days_, value);
|
||||
}
|
||||
|
||||
void app_config::set_preferred_download_type(const download_type &value) {
|
||||
set_value(preferred_download_type_, value);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "comm/packet/packet_client.hpp"
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/packet_client_timeout.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/collection.hpp"
|
||||
@ -106,8 +105,8 @@ void packet_client::put_client(std::shared_ptr<client> &cli) {
|
||||
}
|
||||
}
|
||||
|
||||
auto packet_client::read_packet(client &cli, packet &response) const
|
||||
-> packet::error_type {
|
||||
auto packet_client::read_packet(client &cli,
|
||||
packet &response) const -> packet::error_type {
|
||||
data_buffer buffer(sizeof(std::uint32_t));
|
||||
const auto read_buffer = [&]() {
|
||||
std::uint32_t offset{};
|
||||
@ -148,8 +147,8 @@ void packet_client::resolve() {
|
||||
.resolve(cfg_.host_name_or_ip, std::to_string(cfg_.api_port));
|
||||
}
|
||||
|
||||
auto packet_client::send(std::string_view method, std::uint32_t &service_flags)
|
||||
-> packet::error_type {
|
||||
auto packet_client::send(std::string_view method,
|
||||
std::uint32_t &service_flags) -> packet::error_type {
|
||||
packet request;
|
||||
return send(method, request, service_flags);
|
||||
}
|
||||
@ -161,8 +160,8 @@ auto packet_client::send(std::string_view method, packet &request,
|
||||
}
|
||||
|
||||
auto packet_client::send(std::string_view method, packet &request,
|
||||
packet &response, std::uint32_t &service_flags)
|
||||
-> packet::error_type {
|
||||
packet &response,
|
||||
std::uint32_t &service_flags) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto success = false;
|
||||
@ -185,7 +184,7 @@ auto packet_client::send(std::string_view method, packet &request,
|
||||
timeout request_timeout(
|
||||
[method, current_client]() {
|
||||
event_system::instance().raise<packet_client_timeout>(
|
||||
"request", function_name, std::string{method});
|
||||
"request", std::string{method});
|
||||
packet_client::close(*current_client);
|
||||
},
|
||||
std::chrono::milliseconds(cfg_.send_timeout_ms));
|
||||
@ -207,7 +206,7 @@ auto packet_client::send(std::string_view method, packet &request,
|
||||
timeout response_timeout(
|
||||
[method, current_client]() {
|
||||
event_system::instance().raise<packet_client_timeout>(
|
||||
"response", function_name, std::string{method});
|
||||
"response", std::string{method});
|
||||
packet_client::close(*current_client);
|
||||
},
|
||||
std::chrono::milliseconds(cfg_.recv_timeout_ms));
|
||||
|
@ -191,10 +191,6 @@ void rdb_file_db::enumerate_item_list(
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (not list.empty()) {
|
||||
callback(list);
|
||||
}
|
||||
}
|
||||
|
||||
auto rdb_file_db::get_api_path(const std::string &source_path,
|
||||
@ -207,8 +203,9 @@ auto rdb_file_db::get_api_path(const std::string &source_path,
|
||||
});
|
||||
}
|
||||
|
||||
auto rdb_file_db::get_directory_api_path(
|
||||
const std::string &source_path, std::string &api_path) const -> api_error {
|
||||
auto rdb_file_db::get_directory_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto result = perform_action(function_name, [&]() -> rocksdb::Status {
|
||||
@ -231,8 +228,9 @@ auto rdb_file_db::get_directory_api_path(
|
||||
: result;
|
||||
}
|
||||
|
||||
auto rdb_file_db::get_directory_source_path(
|
||||
const std::string &api_path, std::string &source_path) const -> api_error {
|
||||
auto rdb_file_db::get_directory_source_path(const std::string &api_path,
|
||||
std::string &source_path) const
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto result = perform_action(function_name, [&]() -> rocksdb::Status {
|
||||
@ -293,8 +291,9 @@ auto rdb_file_db::get_file_data(const std::string &api_path,
|
||||
return result;
|
||||
}
|
||||
|
||||
auto rdb_file_db::get_file_source_path(
|
||||
const std::string &api_path, std::string &source_path) const -> api_error {
|
||||
auto rdb_file_db::get_file_source_path(const std::string &api_path,
|
||||
std::string &source_path) const
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto result = perform_action(function_name, [&]() -> rocksdb::Status {
|
||||
|
@ -81,10 +81,6 @@ void rdb_meta_db::enumerate_api_path_list(
|
||||
callback(list);
|
||||
list.clear();
|
||||
}
|
||||
|
||||
if (not list.empty()) {
|
||||
callback(list);
|
||||
}
|
||||
}
|
||||
|
||||
auto rdb_meta_db::get_api_path(const std::string &source_path,
|
||||
@ -318,9 +314,10 @@ void rdb_meta_db::remove_api_path(const std::string &api_path) {
|
||||
}
|
||||
}
|
||||
|
||||
auto rdb_meta_db::remove_api_path(
|
||||
const std::string &api_path, const std::string &source_path,
|
||||
rocksdb::Transaction *txn) -> rocksdb::Status {
|
||||
auto rdb_meta_db::remove_api_path(const std::string &api_path,
|
||||
const std::string &source_path,
|
||||
rocksdb::Transaction *txn)
|
||||
-> rocksdb::Status {
|
||||
auto txn_res = txn->Delete(pinned_family_, api_path);
|
||||
if (not txn_res.ok()) {
|
||||
return txn_res;
|
||||
|
@ -65,8 +65,9 @@ sqlite_file_db::sqlite_file_db(const app_config &cfg) {
|
||||
|
||||
sqlite_file_db::~sqlite_file_db() { db_.reset(); }
|
||||
|
||||
auto sqlite_file_db::add_directory(
|
||||
const std::string &api_path, const std::string &source_path) -> api_error {
|
||||
auto sqlite_file_db::add_directory(const std::string &api_path,
|
||||
const std::string &source_path)
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto result = utils::db::sqlite::db_insert{*db_, file_table}
|
||||
@ -157,10 +158,6 @@ void sqlite_file_db::enumerate_item_list(
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (not list.empty()) {
|
||||
callback(list);
|
||||
}
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_api_path(const std::string &source_path,
|
||||
@ -182,8 +179,9 @@ auto sqlite_file_db::get_api_path(const std::string &source_path,
|
||||
return api_error::item_not_found;
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_directory_api_path(
|
||||
const std::string &source_path, std::string &api_path) const -> api_error {
|
||||
auto sqlite_file_db::get_directory_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
-> api_error {
|
||||
auto result = utils::db::sqlite::db_select{*db_, file_table}
|
||||
.column("api_path")
|
||||
.where("source_path")
|
||||
@ -204,8 +202,9 @@ auto sqlite_file_db::get_directory_api_path(
|
||||
return api_error::directory_not_found;
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_directory_source_path(
|
||||
const std::string &api_path, std::string &source_path) const -> api_error {
|
||||
auto sqlite_file_db::get_directory_source_path(const std::string &api_path,
|
||||
std::string &source_path) const
|
||||
-> api_error {
|
||||
auto result = utils::db::sqlite::db_select{*db_, file_table}
|
||||
.column("source_path")
|
||||
.where("api_path")
|
||||
@ -226,8 +225,9 @@ auto sqlite_file_db::get_directory_source_path(
|
||||
return api_error::directory_not_found;
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_file_api_path(
|
||||
const std::string &source_path, std::string &api_path) const -> api_error {
|
||||
auto sqlite_file_db::get_file_api_path(const std::string &source_path,
|
||||
std::string &api_path) const
|
||||
-> api_error {
|
||||
auto result = utils::db::sqlite::db_select{*db_, file_table}
|
||||
.column("api_path")
|
||||
.where("source_path")
|
||||
@ -286,8 +286,9 @@ auto sqlite_file_db::get_file_data(const std::string &api_path,
|
||||
return api_error::item_not_found;
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_file_source_path(
|
||||
const std::string &api_path, std::string &source_path) const -> api_error {
|
||||
auto sqlite_file_db::get_file_source_path(const std::string &api_path,
|
||||
std::string &source_path) const
|
||||
-> api_error {
|
||||
auto result = utils::db::sqlite::db_select{*db_, file_table}
|
||||
.column("source_path")
|
||||
.where("api_path")
|
||||
@ -329,8 +330,9 @@ auto sqlite_file_db::get_item_list(stop_type_callback stop_requested_cb) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto sqlite_file_db::get_source_path(
|
||||
const std::string &api_path, std::string &source_path) const -> api_error {
|
||||
auto sqlite_file_db::get_source_path(const std::string &api_path,
|
||||
std::string &source_path) const
|
||||
-> api_error {
|
||||
auto result = utils::db::sqlite::db_select{*db_, file_table}
|
||||
.column("source_path")
|
||||
.where("api_path")
|
||||
|
@ -95,10 +95,6 @@ void sqlite_meta_db::enumerate_api_path_list(
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (not list.empty()) {
|
||||
callback(list);
|
||||
}
|
||||
}
|
||||
|
||||
auto sqlite_meta_db::get_api_path(const std::string &source_path,
|
||||
|
@ -39,11 +39,12 @@ auto directory_cache::get_directory(std::uint64_t handle)
|
||||
-> std::shared_ptr<directory_iterator> {
|
||||
recur_mutex_lock directory_lock(directory_mutex_);
|
||||
auto iter =
|
||||
std::ranges::find_if(directory_lookup_, [handle](auto &&item) -> bool {
|
||||
auto &&handles = item.second.handles;
|
||||
return std::find(handles.begin(), handles.end(), handle) !=
|
||||
item.second.handles.end();
|
||||
});
|
||||
std::find_if(directory_lookup_.begin(), directory_lookup_.end(),
|
||||
[handle](auto &&item) -> bool {
|
||||
auto &&handles = item.second.handles;
|
||||
return std::find(handles.begin(), handles.end(), handle) !=
|
||||
item.second.handles.end();
|
||||
});
|
||||
if (iter != directory_lookup_.end()) {
|
||||
return iter->second.iterator;
|
||||
}
|
||||
@ -67,11 +68,12 @@ auto directory_cache::remove_directory(const std::string &api_path)
|
||||
void directory_cache::remove_directory(std::uint64_t handle) {
|
||||
recur_mutex_lock directory_lock(directory_mutex_);
|
||||
auto iter =
|
||||
std::ranges::find_if(directory_lookup_, [handle](auto &&item) -> bool {
|
||||
auto &&handles = item.second.handles;
|
||||
return std::find(handles.begin(), handles.end(), handle) !=
|
||||
item.second.handles.end();
|
||||
});
|
||||
std::find_if(directory_lookup_.begin(), directory_lookup_.end(),
|
||||
[handle](auto &&item) -> bool {
|
||||
auto &&handles = item.second.handles;
|
||||
return std::find(handles.begin(), handles.end(), handle) !=
|
||||
item.second.handles.end();
|
||||
});
|
||||
if (iter == directory_lookup_.end()) {
|
||||
return;
|
||||
}
|
||||
|
@ -102,9 +102,10 @@ auto directory_iterator::get_directory_item(std::size_t offset,
|
||||
|
||||
auto directory_iterator::get_directory_item(const std::string &api_path,
|
||||
directory_item &di) -> api_error {
|
||||
auto iter = std::ranges::find_if(items_, [&api_path](auto &&item) -> bool {
|
||||
return api_path == item.api_path;
|
||||
});
|
||||
auto iter =
|
||||
std::find_if(items_.begin(), items_.end(), [&](const auto &item) -> bool {
|
||||
return api_path == item.api_path;
|
||||
});
|
||||
if (iter == items_.end()) {
|
||||
return api_error::item_not_found;
|
||||
}
|
||||
@ -125,10 +126,10 @@ auto directory_iterator::get_json(std::size_t offset, json &item) -> int {
|
||||
|
||||
auto directory_iterator::get_next_directory_offset(
|
||||
const std::string &api_path) const -> std::size_t {
|
||||
const auto iter =
|
||||
std::ranges::find_if(items_, [&api_path](auto &&dir_item) -> bool {
|
||||
return api_path == dir_item.api_path;
|
||||
});
|
||||
const auto iter = std::find_if(items_.begin(), items_.end(),
|
||||
[&api_path](const auto &dir_item) -> bool {
|
||||
return api_path == dir_item.api_path;
|
||||
});
|
||||
|
||||
return (iter == items_.end()) ? 0U
|
||||
: static_cast<std::size_t>(
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/fuse_args_parsed.hpp"
|
||||
#include "events/types/fuse_event.hpp"
|
||||
#include "events/types/unmount_requested.hpp"
|
||||
#include "events/types/unmount_result.hpp"
|
||||
#include "initialize.hpp"
|
||||
@ -92,7 +90,7 @@ fuse_base::fuse_base(app_config &config) : config_(config) {
|
||||
fuse_ops_.flag_reserved = 0;
|
||||
#endif // FUSE_USE_VERSION < 30
|
||||
|
||||
E_SUBSCRIBE(unmount_requested, [this](const unmount_requested &) {
|
||||
E_SUBSCRIBE_EXACT(unmount_requested, [this](const unmount_requested &) {
|
||||
std::thread([this]() { this->shutdown(); }).detach();
|
||||
});
|
||||
}
|
||||
@ -120,8 +118,8 @@ auto fuse_base::chflags_(const char *path, uint32_t flags) -> int {
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_base::chmod_(const char *path, mode_t mode, struct fuse_file_info *fi)
|
||||
-> int {
|
||||
auto fuse_base::chmod_(const char *path, mode_t mode,
|
||||
struct fuse_file_info *fi) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -188,7 +186,7 @@ void fuse_base::display_options(
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
fuse_cmdline_help();
|
||||
#else
|
||||
struct fuse_operations fuse_ops{};
|
||||
struct fuse_operations fuse_ops {};
|
||||
fuse_main(args.size(),
|
||||
reinterpret_cast<char **>(const_cast<char **>(args.data())),
|
||||
&fuse_ops, nullptr);
|
||||
@ -198,7 +196,7 @@ void fuse_base::display_options(
|
||||
}
|
||||
|
||||
void fuse_base::display_version_information(std::vector<const char *> args) {
|
||||
struct fuse_operations fuse_ops{};
|
||||
struct fuse_operations fuse_ops {};
|
||||
fuse_main(static_cast<int>(args.size()),
|
||||
reinterpret_cast<char **>(const_cast<char **>(args.data())),
|
||||
&fuse_ops, nullptr);
|
||||
@ -336,8 +334,8 @@ auto fuse_base::getxtimes_(const char *path, struct timespec *bkuptime,
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_base::init_(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * {
|
||||
auto fuse_base::init_(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void * {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return execute_void_pointer_callback(function_name, [&]() -> void * {
|
||||
@ -410,7 +408,7 @@ auto fuse_base::mount(std::vector<std::string> args) -> int {
|
||||
|
||||
char *mount_location{nullptr};
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
struct fuse_cmdline_opts opts{};
|
||||
struct fuse_cmdline_opts opts {};
|
||||
fuse_parse_cmdline(&fa, &opts);
|
||||
mount_location = opts.mountpoint;
|
||||
#else
|
||||
@ -479,8 +477,8 @@ auto fuse_base::read_(const char *path, char *buffer, size_t read_size,
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_base::readdir_(const char *path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir, off_t offset,
|
||||
struct fuse_file_info *fi, fuse_readdir_flags flags)
|
||||
-> int {
|
||||
struct fuse_file_info *fi,
|
||||
fuse_readdir_flags flags) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -512,8 +510,8 @@ auto fuse_base::release_(const char *path, struct fuse_file_info *fi) -> int {
|
||||
});
|
||||
}
|
||||
|
||||
auto fuse_base::releasedir_(const char *path, struct fuse_file_info *fi)
|
||||
-> int {
|
||||
auto fuse_base::releasedir_(const char *path,
|
||||
struct fuse_file_info *fi) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -523,8 +521,8 @@ auto fuse_base::releasedir_(const char *path, struct fuse_file_info *fi)
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_base::rename_(const char *from, const char *to, unsigned int flags)
|
||||
-> int {
|
||||
auto fuse_base::rename_(const char *from, const char *to,
|
||||
unsigned int flags) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -603,17 +601,12 @@ auto fuse_base::listxattr_(const char *path, char *buffer, size_t size) -> int {
|
||||
}
|
||||
|
||||
void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
event_system::instance().raise<fuse_args_parsed>(
|
||||
std::accumulate(args.begin(), args.end(), std::string(),
|
||||
[](auto &&command_line, auto &&arg) -> auto {
|
||||
command_line +=
|
||||
(command_line.empty() ? arg
|
||||
: (" " + std::string(arg)));
|
||||
return command_line;
|
||||
}),
|
||||
function_name);
|
||||
event_system::instance().raise<fuse_args_parsed>(std::accumulate(
|
||||
args.begin(), args.end(), std::string(),
|
||||
[](auto &&command_line, auto &&arg) -> auto {
|
||||
command_line += (command_line.empty() ? arg : (" " + std::string(arg)));
|
||||
return command_line;
|
||||
}));
|
||||
}
|
||||
|
||||
auto fuse_base::parse_args(std::vector<std::string> &args) -> int {
|
||||
@ -708,7 +701,7 @@ void fuse_base::raise_fuse_event(std::string_view function_name,
|
||||
(config_.get_event_level() >= event_level::trace)) {
|
||||
std::string func{function_name};
|
||||
event_system::instance().raise<fuse_event>(
|
||||
api_path, ret, utils::string::right_trim(func, '_'));
|
||||
utils::string::right_trim(func, '_'), std::string{api_path}, ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,7 +754,7 @@ void fuse_base::shutdown() {
|
||||
|
||||
auto res = unmount(get_mount_location());
|
||||
event_system::instance().raise<unmount_result>(function_name,
|
||||
get_mount_location(), res);
|
||||
get_mount_location(), res);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
@ -774,8 +767,8 @@ auto fuse_base::setattr_x_(const char *path, struct setattr_x *attr) -> int {
|
||||
});
|
||||
}
|
||||
|
||||
auto fuse_base::setbkuptime_(const char *path, const struct timespec *bkuptime)
|
||||
-> int {
|
||||
auto fuse_base::setbkuptime_(const char *path,
|
||||
const struct timespec *bkuptime) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -784,8 +777,8 @@ auto fuse_base::setbkuptime_(const char *path, const struct timespec *bkuptime)
|
||||
});
|
||||
}
|
||||
|
||||
auto fuse_base::setchgtime_(const char *path, const struct timespec *chgtime)
|
||||
-> int {
|
||||
auto fuse_base::setchgtime_(const char *path,
|
||||
const struct timespec *chgtime) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
@ -794,8 +787,8 @@ auto fuse_base::setchgtime_(const char *path, const struct timespec *chgtime)
|
||||
});
|
||||
}
|
||||
|
||||
auto fuse_base::setcrtime_(const char *path, const struct timespec *crtime)
|
||||
-> int {
|
||||
auto fuse_base::setcrtime_(const char *path,
|
||||
const struct timespec *crtime) -> int {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
return instance().execute_callback(
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/drive_mount_result.hpp"
|
||||
#include "events/types/drive_mounted.hpp"
|
||||
#include "events/types/drive_stop_timed_out.hpp"
|
||||
#include "events/types/drive_unmount_pending.hpp"
|
||||
#include "events/types/drive_unmounted.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
@ -85,8 +84,8 @@ auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info * /*file_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto fuse_drive::chown_impl(std::string api_path, uid_t uid,
|
||||
gid_t gid) -> api_error {
|
||||
auto fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error {
|
||||
#endif
|
||||
return check_and_perform(
|
||||
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
|
||||
@ -282,7 +281,6 @@ void fuse_drive::stop_all() {
|
||||
});
|
||||
|
||||
if (future.wait_for(30s) == std::future_status::timeout) {
|
||||
event_system::instance().raise<drive_stop_timed_out>(function_name);
|
||||
app_config::set_stop_requested();
|
||||
future.wait();
|
||||
}
|
||||
@ -296,7 +294,7 @@ void fuse_drive::destroy_impl(void *ptr) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
|
||||
stop_all();
|
||||
|
||||
@ -305,7 +303,7 @@ void fuse_drive::destroy_impl(void *ptr) {
|
||||
fuse_base::destroy_impl(ptr);
|
||||
|
||||
event_system::instance().raise<drive_unmounted>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
}
|
||||
|
||||
auto fuse_drive::fallocate_impl(std::string /*api_path*/, int mode,
|
||||
@ -494,8 +492,8 @@ auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info * /*file_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto fuse_drive::getattr_impl(std::string api_path,
|
||||
struct stat *unix_st) -> api_error {
|
||||
auto fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
|
||||
-> api_error {
|
||||
#endif
|
||||
auto parent = utils::path::get_parent_api_path(api_path);
|
||||
|
||||
@ -561,8 +559,8 @@ auto fuse_drive::getxtimes_impl(std::string api_path, struct timespec *bkuptime,
|
||||
#endif // __APPLE__
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto fuse_drive::init_impl(struct fuse_conn_info *conn,
|
||||
struct fuse_config *cfg) -> void * {
|
||||
auto fuse_drive::init_impl(struct fuse_conn_info *conn, struct fuse_config *cfg)
|
||||
-> void * {
|
||||
#else
|
||||
void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
|
||||
#endif
|
||||
@ -619,7 +617,7 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
|
||||
}
|
||||
|
||||
event_system::instance().raise<drive_mounted>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
} catch (const std::exception &e) {
|
||||
utils::error::raise_error(function_name, e, "exception during fuse init");
|
||||
|
||||
@ -666,17 +664,13 @@ auto fuse_drive::mkdir_impl(std::string api_path, mode_t mode) -> api_error {
|
||||
}
|
||||
|
||||
void fuse_drive::notify_fuse_main_exit(int &ret) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not was_mounted_) {
|
||||
return;
|
||||
if (was_mounted_) {
|
||||
event_system::instance().raise<drive_mount_result>(
|
||||
function_name, get_mount_location(), std::to_string(ret));
|
||||
event_system::instance().stop();
|
||||
logging_consumer_.reset();
|
||||
console_consumer_.reset();
|
||||
}
|
||||
|
||||
event_system::instance().raise<drive_mount_result>(
|
||||
function_name, get_mount_location(), std::to_string(ret));
|
||||
event_system::instance().stop();
|
||||
logging_consumer_.reset();
|
||||
console_consumer_.reset();
|
||||
}
|
||||
|
||||
auto fuse_drive::open_impl(std::string api_path,
|
||||
@ -804,8 +798,9 @@ auto fuse_drive::release_impl(std::string /*api_path*/,
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
auto fuse_drive::releasedir_impl(
|
||||
std::string /*api_path*/, struct fuse_file_info *file_info) -> api_error {
|
||||
auto fuse_drive::releasedir_impl(std::string /*api_path*/,
|
||||
struct fuse_file_info *file_info)
|
||||
-> api_error {
|
||||
auto iter = directory_cache_->get_directory(file_info->fh);
|
||||
if (iter == nullptr) {
|
||||
return api_error::invalid_handle;
|
||||
@ -823,8 +818,8 @@ auto fuse_drive::rename_directory(const std::string &from_api_path,
|
||||
}
|
||||
|
||||
auto fuse_drive::rename_file(const std::string &from_api_path,
|
||||
const std::string &to_api_path,
|
||||
bool overwrite) -> int {
|
||||
const std::string &to_api_path, bool overwrite)
|
||||
-> int {
|
||||
auto res = fm_->rename_file(from_api_path, to_api_path, overwrite);
|
||||
errno = std::abs(utils::from_api_error(res));
|
||||
return (res == api_error::success) ? 0 : -1;
|
||||
@ -834,8 +829,8 @@ auto fuse_drive::rename_file(const std::string &from_api_path,
|
||||
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path,
|
||||
unsigned int /*flags*/) -> api_error {
|
||||
#else
|
||||
auto fuse_drive::rename_impl(std::string from_api_path,
|
||||
std::string to_api_path) -> api_error {
|
||||
auto fuse_drive::rename_impl(std::string from_api_path, std::string to_api_path)
|
||||
-> api_error {
|
||||
#endif
|
||||
auto res = check_parent_access(to_api_path, W_OK | X_OK);
|
||||
if (res != api_error::success) {
|
||||
@ -937,15 +932,15 @@ auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
|
||||
}
|
||||
#else // __APPLE__
|
||||
auto fuse_drive::getxattr_impl(std::string api_path, const char *name,
|
||||
char *value, size_t size,
|
||||
int &attribute_size) -> api_error {
|
||||
char *value, size_t size, int &attribute_size)
|
||||
-> api_error {
|
||||
return getxattr_common(api_path, name, value, size, attribute_size, nullptr);
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
|
||||
int &required_size,
|
||||
bool &return_size) -> api_error {
|
||||
int &required_size, bool &return_size)
|
||||
-> api_error {
|
||||
auto check_size = (size == 0);
|
||||
|
||||
auto res = check_parent_access(api_path, X_OK);
|
||||
@ -985,8 +980,8 @@ auto fuse_drive::listxattr_impl(std::string api_path, char *buffer, size_t size,
|
||||
return res;
|
||||
}
|
||||
|
||||
auto fuse_drive::removexattr_impl(std::string api_path,
|
||||
const char *name) -> api_error {
|
||||
auto fuse_drive::removexattr_impl(std::string api_path, const char *name)
|
||||
-> api_error {
|
||||
std::string attribute_name;
|
||||
#if defined(__APPLE__)
|
||||
auto res = parse_xattr_parameters(name, 0, attribute_name, api_path);
|
||||
@ -1014,8 +1009,8 @@ auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
|
||||
uint32_t position) -> api_error {
|
||||
#else // __APPLE__
|
||||
auto fuse_drive::setxattr_impl(std::string api_path, const char *name,
|
||||
const char *value, size_t size,
|
||||
int flags) -> api_error {
|
||||
const char *value, size_t size, int flags)
|
||||
-> api_error {
|
||||
#endif
|
||||
std::string attribute_name;
|
||||
#if defined(__APPLE__)
|
||||
@ -1093,8 +1088,8 @@ void fuse_drive::set_item_meta(const std::string &api_path,
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
auto fuse_drive::setattr_x_impl(std::string api_path,
|
||||
struct setattr_x *attr) -> api_error {
|
||||
auto fuse_drive::setattr_x_impl(std::string api_path, struct setattr_x *attr)
|
||||
-> api_error {
|
||||
bool exists{};
|
||||
auto res = provider_.is_file(api_path, exists);
|
||||
if (res != api_error::success) {
|
||||
@ -1148,7 +1143,7 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
|
||||
ts[0].tv_sec = attr->acctime.tv_sec;
|
||||
ts[0].tv_nsec = attr->acctime.tv_nsec;
|
||||
} else {
|
||||
struct timeval tv {};
|
||||
struct timeval tv{};
|
||||
gettimeofday(&tv, NULL);
|
||||
ts[0].tv_sec = tv.tv_sec;
|
||||
ts[0].tv_nsec = tv.tv_usec * 1000;
|
||||
@ -1193,8 +1188,9 @@ auto fuse_drive::setattr_x_impl(std::string api_path,
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
auto fuse_drive::setbkuptime_impl(
|
||||
std::string api_path, const struct timespec *bkuptime) -> api_error {
|
||||
auto fuse_drive::setbkuptime_impl(std::string api_path,
|
||||
const struct timespec *bkuptime)
|
||||
-> api_error {
|
||||
return check_and_perform(
|
||||
api_path, X_OK, [&](api_meta_map &meta) -> api_error {
|
||||
auto nanos = bkuptime->tv_nsec +
|
||||
@ -1230,8 +1226,8 @@ auto fuse_drive::setvolname_impl(const char * /*volname*/) -> api_error {
|
||||
return api_error::success;
|
||||
}
|
||||
|
||||
auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
|
||||
struct statfs *stbuf) -> api_error {
|
||||
auto fuse_drive::statfs_x_impl(std::string /*api_path*/, struct statfs *stbuf)
|
||||
-> api_error {
|
||||
if (statfs(&config_.get_cache_directory()[0], stbuf) != 0) {
|
||||
return api_error::os_error;
|
||||
}
|
||||
@ -1256,8 +1252,8 @@ auto fuse_drive::statfs_x_impl(std::string /*api_path*/,
|
||||
return api_error::success;
|
||||
}
|
||||
#else // __APPLE__
|
||||
auto fuse_drive::statfs_impl(std::string /*api_path*/,
|
||||
struct statvfs *stbuf) -> api_error {
|
||||
auto fuse_drive::statfs_impl(std::string /*api_path*/, struct statvfs *stbuf)
|
||||
-> api_error {
|
||||
if (statvfs(config_.get_cache_directory().data(), stbuf) != 0) {
|
||||
return api_error::os_error;
|
||||
}
|
||||
@ -1341,8 +1337,8 @@ auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2],
|
||||
struct fuse_file_info * /*file_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto fuse_drive::utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2]) -> api_error {
|
||||
auto fuse_drive::utimens_impl(std::string api_path, const struct timespec tv[2])
|
||||
-> api_error {
|
||||
#endif
|
||||
api_meta_map meta;
|
||||
auto res = provider_.get_item_meta(api_path, meta);
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "platform/platform.hpp"
|
||||
#include "providers/i_provider.hpp"
|
||||
#include "utils/common.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
namespace repertory {
|
||||
@ -35,8 +33,8 @@ auto fuse_drive_base::access_impl(std::string api_path, int mask) -> api_error {
|
||||
return check_access(api_path, mask);
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_access(const std::string &api_path,
|
||||
int mask) const -> api_error {
|
||||
auto fuse_drive_base::check_access(const std::string &api_path, int mask) const
|
||||
-> api_error {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
api_meta_map meta;
|
||||
@ -137,8 +135,9 @@ auto fuse_drive_base::check_and_perform(
|
||||
return action(meta);
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_open_flags(
|
||||
int flags, int mask, const api_error &fail_error) -> api_error {
|
||||
auto fuse_drive_base::check_open_flags(int flags, int mask,
|
||||
const api_error &fail_error)
|
||||
-> api_error {
|
||||
return (((flags & mask) == 0) ? api_error::success : fail_error);
|
||||
}
|
||||
|
||||
@ -195,8 +194,8 @@ auto fuse_drive_base::check_parent_access(const std::string &api_path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto fuse_drive_base::check_readable(int flags,
|
||||
const api_error &fail_error) -> api_error {
|
||||
auto fuse_drive_base::check_readable(int flags, const api_error &fail_error)
|
||||
-> api_error {
|
||||
auto mode = (flags & O_ACCMODE);
|
||||
return ((mode == O_WRONLY) ? fail_error : api_error::success);
|
||||
}
|
||||
@ -254,13 +253,16 @@ auto fuse_drive_base::get_uid_from_meta(const api_meta_map &meta) -> uid_t {
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
auto fuse_drive_base::parse_xattr_parameters(
|
||||
const char *name, const uint32_t &position, std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error {
|
||||
auto fuse_drive_base::parse_xattr_parameters(const char *name,
|
||||
const uint32_t &position,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error {
|
||||
#else // !defined(__APPLE__)
|
||||
auto fuse_drive_base::parse_xattr_parameters(
|
||||
const char *name, std::string &attribute_name,
|
||||
const std::string &api_path) -> api_error {
|
||||
auto fuse_drive_base::parse_xattr_parameters(const char *name,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error {
|
||||
#endif // defined(__APPLE__)
|
||||
auto res = api_path.empty() ? api_error::bad_address : api_error::success;
|
||||
if (res != api_error::success) {
|
||||
@ -293,9 +295,11 @@ auto fuse_drive_base::parse_xattr_parameters(
|
||||
std::string &attribute_name, const std::string &api_path) -> api_error {
|
||||
auto res = parse_xattr_parameters(name, position, attribute_name, api_path);
|
||||
#else // !defined(__APPLE__)
|
||||
auto fuse_drive_base::parse_xattr_parameters(
|
||||
const char *name, const char *value, size_t size,
|
||||
std::string &attribute_name, const std::string &api_path) -> api_error {
|
||||
auto fuse_drive_base::parse_xattr_parameters(const char *name,
|
||||
const char *value, size_t size,
|
||||
std::string &attribute_name,
|
||||
const std::string &api_path)
|
||||
-> api_error {
|
||||
auto res = parse_xattr_parameters(name, attribute_name, api_path);
|
||||
#endif // defined(__APPLE__)
|
||||
if (res != api_error::success) {
|
||||
|
@ -43,8 +43,8 @@
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory::remote_fuse {
|
||||
auto remote_fuse_drive::access_impl(std::string api_path, int mask)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::access_impl(std::string api_path,
|
||||
int mask) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_access(api_path.c_str(), mask));
|
||||
}
|
||||
@ -62,8 +62,8 @@ auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::chmod_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::chmod_impl(std::string api_path,
|
||||
mode_t mode) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(remote_instance_->fuse_chmod(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
@ -74,8 +74,8 @@ auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid, gid_t gid)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::chown_impl(std::string api_path, uid_t uid,
|
||||
gid_t gid) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_chown(api_path.c_str(), uid, gid));
|
||||
@ -94,7 +94,7 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
|
||||
if (server_) {
|
||||
server_->stop();
|
||||
@ -116,15 +116,14 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
|
||||
}
|
||||
|
||||
event_system::instance().raise<drive_unmounted>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
|
||||
fuse_base::destroy_impl(ptr);
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::fgetattr_impl(std::string api_path,
|
||||
struct stat *unix_st,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::fgetattr_impl(
|
||||
std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info *f_info) -> api_error {
|
||||
remote::stat r_stat{};
|
||||
auto directory = false;
|
||||
|
||||
@ -185,8 +184,8 @@ auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::getattr_impl(std::string api_path, struct stat *unix_st)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::getattr_impl(std::string api_path,
|
||||
struct stat *unix_st) -> api_error {
|
||||
#endif
|
||||
bool directory = false;
|
||||
remote::stat r_stat{};
|
||||
@ -264,14 +263,14 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
|
||||
server_ = std::make_shared<server>(config_);
|
||||
server_->start();
|
||||
event_system::instance().raise<drive_mounted>(function_name,
|
||||
get_mount_location());
|
||||
get_mount_location());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::mkdir_impl(std::string api_path, mode_t mode)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::mkdir_impl(std::string api_path,
|
||||
mode_t mode) -> api_error {
|
||||
return utils::to_api_error(remote_instance_->fuse_mkdir(
|
||||
api_path.c_str(), static_cast<remote::file_mode>(mode)));
|
||||
}
|
||||
@ -296,9 +295,8 @@ auto remote_fuse_drive::open_impl(std::string api_path,
|
||||
f_info->fh));
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::opendir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::opendir_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
if ((f_info->flags & O_APPEND) == O_APPEND ||
|
||||
(f_info->flags & O_EXCL) == O_EXCL) {
|
||||
return api_error::directory_exists;
|
||||
@ -311,14 +309,12 @@ auto remote_fuse_drive::opendir_impl(std::string api_path,
|
||||
void remote_fuse_drive::populate_stat(const remote::stat &r_stat,
|
||||
bool directory, struct stat &unix_st) {
|
||||
std::memset(&unix_st, 0, sizeof(struct stat));
|
||||
unix_st.st_blksize =
|
||||
static_cast<decltype(unix_st.st_blksize)>(r_stat.st_blksize);
|
||||
unix_st.st_blocks =
|
||||
static_cast<decltype(unix_st.st_blocks)>(r_stat.st_blocks);
|
||||
unix_st.st_blksize = r_stat.st_blksize;
|
||||
unix_st.st_blocks = static_cast<blkcnt_t>(r_stat.st_blocks);
|
||||
unix_st.st_gid = r_stat.st_gid;
|
||||
unix_st.st_mode = (directory ? S_IFDIR : S_IFREG) | r_stat.st_mode;
|
||||
unix_st.st_nlink = r_stat.st_nlink;
|
||||
unix_st.st_size = static_cast<decltype(unix_st.st_size)>(r_stat.st_size);
|
||||
unix_st.st_size = static_cast<off_t>(r_stat.st_size);
|
||||
unix_st.st_uid = r_stat.st_uid;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
@ -377,18 +373,14 @@ auto remote_fuse_drive::read_impl(std::string api_path, char *buffer,
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset,
|
||||
struct fuse_file_info *f_info,
|
||||
fuse_readdir_flags /*flags*/)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::readdir_impl(
|
||||
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *f_info,
|
||||
fuse_readdir_flags /*flags*/) -> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::readdir_impl(
|
||||
std::string api_path, void *buf, fuse_fill_dir_t fuse_fill_dir,
|
||||
off_t offset, struct fuse_file_info *f_info) -> api_error {
|
||||
#endif
|
||||
std::string item_path;
|
||||
int res = 0;
|
||||
@ -416,16 +408,14 @@ auto remote_fuse_drive::readdir_impl(std::string api_path, void *buf,
|
||||
return utils::to_api_error(res);
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::release_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::release_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_release(api_path.c_str(), f_info->fh));
|
||||
}
|
||||
|
||||
auto remote_fuse_drive::releasedir_impl(std::string api_path,
|
||||
struct fuse_file_info *f_info)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::releasedir_impl(
|
||||
std::string api_path, struct fuse_file_info *f_info) -> api_error {
|
||||
return utils::to_api_error(
|
||||
remote_instance_->fuse_releasedir(api_path.c_str(), f_info->fh));
|
||||
}
|
||||
@ -522,8 +512,8 @@ api_error remote_fuse_drive::statfs_x_impl(std::string api_path,
|
||||
return utils::to_api_error(res);
|
||||
}
|
||||
#else // __APPLE__
|
||||
auto remote_fuse_drive::statfs_impl(std::string api_path, struct statvfs *stbuf)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::statfs_impl(std::string api_path,
|
||||
struct statvfs *stbuf) -> api_error {
|
||||
auto res = statvfs(config_.get_data_directory().c_str(), stbuf);
|
||||
if (res == 0) {
|
||||
remote::statfs r_stat{};
|
||||
@ -550,8 +540,8 @@ auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size,
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::truncate_impl(std::string api_path, off_t size)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::truncate_impl(std::string api_path,
|
||||
off_t size) -> api_error {
|
||||
#endif
|
||||
return utils::to_api_error(remote_instance_->fuse_truncate(
|
||||
api_path.c_str(), static_cast<remote::file_offset>(size)));
|
||||
@ -562,10 +552,9 @@ auto remote_fuse_drive::unlink_impl(std::string api_path) -> api_error {
|
||||
}
|
||||
|
||||
#if FUSE_USE_VERSION >= 30
|
||||
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2],
|
||||
struct fuse_file_info * /*f_info*/)
|
||||
-> api_error {
|
||||
auto remote_fuse_drive::utimens_impl(
|
||||
std::string api_path, const struct timespec tv[2],
|
||||
struct fuse_file_info * /*f_info*/) -> api_error {
|
||||
#else
|
||||
auto remote_fuse_drive::utimens_impl(std::string api_path,
|
||||
const struct timespec tv[2]) -> api_error {
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "drives/directory_iterator.hpp"
|
||||
#include "drives/remote/remote_open_file_table.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/remote_server_event.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -37,15 +36,15 @@
|
||||
#include "utils/file.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory::remote_fuse {
|
||||
#define RAISE_REMOTE_FUSE_SERVER_EVENT(func, file, ret) \
|
||||
if (config_.get_enable_drive_events() && \
|
||||
(((config_.get_event_level() >= remote_server_event::level) && \
|
||||
(((config_.get_event_level() >= remote_fuse_server_event::level) && \
|
||||
((ret) < 0)) || \
|
||||
(config_.get_event_level() >= event_level::trace))) \
|
||||
event_system::instance().raise<remote_server_event>(file, ret, func)
|
||||
event_system::instance().raise<remote_fuse_server_event>(std::string{func}, \
|
||||
file, ret)
|
||||
|
||||
remote_server::remote_server(app_config &config, i_fuse_drive &drive,
|
||||
const std::string &mount_location)
|
||||
@ -201,8 +200,8 @@ auto remote_server::fuse_access(const char *path, const std::int32_t &mask)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_chflags(const char *path, std::uint32_t flags)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_chflags(const char *path,
|
||||
std::uint32_t flags) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -314,10 +313,9 @@ length); ret = ((res < 0) ? -errno : 0); #endif
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_fgetattr(
|
||||
const char *path, remote::stat &r_stat, bool &directory,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
r_stat = {};
|
||||
@ -327,7 +325,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
auto res = has_open_info(static_cast<native_handle>(handle), EBADF);
|
||||
if (res == 0) {
|
||||
directory = utils::file::directory(file_path).exists();
|
||||
struct stat64 unix_st{};
|
||||
struct stat64 unix_st {};
|
||||
res = fstat64(static_cast<native_handle>(handle), &unix_st);
|
||||
if (res == 0) {
|
||||
populate_stat(unix_st, r_stat);
|
||||
@ -339,10 +337,9 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_fsetattr_x(
|
||||
const char *path, const remote::setattr_x &attr,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -458,10 +455,9 @@ auto remote_server::fuse_fsync(const char *path, const std::int32_t &datasync,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_ftruncate(
|
||||
const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -489,7 +485,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_stat,
|
||||
|
||||
directory = utils::file::directory(file_path).exists();
|
||||
|
||||
struct stat64 unix_st{};
|
||||
struct stat64 unix_st {};
|
||||
auto res = stat64(file_path.c_str(), &unix_st);
|
||||
if (res == 0) {
|
||||
populate_stat(unix_st, r_stat);
|
||||
@ -554,10 +550,9 @@ STATUS_NOT_IMPLEMENTED; #endif RAISE_REMOTE_FUSE_SERVER_EVENT(function_name,
|
||||
file_path, ret); return ret;
|
||||
}*/
|
||||
|
||||
auto remote_server::fuse_getxtimes(const char *path,
|
||||
remote::file_time &bkuptime,
|
||||
remote::file_time &crtime)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_getxtimes(
|
||||
const char *path, remote::file_time &bkuptime,
|
||||
remote::file_time &crtime) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -662,11 +657,10 @@ auto remote_server::fuse_opendir(const char *path, remote::file_handle &handle)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_read(
|
||||
const char *path, char *buffer, const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -687,8 +681,8 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
return static_cast<packet::error_type>(ret);
|
||||
}
|
||||
|
||||
auto remote_server::fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_rename(const char *from,
|
||||
const char *to) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto from_path = utils::path::combine(mount_location_, {from});
|
||||
@ -726,9 +720,8 @@ auto remote_server::fuse_readdir(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_release(
|
||||
const char *path, const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet::error_type ret = 0;
|
||||
@ -745,9 +738,8 @@ auto remote_server::fuse_release(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_releasedir(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_releasedir(
|
||||
const char *path, const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -792,9 +784,8 @@ auto remote_server::fuse_setattr_x(const char *path, remote::setattr_x &attr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_setbkuptime(const char *path,
|
||||
const remote::file_time &bkuptime)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_setbkuptime(
|
||||
const char *path, const remote::file_time &bkuptime) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -813,9 +804,8 @@ auto remote_server::fuse_setbkuptime(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_setchgtime(const char *path,
|
||||
const remote::file_time &chgtime)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_setchgtime(
|
||||
const char *path, const remote::file_time &chgtime) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -834,9 +824,8 @@ auto remote_server::fuse_setchgtime(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_setcrtime(const char *path,
|
||||
const remote::file_time &crtime)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_setcrtime(
|
||||
const char *path, const remote::file_time &crtime) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -927,9 +916,8 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_truncate(
|
||||
const char *path, const remote::file_offset &size) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -950,8 +938,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
|
||||
}
|
||||
|
||||
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type {
|
||||
std::uint64_t op0,
|
||||
std::uint64_t op1) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -978,11 +966,10 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_write(
|
||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
@ -1012,8 +999,8 @@ auto remote_server::fuse_write_base64(
|
||||
}
|
||||
|
||||
// WinFSP Layer
|
||||
auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_can_delete(PVOID file_desc,
|
||||
PWSTR file_name) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
@ -1038,8 +1025,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_cleanup(PVOID /*file_desc*/, PWSTR file_name,
|
||||
UINT32 flags, BOOLEAN &was_deleted)
|
||||
-> packet::error_type {
|
||||
UINT32 flags,
|
||||
BOOLEAN &was_deleted) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
@ -1116,8 +1103,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, UINT32 attributes,
|
||||
UINT64 /*allocation_size*/, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name, BOOLEAN &exists)
|
||||
-> packet::error_type {
|
||||
std::string &normalized_name,
|
||||
BOOLEAN &exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
@ -1189,9 +1176,8 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_get_file_info(PVOID file_desc,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_get_file_info(
|
||||
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
@ -1234,10 +1220,9 @@ auto remote_server::winfsp_get_security_by_name(
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
|
||||
UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_get_volume_info(
|
||||
UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
drive_.get_volume_info(total_size, free_size, volume_label);
|
||||
@ -1254,11 +1239,10 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_open(
|
||||
PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_desc, remote::file_info *file_info,
|
||||
std::string &normalized_name) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
@ -1299,11 +1283,10 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_overwrite(
|
||||
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
@ -1419,10 +1402,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_rename(
|
||||
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto relative_path = utils::string::to_utf8(file_name);
|
||||
@ -1516,10 +1498,9 @@ auto remote_server::winfsp_set_basic_info(
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto handle = reinterpret_cast<remote::file_handle>(file_desc);
|
||||
@ -1555,12 +1536,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
UINT32 length, BOOLEAN write_to_end,
|
||||
BOOLEAN constrained_io,
|
||||
PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_write(
|
||||
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
*bytes_transferred = 0;
|
||||
@ -1608,9 +1587,8 @@ auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data)
|
||||
-> packet::error_type {
|
||||
auto remote_server::json_create_directory_snapshot(
|
||||
const std::string &path, json &json_data) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto api_path = utils::path::create_api_path(path);
|
||||
@ -1669,8 +1647,8 @@ auto remote_server::json_read_directory_snapshot(
|
||||
}
|
||||
|
||||
auto remote_server::json_release_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
const std::string &path,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
const auto file_path = construct_path(path);
|
||||
|
@ -22,19 +22,29 @@
|
||||
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
||||
|
||||
#include "app_config.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/drive_mounted.hpp"
|
||||
#include "events/types/drive_unmount_pending.hpp"
|
||||
#include "events/types/drive_unmounted.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "version.hpp"
|
||||
|
||||
namespace repertory::remote_winfsp {
|
||||
#define RAISE_REMOTE_WINFSP_CLIENT_EVENT(func, file, ret) \
|
||||
if (config_.get_enable_drive_events() && \
|
||||
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \
|
||||
((ret) != STATUS_SUCCESS)) || \
|
||||
(config_.get_event_level() >= event_level::trace))) \
|
||||
event_system::instance().raise<remote_winfsp_client_event>( \
|
||||
std::string{func}, file, ret)
|
||||
|
||||
remote_client::remote_client(const app_config &config)
|
||||
: config_(config), packet_client_(config.get_remote_config()) {}
|
||||
|
||||
auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_can_delete(PVOID file_desc,
|
||||
PWSTR file_name) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -42,12 +52,18 @@ auto remote_client::winfsp_can_delete(PVOID file_desc, PWSTR file_name)
|
||||
request.encode(file_name);
|
||||
|
||||
std::uint32_t service_flags{};
|
||||
return packet_client_.send(function_name, request, service_flags);
|
||||
auto ret{
|
||||
packet_client_.send(function_name, request, service_flags),
|
||||
};
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name,
|
||||
utils::path::create_api_path(utils::string::to_utf8(file_name)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data)
|
||||
-> packet::error_type {
|
||||
auto remote_client::json_create_directory_snapshot(
|
||||
const std::string &path, json &json_data) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -62,6 +78,7 @@ auto remote_client::json_create_directory_snapshot(const std::string &path,
|
||||
ret = packet::decode_json(response, json_data);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -84,12 +101,13 @@ auto remote_client::json_read_directory_snapshot(
|
||||
ret = packet::decode_json(response, json_data);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::json_release_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
const std::string &path,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -97,12 +115,17 @@ auto remote_client::json_release_directory_snapshot(
|
||||
request.encode(handle);
|
||||
|
||||
std::uint32_t service_flags{};
|
||||
return packet_client_.send(function_name, request, service_flags);
|
||||
auto ret{
|
||||
packet_client_.send(function_name, request, service_flags),
|
||||
};
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||
UINT32 flags, BOOLEAN &was_deleted)
|
||||
-> packet::error_type {
|
||||
UINT32 flags,
|
||||
BOOLEAN &was_deleted) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto handle{
|
||||
@ -131,6 +154,7 @@ auto remote_client::winfsp_cleanup(PVOID file_desc, PWSTR file_name,
|
||||
remove_all(file_path);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -155,6 +179,7 @@ auto remote_client::winfsp_close(PVOID file_desc) -> packet::error_type {
|
||||
if ((ret == STATUS_SUCCESS) ||
|
||||
(ret == static_cast<packet::error_type>(STATUS_INVALID_HANDLE))) {
|
||||
remove_open_info(handle);
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, file_path, ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,8 +190,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, UINT32 attributes,
|
||||
UINT64 allocation_size, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name, BOOLEAN &exists)
|
||||
-> packet::error_type {
|
||||
std::string &normalized_name,
|
||||
BOOLEAN &exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -205,6 +230,8 @@ auto remote_client::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(*file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -222,6 +249,8 @@ auto remote_client::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
};
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -236,9 +265,8 @@ auto remote_client::winfsp_get_dir_buffer([[maybe_unused]] PVOID file_desc,
|
||||
return static_cast<packet::error_type>(STATUS_INVALID_HANDLE);
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_get_file_info(PVOID file_desc,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_get_file_info(
|
||||
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -251,20 +279,20 @@ auto remote_client::winfsp_get_file_info(PVOID file_desc,
|
||||
};
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
|
||||
PUINT32 attributes,
|
||||
std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
request.encode(file_name);
|
||||
request.encode(descriptor_size == nullptr ? std::uint64_t(0U)
|
||||
: *descriptor_size);
|
||||
request.encode(static_cast<std::uint64_t>(
|
||||
descriptor_size == nullptr ? 0 : *descriptor_size));
|
||||
request.encode(static_cast<std::uint8_t>(attributes != nullptr));
|
||||
|
||||
packet response;
|
||||
@ -283,13 +311,14 @@ auto remote_client::winfsp_get_security_by_name(PWSTR file_name,
|
||||
DECODE_OR_IGNORE(&response, *attributes);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name,
|
||||
utils::string::to_utf8(file_name), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_get_volume_info(UINT64 &total_size,
|
||||
UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_get_volume_info(
|
||||
UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -323,14 +352,14 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
|
||||
};
|
||||
event_system::instance().raise<drive_mounted>(function_name, mount_location);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_open(
|
||||
PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_desc, remote::file_info *file_info,
|
||||
std::string &normalized_name) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -361,14 +390,15 @@ auto remote_client::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
}
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(*file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_overwrite(
|
||||
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
|
||||
UINT64 allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -384,6 +414,8 @@ auto remote_client::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
};
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -407,12 +439,17 @@ auto remote_client::winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
ret = response.decode(buffer, *bytes_transferred);
|
||||
#if defined(_WIN32)
|
||||
if ((ret == STATUS_SUCCESS) &&
|
||||
((*bytes_transferred == 0U) || (*bytes_transferred != length))) {
|
||||
(not *bytes_transferred || (*bytes_transferred != length))) {
|
||||
::SetLastError(ERROR_HANDLE_EOF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -435,13 +472,14 @@ auto remote_client::winfsp_read_directory(PVOID file_desc, PWSTR pattern,
|
||||
ret = packet::decode_json(response, item_list);
|
||||
}
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name,
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_rename(
|
||||
PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -451,7 +489,16 @@ auto remote_client::winfsp_rename(PVOID file_desc, PWSTR file_name,
|
||||
request.encode(replace_if_exists);
|
||||
|
||||
std::uint32_t service_flags{};
|
||||
return packet_client_.send(function_name, request, service_flags);
|
||||
auto ret{
|
||||
packet_client_.send(function_name, request, service_flags),
|
||||
};
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name,
|
||||
utils::path::create_api_path(utils::string::to_utf8(file_name)) + "|" +
|
||||
utils::path::create_api_path(utils::string::to_utf8(new_file_name)),
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_set_basic_info(
|
||||
@ -475,13 +522,14 @@ auto remote_client::winfsp_set_basic_info(
|
||||
};
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -496,6 +544,8 @@ auto remote_client::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
};
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -507,7 +557,7 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
|
||||
utils::string::to_utf8(location),
|
||||
};
|
||||
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||
mount_location);
|
||||
mount_location);
|
||||
packet request;
|
||||
request.encode(location);
|
||||
|
||||
@ -516,17 +566,16 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
|
||||
packet_client_.send(function_name, request, service_flags),
|
||||
};
|
||||
event_system::instance().raise<drive_unmounted>(function_name,
|
||||
mount_location);
|
||||
mount_location);
|
||||
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
UINT32 length, BOOLEAN write_to_end,
|
||||
BOOLEAN constrained_io,
|
||||
PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_client::winfsp_write(
|
||||
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
BOOLEAN write_to_end, BOOLEAN constrained_io, PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
packet request;
|
||||
@ -547,6 +596,10 @@ auto remote_client::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
DECODE_OR_IGNORE(&response, *bytes_transferred);
|
||||
DECODE_OR_IGNORE(&response, *file_info);
|
||||
|
||||
if (ret != STATUS_SUCCESS) {
|
||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(
|
||||
function_name, get_open_file_path(to_handle(file_desc)), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "drives/remote/remote_open_file_table.hpp"
|
||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/remote_server_event.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
#include "types/remote.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
@ -42,15 +41,15 @@
|
||||
#include "utils/file_utils.hpp"
|
||||
#include "utils/path.hpp"
|
||||
#include "utils/time.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
namespace repertory::remote_winfsp {
|
||||
#define RAISE_REMOTE_WINFSP_SERVER_EVENT(func, file, ret) \
|
||||
if (config_.get_enable_drive_events() && \
|
||||
(((config_.get_event_level() >= remote_server_event::level) && \
|
||||
(((config_.get_event_level() >= remote_winfsp_server_event::level) && \
|
||||
((ret) != STATUS_SUCCESS)) || \
|
||||
(config_.get_event_level() >= event_level::trace))) \
|
||||
event_system::instance().raise<remote_server_event>(file, ret, func)
|
||||
event_system::instance().raise<remote_winfsp_server_event>( \
|
||||
std::string{func}, file, ret)
|
||||
|
||||
auto remote_server::get_next_handle() -> std::uint64_t {
|
||||
if (++next_handle_ == 0U) {
|
||||
@ -142,10 +141,9 @@ auto remote_server::fuse_chmod(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_chown(const char *path,
|
||||
const remote::user_id & /*uid*/,
|
||||
const remote::group_id & /*gid*/)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_chown(
|
||||
const char *path, const remote::user_id & /*uid*/,
|
||||
const remote::group_id & /*gid*/) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -173,10 +171,9 @@ construct_path(path); auto res = HasOpenFileCompatInfo(handle, EBADF); if (res
|
||||
return ret;
|
||||
}*/
|
||||
|
||||
auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
bool &directory,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_fgetattr(
|
||||
const char *path, remote::stat &r_stat, bool &directory,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
r_stat = {};
|
||||
@ -188,7 +185,7 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
};
|
||||
if (res == 0) {
|
||||
directory = utils::file::directory(file_path).exists();
|
||||
struct _stat64 unix_st{};
|
||||
struct _stat64 unix_st {};
|
||||
res = _fstat64(static_cast<int>(handle), &unix_st);
|
||||
if (res == 0) {
|
||||
populate_stat(path, directory, r_stat, unix_st);
|
||||
@ -200,10 +197,9 @@ auto remote_server::fuse_fgetattr(const char *path, remote::stat &r_stat,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_fsetattr_x(const char *path,
|
||||
const remote::setattr_x & /*attr*/,
|
||||
const remote::file_handle & /*handle*/)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_fsetattr_x(
|
||||
const char *path, const remote::setattr_x & /*attr*/,
|
||||
const remote::file_handle & /*handle*/) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -212,10 +208,9 @@ auto remote_server::fuse_fsetattr_x(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_fsync(const char *path,
|
||||
const std::int32_t & /*datasync*/,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_fsync(
|
||||
const char *path, const std::int32_t & /*datasync*/,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -242,10 +237,9 @@ auto remote_server::fuse_fsync(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_ftruncate(const char *path,
|
||||
const remote::file_offset &size,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_ftruncate(
|
||||
const char *path, const remote::file_offset &size,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -285,7 +279,7 @@ auto remote_server::fuse_getattr(const char *path, remote::stat &r_st,
|
||||
|
||||
directory = utils::file::directory(file_path).exists();
|
||||
|
||||
struct _stat64 st1{};
|
||||
struct _stat64 st1 {};
|
||||
auto res{
|
||||
_stat64(file_path.c_str(), &st1),
|
||||
};
|
||||
@ -311,10 +305,9 @@ STATUS_NOT_IMPLEMENTED; RAISE_REMOTE_WINFSP_SERVER_EVENT(function_name,
|
||||
file_path, ret); return ret;
|
||||
}*/
|
||||
|
||||
auto remote_server::fuse_getxtimes(const char *path,
|
||||
remote::file_time & /*bkuptime*/,
|
||||
remote::file_time & /*crtime*/)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_getxtimes(
|
||||
const char *path, remote::file_time & /*bkuptime*/,
|
||||
remote::file_time & /*crtime*/) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -445,11 +438,10 @@ auto remote_server::fuse_open(const char *path, const remote::open_flags &flags,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_read(
|
||||
const char *path, char *buffer, const remote::file_size &read_size,
|
||||
const remote::file_offset &read_offset,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -480,8 +472,8 @@ auto remote_server::fuse_read(const char *path, char *buffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_rename(const char *from, const char *to)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_rename(const char *from,
|
||||
const char *to) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto from_path = utils::path::combine(mount_location_, {from});
|
||||
@ -496,11 +488,10 @@ auto remote_server::fuse_rename(const char *from, const char *to)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_write(const char *path, const char *buffer,
|
||||
const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_write(
|
||||
const char *path, const char *buffer, const remote::file_size &write_size,
|
||||
const remote::file_offset &write_offset,
|
||||
const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -567,9 +558,8 @@ auto remote_server::fuse_readdir(const char *path,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_release(const char *path,
|
||||
const remote::file_handle &handle)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_release(
|
||||
const char *path, const remote::file_handle &handle) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -613,9 +603,8 @@ auto remote_server::fuse_rmdir(const char *path) -> packet::error_type {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_setattr_x(const char *path,
|
||||
remote::setattr_x & /*attr*/)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_setattr_x(
|
||||
const char *path, remote::setattr_x & /*attr*/) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -727,9 +716,8 @@ auto remote_server::fuse_statfs_x(const char *path, std::uint64_t bsize,
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto remote_server::fuse_truncate(const char *path,
|
||||
const remote::file_offset &size)
|
||||
-> packet::error_type {
|
||||
auto remote_server::fuse_truncate(
|
||||
const char *path, const remote::file_offset &size) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -776,8 +764,8 @@ auto remote_server::fuse_unlink(const char *path) -> packet::error_type {
|
||||
}
|
||||
|
||||
auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
std::uint64_t op0, std::uint64_t op1)
|
||||
-> packet::error_type {
|
||||
std::uint64_t op0,
|
||||
std::uint64_t op1) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -836,9 +824,8 @@ auto remote_server::fuse_utimens(const char *path, const remote::file_time *tv,
|
||||
}
|
||||
|
||||
// JSON Layer
|
||||
auto remote_server::json_create_directory_snapshot(const std::string &path,
|
||||
json &json_data)
|
||||
-> packet::error_type {
|
||||
auto remote_server::json_create_directory_snapshot(
|
||||
const std::string &path, json &json_data) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -896,8 +883,8 @@ auto remote_server::json_read_directory_snapshot(
|
||||
}
|
||||
|
||||
auto remote_server::json_release_directory_snapshot(
|
||||
const std::string &path, const remote::file_handle & /*handle*/)
|
||||
-> packet::error_type {
|
||||
const std::string &path,
|
||||
const remote::file_handle & /*handle*/) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = construct_path(path);
|
||||
@ -928,8 +915,8 @@ auto remote_server::winfsp_can_delete(PVOID file_desc, PWSTR /*file_name*/)
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_cleanup(PVOID file_desc, PWSTR /*file_name*/,
|
||||
UINT32 flags, BOOLEAN &was_deleted)
|
||||
-> packet::error_type {
|
||||
UINT32 flags,
|
||||
BOOLEAN &was_deleted) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = get_open_file_path(file_desc);
|
||||
@ -966,8 +953,8 @@ auto remote_server::winfsp_create(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, UINT32 attributes,
|
||||
UINT64 /*allocation_size*/, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name, BOOLEAN &exists)
|
||||
-> packet::error_type {
|
||||
std::string &normalized_name,
|
||||
BOOLEAN &exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||
@ -1035,9 +1022,8 @@ auto remote_server::winfsp_flush(PVOID file_desc, remote::file_info *file_info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_get_file_info(PVOID file_desc,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_get_file_info(
|
||||
PVOID file_desc, remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||
@ -1051,11 +1037,9 @@ auto remote_server::winfsp_get_file_info(PVOID file_desc,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
|
||||
PUINT32 attributes,
|
||||
std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_get_security_by_name(
|
||||
PWSTR file_name, PUINT32 attributes, std::uint64_t *descriptor_size,
|
||||
std::wstring &string_descriptor) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||
@ -1094,10 +1078,9 @@ auto remote_server::winfsp_get_security_by_name(PWSTR file_name,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_get_volume_info(UINT64 &total_size,
|
||||
UINT64 &free_size,
|
||||
std::string &volume_label)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_get_volume_info(
|
||||
UINT64 &total_size, UINT64 &free_size,
|
||||
std::string &volume_label) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
drive_.get_volume_info(total_size, free_size, volume_label);
|
||||
@ -1114,11 +1097,10 @@ auto remote_server::winfsp_mounted(const std::wstring &location)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
UINT32 granted_access, PVOID *file_desc,
|
||||
remote::file_info *file_info,
|
||||
std::string &normalized_name)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_open(
|
||||
PWSTR file_name, UINT32 create_options, UINT32 granted_access,
|
||||
PVOID *file_desc, remote::file_info *file_info,
|
||||
std::string &normalized_name) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto file_path = utils::string::from_utf8(utils::path::combine(
|
||||
@ -1154,11 +1136,10 @@ auto remote_server::winfsp_open(PWSTR file_name, UINT32 create_options,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_overwrite(PVOID file_desc, UINT32 attributes,
|
||||
BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_overwrite(
|
||||
PVOID file_desc, UINT32 attributes, BOOLEAN replace_attributes,
|
||||
UINT64 /*allocation_size*/,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||
@ -1259,10 +1240,9 @@ auto remote_server::winfsp_read_directory(PVOID file_desc, PWSTR /*pattern*/,
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_rename(PVOID /*file_desc*/, PWSTR file_name,
|
||||
PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_rename(
|
||||
PVOID /*file_desc*/, PWSTR file_name, PWSTR new_file_name,
|
||||
BOOLEAN replace_if_exists) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto from_path = utils::string::from_utf8(utils::path::combine(
|
||||
@ -1313,10 +1293,9 @@ auto remote_server::winfsp_set_basic_info(
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
|
||||
BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_set_file_size(
|
||||
PVOID file_desc, UINT64 new_size, BOOLEAN set_allocation_size,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||
@ -1359,12 +1338,10 @@ auto remote_server::winfsp_unmounted(const std::wstring &location)
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
auto remote_server::winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset,
|
||||
UINT32 length, BOOLEAN /*write_to_end*/,
|
||||
BOOLEAN constrained_io,
|
||||
PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info)
|
||||
-> packet::error_type {
|
||||
auto remote_server::winfsp_write(
|
||||
PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
|
||||
BOOLEAN /*write_to_end*/, BOOLEAN constrained_io, PUINT32 bytes_transferred,
|
||||
remote::file_info *file_info) -> packet::error_type {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto *handle = reinterpret_cast<HANDLE>(file_desc);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user