21 Commits

Author SHA1 Message Date
36e952606b fix
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
2024-10-09 14:20:50 -05:00
eba93484c1 fix 2024-10-09 14:15:02 -05:00
d09d55951d refactor 2024-10-09 14:08:38 -05:00
b35e100bb2 fix 2024-10-09 14:03:06 -05:00
27b37eb570 refactor 2024-10-09 13:58:41 -05:00
92295506a7 refactor 2024-10-09 13:56:40 -05:00
d20ed07066 fix 2024-10-09 13:41:32 -05:00
3fa16fd846 updated build system 2024-10-09 12:50:41 -05:00
481dfd5ff5 fix 2024-10-09 12:50:17 -05:00
e5a99943a5 fix 2024-10-09 12:23:17 -05:00
dbaf379f19 refactor 2024-10-09 11:32:03 -05:00
e1bd3bb8ec refactor 2024-10-09 11:29:27 -05:00
ca834dd119 refactor 2024-10-09 11:11:07 -05:00
163549098d cleanup 2024-10-09 10:46:22 -05:00
4800db00d9 fix 2024-10-09 10:45:12 -05:00
675707b46c fix 2024-10-09 10:37:43 -05:00
14ebdab034 fix 2024-10-09 10:27:51 -05:00
8541e292cd fix 2024-10-09 09:51:09 -05:00
9adec02640 fix 2024-10-09 09:47:35 -05:00
6a97ad664b fix 2024-10-09 09:18:25 -05:00
8bb291bbd9 updated build system 2024-10-09 09:15:18 -05:00
121 changed files with 1161 additions and 1143 deletions

View File

@ -1,15 +1,15 @@
set(BINUTILS_VERSION 2.41) set(BINUTILS_VERSION 2.41)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(BOOST_MAJOR_VERSION 1) set(BOOST_MAJOR_VERSION 1)
set(BOOST_MINOR_VERSION 85) set(BOOST_MINOR_VERSION 85)
set(BOOST_PATCH_VERSION 0) set(BOOST_PATCH_VERSION 0)
set(BOOST2_MAJOR_VERSION 1)
set(BOOST2_MINOR_VERSION 76)
set(BOOST2_PATCH_VERSION 0)
set(CPP_HTTPLIB_VERSION 0.16.3) set(CPP_HTTPLIB_VERSION 0.16.3)
set(CURL2_VERSION 8_9_1)
set(CURL_VERSION 8.9.1) set(CURL_VERSION 8.9.1)
set(EXPAT2_VERSION 2_6_2) set(CURL2_VERSION 8_9_1)
set(EXPAT_VERSION 2.6.2) set(EXPAT_VERSION 2.6.2)
set(EXPAT2_VERSION 2_6_2)
set(GCC_VERSION 14.2.0) set(GCC_VERSION 14.2.0)
set(GTEST_VERSION 1.15.2) set(GTEST_VERSION 1.15.2)
set(ICU_VERSION 75-1) set(ICU_VERSION 75-1)
@ -21,7 +21,7 @@ set(OPENSSL_VERSION 3.3.1)
set(PKG_CONFIG_VERSION 0.29.2) set(PKG_CONFIG_VERSION 0.29.2)
set(PUGIXML_VERSION 1.14) set(PUGIXML_VERSION 1.14)
set(SPDLOG_VERSION 1.14.1) set(SPDLOG_VERSION 1.14.1)
set(SQLITE2_VERSION 3.46.1)
set(SQLITE_VERSION 3460100) set(SQLITE_VERSION 3460100)
set(SQLITE2_VERSION 3.46.1)
set(STDUUID_VERSION 1.2.3) set(STDUUID_VERSION 1.2.3)
set(ZLIB_VERSION 1.3.1) set(ZLIB_VERSION 1.3.1)

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_APP_CONFIG_HPP_ #ifndef REPERTORY_INCLUDE_APP_CONFIG_HPP_
#define INCLUDE_APP_CONFIG_HPP_ #define REPERTORY_INCLUDE_APP_CONFIG_HPP_
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/events.hpp" #include "events/events.hpp"
@ -455,4 +455,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_APP_CONFIG_HPP_ #endif // REPERTORY_INCLUDE_APP_CONFIG_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_COMM_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
#define INCLUDE_COMM_CURL_CURL_COMM_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_
#include "comm/curl/multi_request.hpp" #include "comm/curl/multi_request.hpp"
#include "comm/i_http_comm.hpp" #include "comm/i_http_comm.hpp"
@ -238,4 +238,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_CURL_CURL_COMM_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_CURL_COMM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
#define INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -41,4 +41,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_MULTI_REQUEST_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_
#include "comm/curl/requests/http_request_base.hpp" #include "comm/curl/requests/http_request_base.hpp"
@ -28,13 +28,13 @@ namespace repertory::curl::requests {
struct http_delete final : http_request_base { struct http_delete final : http_request_base {
~http_delete() override = default; ~http_delete() override = default;
[[nodiscard]] auto set_method(CURL *curl, [[nodiscard]] auto
stop_type & /* stop_requested */) const set_method(CURL *curl,
-> bool override { stop_type & /* stop_requested */) const -> bool override {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
return true; return true;
} }
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_DELETE_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_DELETE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_
#include "comm/curl/requests/http_request_base.hpp" #include "comm/curl/requests/http_request_base.hpp"
@ -33,13 +33,13 @@ struct http_get final : http_request_base {
auto operator=(http_get &&) -> http_get & = default; auto operator=(http_get &&) -> http_get & = default;
~http_get() override = default; ~http_get() override = default;
[[nodiscard]] auto set_method(CURL *curl, [[nodiscard]] auto
stop_type & /*stop_requested*/) const set_method(CURL *curl,
-> bool override { stop_type & /*stop_requested*/) const -> bool override {
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
return true; return true;
} }
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_GET_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_GET_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_
#include "comm/curl/requests/http_request_base.hpp" #include "comm/curl/requests/http_request_base.hpp"
@ -28,9 +28,9 @@ namespace repertory::curl::requests {
struct http_head final : http_request_base { struct http_head final : http_request_base {
~http_head() override = default; ~http_head() override = default;
[[nodiscard]] auto set_method(CURL *curl, [[nodiscard]] auto
stop_type & /* stop_requested */) const set_method(CURL *curl,
-> bool override { stop_type & /* stop_requested */) const -> bool override {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "HEAD"); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "HEAD");
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L); curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
return true; return true;
@ -38,4 +38,4 @@ struct http_head final : http_request_base {
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_HEAD_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_HEAD_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_
#include "comm/curl/requests/http_request_base.hpp" #include "comm/curl/requests/http_request_base.hpp"
@ -36,9 +36,8 @@ struct http_post final : http_request_base {
std::optional<nlohmann::json> json; std::optional<nlohmann::json> json;
[[nodiscard]] auto set_method(CURL *curl, [[nodiscard]] auto
stop_type & /*stop_requested*/) const set_method(CURL *curl, stop_type & /*stop_requested*/) const -> bool override;
-> bool override;
private: private:
mutable curl_slist *headers{nullptr}; mutable curl_slist *headers{nullptr};
@ -46,4 +45,4 @@ private:
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_POST_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_POST_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_
#include "comm/curl/requests/http_request_base.hpp" #include "comm/curl/requests/http_request_base.hpp"
#include "utils/encrypting_reader.hpp" #include "utils/encrypting_reader.hpp"
@ -39,12 +39,12 @@ struct http_put_file final : http_request_base {
std::shared_ptr<utils::encryption::encrypting_reader> reader; std::shared_ptr<utils::encryption::encrypting_reader> reader;
std::string source_path; std::string source_path;
[[nodiscard]] auto set_method(CURL *curl, stop_type &stop_requested) const [[nodiscard]] auto
-> bool override; set_method(CURL *curl, stop_type &stop_requested) const -> bool override;
private: private:
mutable std::shared_ptr<read_file_info> read_info{}; mutable std::shared_ptr<read_file_info> read_info{};
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_PUT_FILE_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_PUT_FILE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_ #ifndef REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
#define INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_ #define REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/file.hpp" #include "utils/file.hpp"
@ -79,4 +79,4 @@ struct http_request_base {
}; };
} // namespace repertory::curl::requests } // namespace repertory::curl::requests
#endif // INCLUDE_COMM_CURL_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_ #endif // REPERTORY_INCLUDE_COMM_CURL_REQUESTS_HTTP_REQUEST_BASE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_I_HTTP_COMM_HPP_ #ifndef REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_
#define INCLUDE_COMM_I_HTTP_COMM_HPP_ #define REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_
#include "comm/curl/requests/http_delete.hpp" #include "comm/curl/requests/http_delete.hpp"
#include "comm/curl/requests/http_get.hpp" #include "comm/curl/requests/http_get.hpp"
@ -40,26 +40,23 @@ public:
make_request(const curl::requests::http_delete &del, long &response_code, make_request(const curl::requests::http_delete &del, long &response_code,
stop_type &stop_requested) const -> bool = 0; stop_type &stop_requested) const -> bool = 0;
[[nodiscard]] virtual auto make_request(const curl::requests::http_get &get, [[nodiscard]] virtual auto
long &response_code, make_request(const curl::requests::http_get &get, long &response_code,
stop_type &stop_requested) const stop_type &stop_requested) const -> bool = 0;
-> bool = 0;
[[nodiscard]] virtual auto make_request(const curl::requests::http_head &head, [[nodiscard]] virtual auto
long &response_code, make_request(const curl::requests::http_head &head, long &response_code,
stop_type &stop_requested) const stop_type &stop_requested) const -> bool = 0;
-> bool = 0;
[[nodiscard]] virtual auto make_request(const curl::requests::http_post &post, [[nodiscard]] virtual auto
long &response_code, make_request(const curl::requests::http_post &post, long &response_code,
stop_type &stop_requested) const stop_type &stop_requested) const -> bool = 0;
-> bool = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
make_request(const curl::requests::http_put_file &put_file, make_request(const curl::requests::http_put_file &put_file,
long &response_code, stop_type &stop_requested) const long &response_code,
-> bool = 0; stop_type &stop_requested) const -> bool = 0;
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_I_HTTP_COMM_HPP_ #endif // REPERTORY_INCLUDE_COMM_I_HTTP_COMM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_ #ifndef REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
#define INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_ #define REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_
#include "comm/packet/packet.hpp" #include "comm/packet/packet.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -107,4 +107,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_ #endif // REPERTORY_INCLUDE_COMM_PACKET_CLIENT_POOL_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_PACKET_PACKET_HPP_ #ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_
#define INCLUDE_COMM_PACKET_PACKET_HPP_ #define REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_
#include "types/remote.hpp" #include "types/remote.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -230,4 +230,4 @@ public:
using packet = packet; using packet = packet;
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_PACKET_PACKET_HPP_ #endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_ #ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
#define INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_ #define REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_
#include "comm/packet/packet.hpp" #include "comm/packet/packet.hpp"
@ -93,4 +93,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_ #endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_CLIENT_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_ #ifndef REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
#define INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_ #define REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_
#include "comm/packet/client_pool.hpp" #include "comm/packet/client_pool.hpp"
#include "utils/common.hpp" #include "utils/common.hpp"
@ -95,4 +95,4 @@ private:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_ #endif // REPERTORY_INCLUDE_COMM_PACKET_PACKET_SERVER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_COMMON_HPP_ #ifndef REPERTORY_INCLUDE_COMMON_HPP_
#define INCLUDE_COMMON_HPP_ #define REPERTORY_INCLUDE_COMMON_HPP_
#if defined(__GNUC__) #if defined(__GNUC__)
// clang-format off // clang-format off
@ -307,4 +307,4 @@ public: \
virtual ~name() = default virtual ~name() = default
#endif // __cplusplus #endif // __cplusplus
#endif // INCLUDE_COMMON_HPP_ #endif // REPERTORY_INCLUDE_COMMON_HPP_

View File

@ -19,11 +19,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
#define INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_ #define REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_
#include "utils/single_thread_service_base.hpp" #include "utils/single_thread_service_base.hpp"
#include <memory>
namespace repertory { namespace repertory {
class directory_iterator; class directory_iterator;
@ -74,4 +73,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_DIRECTORY_CACHE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
#define INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_ #define REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_
#include "types/remote.hpp" #include "types/remote.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -78,4 +78,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_DIRECTORY_ITERATOR_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_EVICTION_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_
#define INCLUDE_DRIVES_EVICTION_HPP_ #define REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_
#include "utils/single_thread_service_base.hpp" #include "utils/single_thread_service_base.hpp"
@ -45,8 +45,8 @@ private:
i_file_manager &fm_; i_file_manager &fm_;
private: private:
[[nodiscard]] auto check_minimum_requirements(const std::string &file_path) [[nodiscard]] auto
-> bool; check_minimum_requirements(const std::string &file_path) -> bool;
[[nodiscard]] auto get_filtered_cached_files() -> std::deque<std::string>; [[nodiscard]] auto get_filtered_cached_files() -> std::deque<std::string>;
@ -55,4 +55,4 @@ protected:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_EVICTION_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_EVICTION_HPP_

View File

@ -19,23 +19,23 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_EVENTS_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
#define INCLUDE_DRIVES_FUSE_EVENTS_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_
#include "events/event_system.hpp" #include "events/event_system.hpp"
namespace repertory { namespace repertory {
// clang-format off // clang-format off
E_SIMPLE3(fuse_event, debug, true, E_SIMPLE3(fuse_event, debug, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
int, result, res, E_FROM_INT32 int, result, res, E_FROM_INT32
); );
E_SIMPLE1(fuse_args_parsed, info, true, E_SIMPLE1(fuse_args_parsed, info, true,
std::string, arguments, args, E_STRING std::string, arguments, args, E_FROM_STRING
); );
// clang-format on // clang-format on
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_FUSE_EVENTS_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_EVENTS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
#define INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "events/event_system.hpp" #include "events/event_system.hpp"
@ -604,4 +604,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "drives/fuse/fuse_drive_base.hpp" #include "drives/fuse/fuse_drive_base.hpp"
@ -323,4 +323,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
#define INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "drives/fuse/fuse_base.hpp" #include "drives/fuse/fuse_base.hpp"
@ -134,4 +134,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_DRIVE_BASE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
#define INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -81,4 +81,4 @@ public:
} // namespace repertory } // namespace repertory
#endif #endif
#endif // INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_I_FUSE_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_
#include "drives/remote/i_remote_json.hpp" #include "drives/remote/i_remote_json.hpp"
#include "types/remote.hpp" #include "types/remote.hpp"
@ -30,26 +30,25 @@ class i_remote_instance : public virtual i_remote_json {
INTERFACE_SETUP(i_remote_instance); INTERFACE_SETUP(i_remote_instance);
public: public:
[[nodiscard]] virtual auto fuse_access(const char *path, [[nodiscard]] virtual auto
const std::int32_t &mask) fuse_access(const char *path,
-> packet::error_type = 0; const std::int32_t &mask) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_chflags(const char *path, std::uint32_t flags) [[nodiscard]] virtual auto
-> packet::error_type = 0; fuse_chflags(const char *path, std::uint32_t flags) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_chmod(const char *path, [[nodiscard]] virtual auto
const remote::file_mode &mode) fuse_chmod(const char *path,
-> packet::error_type = 0; const remote::file_mode &mode) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_chown(const char *path, [[nodiscard]] virtual auto
const remote::user_id &uid, fuse_chown(const char *path, const remote::user_id &uid,
const remote::group_id &gid) const remote::group_id &gid) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
fuse_create(const char *path, const remote::file_mode &mode, fuse_create(const char *path, const remote::file_mode &mode,
const remote::open_flags &flags, remote::file_handle &handle) const remote::open_flags &flags,
-> packet::error_type = 0; remote::file_handle &handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_destroy() -> packet::error_type = 0; [[nodiscard]] virtual auto fuse_destroy() -> packet::error_type = 0;
/*[[nodiscard]] virtual packet::error_type fuse_fallocate(const char *path, /*[[nodiscard]] virtual packet::error_type fuse_fallocate(const char *path,
@ -61,24 +60,21 @@ public:
fuse_fgetattr(const char *path, remote::stat &r_stat, bool &directory, fuse_fgetattr(const char *path, remote::stat &r_stat, bool &directory,
const remote::file_handle &handle) -> packet::error_type = 0; const remote::file_handle &handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_fsetattr_x(const char *path, [[nodiscard]] virtual auto
const remote::setattr_x &attr, fuse_fsetattr_x(const char *path, const remote::setattr_x &attr,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_fsync(const char *path, [[nodiscard]] virtual auto
const std::int32_t &datasync, fuse_fsync(const char *path, const std::int32_t &datasync,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_ftruncate(const char *path, [[nodiscard]] virtual auto
const remote::file_offset &size, fuse_ftruncate(const char *path, const remote::file_offset &size,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_getattr(const char *path, [[nodiscard]] virtual auto
remote::stat &r_stat, bool &directory) fuse_getattr(const char *path, remote::stat &r_stat,
-> packet::error_type = 0; bool &directory) -> packet::error_type = 0;
/*[[nodiscard]] virtual packet::error_type fuse_getxattr(const char *path, /*[[nodiscard]] virtual packet::error_type fuse_getxattr(const char *path,
const char *name, char *value, const remote::file_size &size) = 0; const char *name, char *value, const remote::file_size &size) = 0;
@ -87,10 +83,9 @@ public:
const char *name, char *value, const remote::file_size &size, std::uint32_t const char *name, char *value, const remote::file_size &size, std::uint32_t
position) = 0;*/ position) = 0;*/
[[nodiscard]] virtual auto fuse_getxtimes(const char *path, [[nodiscard]] virtual auto
remote::file_time &bkuptime, fuse_getxtimes(const char *path, remote::file_time &bkuptime,
remote::file_time &crtime) remote::file_time &crtime) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_init() -> packet::error_type = 0; [[nodiscard]] virtual auto fuse_init() -> packet::error_type = 0;
@ -98,65 +93,63 @@ public:
char *buffer, const remote::file_size &size) = 0;*/ char *buffer, const remote::file_size &size) = 0;*/
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
fuse_mkdir(const char *path, const remote::file_mode &mode) fuse_mkdir(const char *path,
-> packet::error_type = 0; const remote::file_mode &mode) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_open(const char *path, [[nodiscard]] virtual auto
const remote::open_flags &flags, fuse_open(const char *path, const remote::open_flags &flags,
remote::file_handle &handle) remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_opendir(const char *path, [[nodiscard]] virtual auto
remote::file_handle &handle) fuse_opendir(const char *path,
-> packet::error_type = 0; remote::file_handle &handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_read(const char *path, char *buffer, [[nodiscard]] virtual auto
const remote::file_size &read_size, fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
fuse_readdir(const char *path, const remote::file_offset &offset, fuse_readdir(const char *path, const remote::file_offset &offset,
const remote::file_handle &handle, std::string &item_path) const remote::file_handle &handle,
-> packet::error_type = 0; std::string &item_path) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_release(const char *path, [[nodiscard]] virtual auto
const remote::file_handle &handle) fuse_release(const char *path,
-> packet::error_type = 0; const remote::file_handle &handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_releasedir(const char *path, [[nodiscard]] virtual auto
const remote::file_handle &handle) fuse_releasedir(const char *path,
-> packet::error_type = 0; const remote::file_handle &handle) -> packet::error_type = 0;
//[[nodiscard]] virtual packet::error_type fuse_removexattr(const char *path, //[[nodiscard]] virtual packet::error_type fuse_removexattr(const char *path,
// const char *name) = // const char *name) =
// 0; // 0;
[[nodiscard]] virtual auto fuse_rename(const char *from, const char *to) [[nodiscard]] virtual auto
-> packet::error_type = 0; fuse_rename(const char *from, const char *to) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_rmdir(const char *path) [[nodiscard]] virtual auto
-> packet::error_type = 0; fuse_rmdir(const char *path) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_setattr_x(const char *path, [[nodiscard]] virtual auto
remote::setattr_x &attr) fuse_setattr_x(const char *path,
-> packet::error_type = 0; remote::setattr_x &attr) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_setbkuptime(const char *path, [[nodiscard]] virtual auto
const remote::file_time &bkuptime) fuse_setbkuptime(const char *path,
-> packet::error_type = 0; const remote::file_time &bkuptime) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_setchgtime(const char *path, [[nodiscard]] virtual auto
const remote::file_time &chgtime) fuse_setchgtime(const char *path,
-> packet::error_type = 0; const remote::file_time &chgtime) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_setcrtime(const char *path, [[nodiscard]] virtual auto
const remote::file_time &crtime) fuse_setcrtime(const char *path,
-> packet::error_type = 0; const remote::file_time &crtime) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_setvolname(const char *volname) [[nodiscard]] virtual auto
-> packet::error_type = 0; fuse_setvolname(const char *volname) -> packet::error_type = 0;
/*[[nodiscard]] virtual packet::error_type fuse_setxattr(const char *path, /*[[nodiscard]] virtual packet::error_type fuse_setxattr(const char *path,
const char *name, const char *value, const remote::file_size &size, const const char *name, const char *value, const remote::file_size &size, const
@ -165,36 +158,35 @@ public:
const char *name, const char *value, const remote::file_size &size, const const char *name, const char *value, const remote::file_size &size, const
std::int32_t &flags, std::uint32_t position) = 0;*/ std::int32_t &flags, std::uint32_t position) = 0;*/
[[nodiscard]] virtual auto fuse_statfs(const char *path, std::uint64_t frsize, [[nodiscard]] virtual auto
remote::statfs &r_stat) fuse_statfs(const char *path, std::uint64_t frsize,
-> packet::error_type = 0; remote::statfs &r_stat) -> packet::error_type = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
fuse_statfs_x(const char *path, std::uint64_t bsize, remote::statfs_x &r_stat) fuse_statfs_x(const char *path, std::uint64_t bsize,
-> packet::error_type = 0; remote::statfs_x &r_stat) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_truncate(const char *path, [[nodiscard]] virtual auto
const remote::file_offset &size) fuse_truncate(const char *path,
-> packet::error_type = 0; const remote::file_offset &size) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_unlink(const char *path) [[nodiscard]] virtual auto
-> packet::error_type = 0; fuse_unlink(const char *path) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_utimens(const char *path, [[nodiscard]] virtual auto
const remote::file_time *tv, fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
std::uint64_t op0, std::uint64_t op1) std::uint64_t op1) -> packet::error_type = 0;
-> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_write(const char *path, const char *buffer, [[nodiscard]] virtual auto
const remote::file_size &writeSize, fuse_write(const char *path, const char *buffer,
const remote::file_offset &writeOffset, const remote::file_size &writeSize,
const remote::file_handle &handle) const remote::file_offset &writeOffset,
-> packet::error_type = 0; const remote::file_handle &handle) -> packet::error_type = 0;
[[nodiscard]] virtual auto fuse_write_base64( [[nodiscard]] virtual auto fuse_write_base64(
const char *path, const char *buffer, const remote::file_size &writeSize, const char *path, const char *buffer, const remote::file_size &writeSize,
const remote::file_offset &writeOffset, const remote::file_handle &handle) const remote::file_offset &writeOffset,
-> packet::error_type = 0; const remote::file_handle &handle) -> packet::error_type = 0;
virtual void set_fuse_uid_gid(const remote::user_id &uid, virtual void set_fuse_uid_gid(const remote::user_id &uid,
const remote::group_id &gid) = 0; const remote::group_id &gid) = 0;
@ -204,4 +196,4 @@ using remote_instance_factory =
std::function<std::unique_ptr<i_remote_instance>()>; std::function<std::unique_ptr<i_remote_instance>()>;
} // namespace repertory::remote_fuse } // namespace repertory::remote_fuse
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_I_REMOTE_INSTANCE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_
#include "comm/packet/packet_client.hpp" #include "comm/packet/packet_client.hpp"
#include "drives/fuse/remotefuse/i_remote_instance.hpp" #include "drives/fuse/remotefuse/i_remote_instance.hpp"
@ -51,9 +51,9 @@ public:
[[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode) [[nodiscard]] auto fuse_chmod(const char *path, const remote::file_mode &mode)
-> packet::error_type override; -> packet::error_type override;
[[nodiscard]] auto fuse_chown(const char *path, const remote::user_id &uid, [[nodiscard]] auto
const remote::group_id &gid) fuse_chown(const char *path, const remote::user_id &uid,
-> packet::error_type override; const remote::group_id &gid) -> packet::error_type override;
[[nodiscard]] auto fuse_destroy() -> packet::error_type override; [[nodiscard]] auto fuse_destroy() -> packet::error_type override;
@ -67,23 +67,21 @@ public:
const remote::file_handle &handle) const remote::file_handle &handle)
-> packet::error_type override; -> packet::error_type override;
[[nodiscard]] auto fuse_fsetattr_x(const char *path, [[nodiscard]] auto fuse_fsetattr_x(
const remote::setattr_x &attr, const char *path, const remote::setattr_x &attr,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto fuse_fsync(const char *path, const std::int32_t &datasync, [[nodiscard]] auto
const remote::file_handle &handle) fuse_fsync(const char *path, const std::int32_t &datasync,
-> packet::error_type override; const remote::file_handle &handle) -> packet::error_type override;
[[nodiscard]] auto fuse_ftruncate(const char *path, [[nodiscard]] auto fuse_ftruncate(
const remote::file_offset &size, const char *path, const remote::file_offset &size,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto fuse_getattr(const char *path, remote::stat &st, [[nodiscard]] auto
bool &directory) fuse_getattr(const char *path, remote::stat &st,
-> packet::error_type override; bool &directory) -> packet::error_type override;
/*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char /*[[nodiscard]] packet::error_type fuse_getxattr(const char *path, const char
*name, char *value, const remote::file_size &size) override ; *name, char *value, const remote::file_size &size) override ;
@ -92,10 +90,9 @@ public:
*name, char *value, const remote::file_size &size, std::uint32_t position) *name, char *value, const remote::file_size &size, std::uint32_t position)
override ;*/ override ;*/
[[nodiscard]] auto fuse_getxtimes(const char *path, [[nodiscard]] auto
remote::file_time &bkuptime, fuse_getxtimes(const char *path, remote::file_time &bkuptime,
remote::file_time &crtime) remote::file_time &crtime) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto fuse_init() -> packet::error_type override; [[nodiscard]] auto fuse_init() -> packet::error_type override;
@ -110,27 +107,25 @@ public:
[[nodiscard]] auto [[nodiscard]] auto
fuse_create(const char *path, const remote::file_mode &mode, fuse_create(const char *path, const remote::file_mode &mode,
const remote::open_flags &flags, remote::file_handle &handle) const remote::open_flags &flags,
-> packet::error_type override; remote::file_handle &handle) -> packet::error_type override;
[[nodiscard]] auto fuse_open(const char *path, [[nodiscard]] auto
const remote::open_flags &flags, fuse_open(const char *path, const remote::open_flags &flags,
remote::file_handle &handle) remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto fuse_read(const char *path, char *buffer, [[nodiscard]] auto
const remote::file_size &read_size, fuse_read(const char *path, char *buffer, const remote::file_size &read_size,
const remote::file_offset &read_offset, const remote::file_offset &read_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto fuse_rename(const char *from, const char *to) [[nodiscard]] auto fuse_rename(const char *from,
-> packet::error_type override; const char *to) -> packet::error_type override;
[[nodiscard]] auto [[nodiscard]] auto
fuse_readdir(const char *path, const remote::file_offset &offset, fuse_readdir(const char *path, const remote::file_offset &offset,
const remote::file_handle &handle, std::string &item_path) const remote::file_handle &handle,
-> packet::error_type override; std::string &item_path) -> packet::error_type override;
[[nodiscard]] auto fuse_release(const char *path, [[nodiscard]] auto fuse_release(const char *path,
const remote::file_handle &handle) const remote::file_handle &handle)
@ -144,8 +139,8 @@ public:
* char *name) override * char *name) override
* ;*/ * ;*/
[[nodiscard]] auto fuse_rmdir(const char *path) [[nodiscard]] auto
-> packet::error_type override; fuse_rmdir(const char *path) -> packet::error_type override;
[[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr) [[nodiscard]] auto fuse_setattr_x(const char *path, remote::setattr_x &attr)
-> packet::error_type override; -> packet::error_type override;
@ -162,8 +157,8 @@ public:
const remote::file_time &crtime) const remote::file_time &crtime)
-> packet::error_type override; -> packet::error_type override;
[[nodiscard]] auto fuse_setvolname(const char *volname) [[nodiscard]] auto
-> packet::error_type override; fuse_setvolname(const char *volname) -> packet::error_type override;
[[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char [[nodiscard]] /*packet::error_type fuse_setxattr(const char *path, const char
*name, const char *value, const remote::file_size &size, const std::int32_t *name, const char *value, const remote::file_size &size, const std::int32_t
@ -174,48 +169,45 @@ public:
std::int32_t &flags, std::uint32_t position) override ;*/ std::int32_t &flags, std::uint32_t position) override ;*/
[[nodiscard]] auto [[nodiscard]] auto
fuse_statfs(const char *path, std::uint64_t frsize, remote::statfs &st) fuse_statfs(const char *path, std::uint64_t frsize,
-> packet::error_type override; remote::statfs &st) -> packet::error_type override;
[[nodiscard]] auto fuse_statfs_x(const char *path, std::uint64_t bsize, [[nodiscard]] auto
remote::statfs_x &st) fuse_statfs_x(const char *path, std::uint64_t bsize,
-> packet::error_type override; remote::statfs_x &st) -> packet::error_type override;
[[nodiscard]] auto fuse_truncate(const char *path, [[nodiscard]] auto
const remote::file_offset &size) fuse_truncate(const char *path,
-> packet::error_type override; const remote::file_offset &size) -> packet::error_type override;
[[nodiscard]] auto fuse_unlink(const char *path) [[nodiscard]] auto
-> packet::error_type override; fuse_unlink(const char *path) -> packet::error_type override;
[[nodiscard]] auto fuse_utimens(const char *path, const remote::file_time *tv, [[nodiscard]] auto
std::uint64_t op0, std::uint64_t op1) fuse_utimens(const char *path, const remote::file_time *tv, std::uint64_t op0,
-> packet::error_type override; std::uint64_t op1) -> packet::error_type override;
[[nodiscard]] auto fuse_write(const char *path, const char *buffer, [[nodiscard]] auto
const remote::file_size &write_size, fuse_write(const char *path, const char *buffer,
const remote::file_offset &write_offset, const remote::file_size &write_size,
const remote::file_handle &handle) const remote::file_offset &write_offset,
-> packet::error_type override; const remote::file_handle &handle) -> packet::error_type override;
[[nodiscard]] auto fuse_write_base64(const char *path, const char *buffer, [[nodiscard]] auto fuse_write_base64(
const remote::file_size &write_size, const char *path, const char *buffer, const remote::file_size &write_size,
const remote::file_offset &write_offset, const remote::file_offset &write_offset,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto json_create_directory_snapshot(const std::string &path, [[nodiscard]] auto json_create_directory_snapshot(
json &json_data) const std::string &path, json &json_data) -> packet::error_type override;
-> packet::error_type override;
[[nodiscard]] auto json_read_directory_snapshot( [[nodiscard]] auto json_read_directory_snapshot(
const std::string &path, const remote::file_handle &handle, const std::string &path, const remote::file_handle &handle,
std::uint32_t page, json &json_data) -> packet::error_type override; std::uint32_t page, json &json_data) -> packet::error_type override;
[[nodiscard]] auto [[nodiscard]] auto json_release_directory_snapshot(
json_release_directory_snapshot(const std::string &path, const std::string &path,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type override;
-> packet::error_type override;
void set_fuse_uid_gid(const remote::user_id &uid, void set_fuse_uid_gid(const remote::user_id &uid,
const remote::group_id &gid) override; const remote::group_id &gid) override;
@ -223,4 +215,4 @@ public:
} // namespace remote_fuse } // namespace remote_fuse
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_CLIENT_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "drives/fuse/fuse_base.hpp" #include "drives/fuse/fuse_base.hpp"
@ -238,4 +238,4 @@ protected:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_FUSE_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
#define INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_ #define REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "drives/directory_cache.hpp" #include "drives/directory_cache.hpp"
@ -320,4 +320,4 @@ public:
} // namespace repertory } // namespace repertory
#endif #endif
#endif // INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_FUSE_REMOTEFUSE_REMOTE_SERVER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
#define INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_ #define REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_
#include "comm/packet/packet.hpp" #include "comm/packet/packet.hpp"
@ -30,18 +30,17 @@ class i_remote_json {
public: public:
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
json_create_directory_snapshot(const std::string &path, json &json_data) json_create_directory_snapshot(const std::string &path,
-> packet::error_type = 0; json &json_data) -> packet::error_type = 0;
[[nodiscard]] virtual auto json_read_directory_snapshot( [[nodiscard]] virtual auto json_read_directory_snapshot(
const std::string &path, const remote::file_handle &handle, const std::string &path, const remote::file_handle &handle,
std::uint32_t page, json &json_data) -> packet::error_type = 0; std::uint32_t page, json &json_data) -> packet::error_type = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto json_release_directory_snapshot(
json_release_directory_snapshot(const std::string &path, const std::string &path,
const remote::file_handle &handle) const remote::file_handle &handle) -> packet::error_type = 0;
-> packet::error_type = 0;
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_REMOTE_I_REMOTE_JSON_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
#define INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_ #define REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_
#include "types/remote.hpp" #include "types/remote.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -34,15 +34,15 @@ protected:
protected: protected:
struct compat_open_info { struct compat_open_info {
std::size_t count = 0u; std::size_t count{0U};
std::string client_id = ""; std::string client_id;
std::string path; std::string path;
}; };
struct open_info { struct open_info {
std::size_t count = 0u; std::size_t count{0U};
std::string client_id = ""; std::string client_id;
PVOID directory_buffer = nullptr; PVOID directory_buffer{nullptr};
std::string path; std::string path;
}; };
@ -110,4 +110,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_OPEN_FILE_TABLE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
#define INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_ #define REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "comm/packet/client_pool.hpp" #include "comm/packet/client_pool.hpp"
@ -1430,4 +1430,4 @@ protected:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_REMOTE_REMOTE_SERVER_BASE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
#define INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "types/remote.hpp" #include "types/remote.hpp"
@ -69,4 +69,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_I_WINFSP_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_
#include "drives/remote/i_remote_json.hpp" #include "drives/remote/i_remote_json.hpp"
@ -29,8 +29,8 @@ class i_remote_instance : public virtual i_remote_json {
INTERFACE_SETUP(i_remote_instance); INTERFACE_SETUP(i_remote_instance);
public: public:
virtual auto winfsp_can_delete(PVOID file_desc, PWSTR file_name) virtual auto winfsp_can_delete(PVOID file_desc,
-> packet::error_type = 0; PWSTR file_name) -> packet::error_type = 0;
virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags, virtual auto winfsp_cleanup(PVOID file_desc, PWSTR file_name, UINT32 flags,
BOOLEAN &was_closed) -> packet::error_type = 0; BOOLEAN &was_closed) -> packet::error_type = 0;
@ -41,77 +41,76 @@ public:
UINT32 granted_access, UINT32 file_attributes, UINT32 granted_access, UINT32 file_attributes,
UINT64 allocation_size, PVOID *file_desc, UINT64 allocation_size, PVOID *file_desc,
remote::file_info *file_info, remote::file_info *file_info,
std::string &normalized_name, BOOLEAN &exists) std::string &normalized_name,
-> packet::error_type = 0; BOOLEAN &exists) -> packet::error_type = 0;
virtual auto winfsp_flush(PVOID file_desc, remote::file_info *file_info) virtual auto winfsp_flush(PVOID file_desc, remote::file_info *file_info)
-> packet::error_type = 0; -> packet::error_type = 0;
virtual auto winfsp_get_dir_buffer(PVOID file_desc, PVOID *&ptr) virtual auto winfsp_get_dir_buffer(PVOID file_desc,
-> packet::error_type = 0; PVOID *&ptr) -> packet::error_type = 0;
virtual auto winfsp_get_file_info(PVOID file_desc, remote::file_info *file_info)
-> packet::error_type = 0;
virtual auto virtual auto
winfsp_get_security_by_name(PWSTR file_name, PUINT32 file_attributes, winfsp_get_file_info(PVOID file_desc,
std::uint64_t *security_descriptor_size, remote::file_info *file_info) -> packet::error_type = 0;
std::wstring &str_descriptor)
-> packet::error_type = 0;
virtual auto winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size, virtual auto winfsp_get_security_by_name(
std::string &volume_label) PWSTR file_name, PUINT32 file_attributes,
-> packet::error_type = 0; std::uint64_t *security_descriptor_size,
std::wstring &str_descriptor) -> packet::error_type = 0;
virtual auto winfsp_mounted(const std::wstring &location) virtual auto
-> packet::error_type = 0; winfsp_get_volume_info(UINT64 &total_size, UINT64 &free_size,
std::string &volume_label) -> packet::error_type = 0;
virtual auto winfsp_open(PWSTR file_name, UINT32 create_options, virtual auto
UINT32 granted_access, PVOID *file_desc, winfsp_mounted(const std::wstring &location) -> packet::error_type = 0;
remote::file_info *file_info,
std::string &normalized_name)
-> packet::error_type = 0;
virtual auto winfsp_overwrite(PVOID file_desc, UINT32 file_attributes, virtual auto
BOOLEAN replace_file_attributes, winfsp_open(PWSTR file_name, UINT32 create_options, UINT32 granted_access,
UINT64 allocation_size, PVOID *file_desc, remote::file_info *file_info,
remote::file_info *file_info) std::string &normalized_name) -> packet::error_type = 0;
-> packet::error_type = 0;
virtual auto
winfsp_overwrite(PVOID file_desc, UINT32 file_attributes,
BOOLEAN replace_file_attributes, UINT64 allocation_size,
remote::file_info *file_info) -> packet::error_type = 0;
virtual auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset, virtual auto winfsp_read(PVOID file_desc, PVOID buffer, UINT64 offset,
UINT32 length, PUINT32 bytes_transferred) UINT32 length,
-> packet::error_type = 0; PUINT32 bytes_transferred) -> packet::error_type = 0;
virtual auto winfsp_read_directory(PVOID file_desc, PWSTR pattern, virtual auto winfsp_read_directory(PVOID file_desc, PWSTR pattern,
PWSTR marker, json &itemList) PWSTR marker,
-> packet::error_type = 0; json &itemList) -> packet::error_type = 0;
virtual auto winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name, virtual auto
BOOLEAN replace_if_exists) -> packet::error_type = 0; winfsp_rename(PVOID file_desc, PWSTR file_name, PWSTR new_file_name,
BOOLEAN replace_if_exists) -> packet::error_type = 0;
virtual auto winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes, virtual auto
UINT64 creation_time, UINT64 last_access_time, winfsp_set_basic_info(PVOID file_desc, UINT32 file_attributes,
UINT64 last_write_time, UINT64 change_time, UINT64 creation_time, UINT64 last_access_time,
remote::file_info *file_info) UINT64 last_write_time, UINT64 change_time,
-> packet::error_type = 0; remote::file_info *file_info) -> packet::error_type = 0;
virtual auto winfsp_set_file_size(PVOID file_desc, UINT64 new_size, virtual auto
BOOLEAN set_allocation_size, winfsp_set_file_size(PVOID file_desc, UINT64 new_size,
remote::file_info *file_info) BOOLEAN set_allocation_size,
-> packet::error_type = 0; remote::file_info *file_info) -> packet::error_type = 0;
virtual auto winfsp_unmounted(const std::wstring &location) virtual auto
-> packet::error_type = 0; winfsp_unmounted(const std::wstring &location) -> packet::error_type = 0;
virtual auto winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, virtual auto
UINT32 length, BOOLEAN write_to_end, winfsp_write(PVOID file_desc, PVOID buffer, UINT64 offset, UINT32 length,
BOOLEAN constrained_io, PUINT32 bytes_transferred, BOOLEAN write_to_end, BOOLEAN constrained_io,
remote::file_info *file_info) PUINT32 bytes_transferred,
-> packet::error_type = 0; remote::file_info *file_info) -> packet::error_type = 0;
}; };
using remote_instance_factory = using remote_instance_factory =
std::function<std::unique_ptr<i_remote_instance>()>; std::function<std::unique_ptr<i_remote_instance>()>;
} // namespace repertory::remote_winfsp } // namespace repertory::remote_winfsp
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_I_REMOTE_INSTANCE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_
#include "comm/packet/packet.hpp" #include "comm/packet/packet.hpp"
#include "comm/packet/packet_client.hpp" #include "comm/packet/packet_client.hpp"
@ -132,4 +132,4 @@ public:
} // namespace remote_winfsp } // namespace remote_winfsp
} // namespace repertory } // namespace repertory
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_CLIENT_HPP_

View File

@ -21,8 +21,8 @@
*/ */
// NOTE: Most of the WinFSP pass-through code has been modified from: // NOTE: Most of the WinFSP pass-through code has been modified from:
// https://github.com/billziss-gh/winfsp/blob/master/tst/passthrough-cpp/passthrough-cpp.cpp // https://github.com/billziss-gh/winfsp/blob/master/tst/passthrough-cpp/passthrough-cpp.cpp
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "comm/packet/packet.hpp" #include "comm/packet/packet.hpp"
@ -285,4 +285,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_SERVER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
#define INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp" #include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
@ -152,4 +152,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_REMOTEWINFSP_REMOTE_WINFSP_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_ #ifndef REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
#define INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_ #define REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "drives/eviction.hpp" #include "drives/eviction.hpp"
@ -200,4 +200,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_ #endif // REPERTORY_INCLUDE_DRIVES_WINFSP_WINFSP_DRIVE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
#define INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_ #define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
#include "events/event_system.hpp" #include "events/event_system.hpp"
@ -40,4 +40,4 @@ private:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
#define INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_ #define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
#include "events/event_system.hpp" #include "events/event_system.hpp"
@ -43,4 +43,4 @@ private:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_EVENT_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
#define INCLUDE_EVENTS_EVENT_HPP_ #define REPERTORY_INCLUDE_EVENTS_EVENT_HPP_
namespace repertory { namespace repertory {
enum class event_level { enum class event_level {
@ -72,4 +72,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_EVENT_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_EVENT_HPP_

View File

@ -19,53 +19,31 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_EVENT_SYSTEM_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
#define INCLUDE_EVENTS_EVENT_SYSTEM_HPP_ #define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
#include "events/event.hpp" #include "events/event.hpp"
#include "events/t_event_system.hpp" #include "events/t_event_system.hpp"
#include "utils/string.hpp"
namespace repertory { namespace repertory {
using event_system = t_event_system<event>; using event_system = t_event_system<event>;
using event_consumer = event_system::event_consumer; using event_consumer = event_system::event_consumer;
#define E_CAST(t) ((std::string)t) #define E_FROM_API_FILE_ERROR(e) api_error_to_string(e)
#define E_DOUBLE(d) std::to_string(d) #define E_FROM_BOOL(t) std::to_string(t)
#define E_DOUBLE_PRECISE(dbl_val) \ #define E_FROM_CURL_CODE(t) std::string(curl_easy_strerror(t))
#define E_FROM_DOUBLE(d) std::to_string(d)
#define E_FROM_DOUBLE_PRECISE(dbl_val) \
([](const double &d) -> std::string { \ ([](const double &d) -> std::string { \
std::stringstream ss; \ std::stringstream ss; \
ss << std::fixed << std::setprecision(2) << d; \ ss << std::fixed << std::setprecision(2) << d; \
return ss.str(); \ return ss.str(); \
})(dbl_val) })(dbl_val)
#define E_FROM_BOOL(t) std::to_string(t)
#define E_FROM_EXCEPTION(e) std::string(e.what() ? e.what() : "")
#define E_FROM_INT32(t) std::to_string(t) #define E_FROM_INT32(t) std::to_string(t)
#define E_FROM_INT64(t) std::to_string(t)
#define E_FROM_UINT16(t) std::to_string(t)
#define E_FROM_STRING_ARRAY(a) \
([](const auto &array) -> std::string { \
std::stringstream ret; \
for (const auto &item : array) { \
ret << (std::string(item) + " "); \
} \
return std::string(ret).TrimRight(); \
})(a)
#define E_PERCENT(d) \
([](const double &d) -> std::string { \
std::stringstream ss; \
ss << std::fixed << std::setprecision(2) << d; \
ss << "%"; \
return ss; \
})(d)
#define E_STRING(t) t
#define E_FROM_CURL_CODE(t) std::string(curl_easy_strerror(t))
#define E_FROM_UINT8(t) std::to_string(t)
#define E_FROM_UINT32(t) std::to_string(t)
#define E_FROM_UINT64(t) std::to_string(t)
#define E_FROM_SIZE_T(t) std::to_string(t) #define E_FROM_SIZE_T(t) std::to_string(t)
#define E_FROM_API_FILE_ERROR(e) api_error_to_string(e) #define E_FROM_STRING(t) t
#define E_FROM_UINT16(t) std::to_string(t)
#define E_FROM_UINT64(t) std::to_string(t)
#define E_PROP(type, name, short_name, ts) \ #define E_PROP(type, name, short_name, ts) \
private: \ private: \
@ -259,4 +237,4 @@ private: \
[this](const event &evt) { callback(evt); })) [this](const event &evt) { callback(evt); }))
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_EVENT_SYSTEM_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_EVENTS_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
#define INCLUDE_EVENTS_EVENTS_HPP_ #define REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -29,267 +29,267 @@
namespace repertory { namespace repertory {
// clang-format off // clang-format off
E_SIMPLE2(curl_error, error, true, E_SIMPLE2(curl_error, error, true,
std::string, url, url, E_STRING, std::string, url, url, E_FROM_STRING,
CURLcode, res, res, E_FROM_CURL_CODE CURLcode, res, res, E_FROM_CURL_CODE
); );
E_SIMPLE3(debug_log, debug, true, E_SIMPLE3(debug_log, debug, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, data, data, E_STRING std::string, data, data, E_FROM_STRING
); );
E_SIMPLE1(directory_removed, info, true, E_SIMPLE1(directory_removed, info, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE2(directory_removed_externally, warn, true, E_SIMPLE2(directory_removed_externally, warn, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE2(directory_remove_failed, error, true, E_SIMPLE2(directory_remove_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE2(drive_mount_failed, error, true, E_SIMPLE2(drive_mount_failed, error, true,
std::string, location, loc, E_STRING, std::string, location, loc, E_FROM_STRING,
std::string, result, res, E_STRING std::string, result, res, E_FROM_STRING
); );
E_SIMPLE1(drive_mounted, info, true, E_SIMPLE1(drive_mounted, info, true,
std::string, location, loc, E_STRING std::string, location, loc, E_FROM_STRING
); );
E_SIMPLE1(drive_mount_result, info, true, E_SIMPLE1(drive_mount_result, info, true,
std::string, result, res, E_STRING std::string, result, res, E_FROM_STRING
); );
E_SIMPLE1(drive_unmount_pending, info, true, E_SIMPLE1(drive_unmount_pending, info, true,
std::string, location, loc, E_STRING std::string, location, loc, E_FROM_STRING
); );
E_SIMPLE1(drive_unmounted, info, true, E_SIMPLE1(drive_unmounted, info, true,
std::string, location, loc, E_STRING std::string, location, loc, E_FROM_STRING
); );
E_SIMPLE1(event_level_changed, info, true, E_SIMPLE1(event_level_changed, info, true,
std::string, new_event_level, level, E_STRING std::string, new_event_level, level, E_FROM_STRING
); );
E_SIMPLE1(failed_upload_queued, error, true, E_SIMPLE1(failed_upload_queued, error, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE1(failed_upload_removed, warn, true, E_SIMPLE1(failed_upload_removed, warn, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE1(failed_upload_retry, info, true, E_SIMPLE1(failed_upload_retry, info, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE2(file_get_failed, error, true, E_SIMPLE2(file_get_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE1(file_get_api_list_failed, error, true, E_SIMPLE1(file_get_api_list_failed, error, true,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE1(file_pinned, info, true, E_SIMPLE1(file_pinned, info, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE3(file_read_bytes_failed, error, true, E_SIMPLE3(file_read_bytes_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_STRING, std::string, error, err, E_FROM_STRING,
std::size_t, retry, retry, E_FROM_SIZE_T std::size_t, retry, retry, E_FROM_SIZE_T
); );
E_SIMPLE1(file_removed, debug, true, E_SIMPLE1(file_removed, debug, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE2(file_removed_externally, warn, true, E_SIMPLE2(file_removed_externally, warn, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE2(file_remove_failed, error, true, E_SIMPLE2(file_remove_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE3(file_rename_failed, error, true, E_SIMPLE3(file_rename_failed, error, true,
std::string, from_api_path, FROM, E_STRING, std::string, from_api_path, FROM, E_FROM_STRING,
std::string, to_api_path, TO, E_STRING, std::string, to_api_path, TO, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE2(file_get_size_failed, error, true, E_SIMPLE2(file_get_size_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE3(filesystem_item_added, debug, true, E_SIMPLE3(filesystem_item_added, debug, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, parent, parent, E_STRING, std::string, parent, parent, E_FROM_STRING,
bool, directory, dir, E_FROM_BOOL bool, directory, dir, E_FROM_BOOL
); );
E_SIMPLE4(filesystem_item_closed, trace, true, E_SIMPLE4(filesystem_item_closed, trace, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
bool, directory, dir, E_FROM_BOOL, bool, directory, dir, E_FROM_BOOL,
bool, changed, changed, E_FROM_BOOL bool, changed, changed, E_FROM_BOOL
); );
E_SIMPLE5(filesystem_item_handle_closed, trace, true, E_SIMPLE5(filesystem_item_handle_closed, trace, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::uint64_t, handle, handle, E_FROM_UINT64, std::uint64_t, handle, handle, E_FROM_UINT64,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
bool, directory, dir, E_FROM_BOOL, bool, directory, dir, E_FROM_BOOL,
bool, changed, changed, E_FROM_BOOL bool, changed, changed, E_FROM_BOOL
); );
E_SIMPLE4(filesystem_item_handle_opened, trace, true, E_SIMPLE4(filesystem_item_handle_opened, trace, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::uint64_t, handle, handle, E_FROM_UINT64, std::uint64_t, handle, handle, E_FROM_UINT64,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
bool, directory, dir, E_FROM_BOOL bool, directory, dir, E_FROM_BOOL
); );
E_SIMPLE2(filesystem_item_evicted, info, true, E_SIMPLE2(filesystem_item_evicted, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE3(filesystem_item_opened, trace, true, E_SIMPLE3(filesystem_item_opened, trace, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
bool, directory, dir, E_FROM_BOOL bool, directory, dir, E_FROM_BOOL
); );
E_SIMPLE1(file_unpinned, info, true, E_SIMPLE1(file_unpinned, info, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE4(file_upload_completed, info, true, E_SIMPLE4(file_upload_completed, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
api_error, result, res, E_FROM_API_FILE_ERROR, api_error, result, res, E_FROM_API_FILE_ERROR,
bool, cancelled, cancel, E_FROM_BOOL bool, cancelled, cancel, E_FROM_BOOL
); );
E_SIMPLE3(file_upload_failed, error, true, E_SIMPLE3(file_upload_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE2(file_upload_not_found, warn, true, E_SIMPLE2(file_upload_not_found, warn, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE2(file_upload_queued, info, true, E_SIMPLE2(file_upload_queued, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE1(file_upload_removed, debug, true, E_SIMPLE1(file_upload_removed, debug, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
E_SIMPLE3(file_upload_retry, info, true, E_SIMPLE3(file_upload_retry, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
api_error, result, res, E_FROM_API_FILE_ERROR api_error, result, res, E_FROM_API_FILE_ERROR
); );
E_SIMPLE2(file_upload_started, info, true, E_SIMPLE2(file_upload_started, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE1(orphaned_file_deleted, warn, true, E_SIMPLE1(orphaned_file_deleted, warn, true,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE1(orphaned_file_detected, warn, true, E_SIMPLE1(orphaned_file_detected, warn, true,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE3(orphaned_file_processing_failed, error, true, E_SIMPLE3(orphaned_file_processing_failed, error, true,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
std::string, dest, dest, E_STRING, std::string, dest, dest, E_FROM_STRING,
std::string, result, res, E_STRING std::string, result, res, E_FROM_STRING
); );
E_SIMPLE1(orphaned_source_file_detected, info, true, E_SIMPLE1(orphaned_source_file_detected, info, true,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE1(orphaned_source_file_removed, info, true, E_SIMPLE1(orphaned_source_file_removed, info, true,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE1(polling_item_begin, debug, true, E_SIMPLE1(polling_item_begin, debug, true,
std::string, item_name, item, E_STRING std::string, item_name, item, E_FROM_STRING
); );
E_SIMPLE1(polling_item_end, debug, true, E_SIMPLE1(polling_item_end, debug, true,
std::string, item_name, item, E_STRING std::string, item_name, item, E_FROM_STRING
); );
E_SIMPLE2(provider_offline, error, true, E_SIMPLE2(provider_offline, error, true,
std::string, host_name_or_ip, host, E_STRING, std::string, host_name_or_ip, host, E_FROM_STRING,
std::uint16_t, port, port, E_FROM_UINT16 std::uint16_t, port, port, E_FROM_UINT16
); );
E_SIMPLE2(provider_upload_begin, info, true, E_SIMPLE2(provider_upload_begin, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING std::string, source, src, E_FROM_STRING
); );
E_SIMPLE3(provider_upload_end, info, true, E_SIMPLE3(provider_upload_end, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, source, src, E_STRING, std::string, source, src, E_FROM_STRING,
api_error, result, res, E_FROM_API_FILE_ERROR api_error, result, res, E_FROM_API_FILE_ERROR
); );
E_SIMPLE2(repertory_exception, error, true, E_SIMPLE2(repertory_exception, error, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, message, msg, E_STRING std::string, message, msg, E_FROM_STRING
); );
E_SIMPLE1(rpc_server_exception, error, true, E_SIMPLE1(rpc_server_exception, error, true,
std::string, exception, exception, E_STRING std::string, exception, exception, E_FROM_STRING
); );
E_SIMPLE1(service_shutdown_begin, debug, true, E_SIMPLE1(service_shutdown_begin, debug, true,
std::string, service, svc, E_STRING std::string, service, svc, E_FROM_STRING
); );
E_SIMPLE1(service_shutdown_end, debug, true, E_SIMPLE1(service_shutdown_end, debug, true,
std::string, service, svc, E_STRING std::string, service, svc, E_FROM_STRING
); );
E_SIMPLE1(service_started, debug, true, E_SIMPLE1(service_started, debug, true,
std::string, service, svc, E_STRING std::string, service, svc, E_FROM_STRING
); );
E_SIMPLE(unmount_requested, info, true); E_SIMPLE(unmount_requested, info, true);
#if !defined(_WIN32) #if !defined(_WIN32)
E_SIMPLE2(unmount_result, info, true, E_SIMPLE2(unmount_result, info, true,
std::string, location, loc, E_STRING, std::string, location, loc, E_FROM_STRING,
std::string, result, res, E_STRING std::string, result, res, E_FROM_STRING
); );
#endif #endif
// clang-format on // clang-format on
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_EVENTS_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_EVENTS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_ #ifndef REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
#define INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_ #define REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_
#include "events/event.hpp" #include "events/event.hpp"
#include "utils/collection.hpp" #include "utils/collection.hpp"
@ -190,4 +190,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_ #endif // REPERTORY_INCLUDE_EVENTS_T_EVENT_SYSTEM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_FILE_MANAGER_EVENTS_HPP_ #ifndef REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
#define INCLUDE_FILE_MANAGER_EVENTS_HPP_ #define REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_
#include "events/events.hpp" #include "events/events.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -28,21 +28,21 @@
namespace repertory { namespace repertory {
// clang-format off // clang-format off
E_SIMPLE2(download_begin, info, true, E_SIMPLE2(download_begin, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING std::string, dest_path, dest, E_FROM_STRING
); );
E_SIMPLE5(download_chunk_begin, debug, true, E_SIMPLE5(download_chunk_begin, debug, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
std::size_t, chunk, chunk, E_FROM_SIZE_T, std::size_t, chunk, chunk, E_FROM_SIZE_T,
std::size_t, total, total, E_FROM_SIZE_T, std::size_t, total, total, E_FROM_SIZE_T,
std::size_t, complete, complete, E_FROM_SIZE_T std::size_t, complete, complete, E_FROM_SIZE_T
); );
E_SIMPLE6(download_chunk_end, debug, true, E_SIMPLE6(download_chunk_end, debug, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
std::size_t, chunk, chunk, E_FROM_SIZE_T, std::size_t, chunk, chunk, E_FROM_SIZE_T,
std::size_t, total, total, E_FROM_SIZE_T, std::size_t, total, total, E_FROM_SIZE_T,
std::size_t, complete, complete, E_FROM_SIZE_T, std::size_t, complete, complete, E_FROM_SIZE_T,
@ -50,48 +50,48 @@ E_SIMPLE6(download_chunk_end, debug, true,
); );
E_SIMPLE3(download_end, info, true, E_SIMPLE3(download_end, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
api_error, result, result, E_FROM_API_FILE_ERROR api_error, result, result, E_FROM_API_FILE_ERROR
); );
E_SIMPLE3(download_progress, info, true, E_SIMPLE3(download_progress, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
double, progress, prog, E_DOUBLE_PRECISE double, progress, prog, E_FROM_DOUBLE_PRECISE
); );
E_SIMPLE2(download_restored, info, true, E_SIMPLE2(download_restored, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING std::string, dest_path, dest, E_FROM_STRING
); );
E_SIMPLE3(download_restore_failed, error, true, E_SIMPLE3(download_restore_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE3(download_resume_add_failed, error, true, E_SIMPLE3(download_resume_add_failed, error, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING, std::string, dest_path, dest, E_FROM_STRING,
std::string, error, err, E_STRING std::string, error, err, E_FROM_STRING
); );
E_SIMPLE2(download_resume_added, info, true, E_SIMPLE2(download_resume_added, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING std::string, dest_path, dest, E_FROM_STRING
); );
E_SIMPLE2(download_resume_removed, info, true, E_SIMPLE2(download_resume_removed, info, true,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
std::string, dest_path, dest, E_STRING std::string, dest_path, dest, E_FROM_STRING
); );
E_SIMPLE1(item_timeout, debug, true, E_SIMPLE1(item_timeout, debug, true,
std::string, api_path, ap, E_STRING std::string, api_path, ap, E_FROM_STRING
); );
// clang-format on // clang-format on
} // namespace repertory } // namespace repertory
#endif // INCLUDE_FILE_MANAGER_EVENTS_HPP_ #endif // REPERTORY_INCLUDE_FILE_MANAGER_EVENTS_HPP_

View File

@ -19,10 +19,9 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_ #ifndef REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
#define INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_ #define REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
#include "database/db_common.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/events.hpp" #include "events/events.hpp"
#include "file_manager/i_file_manager.hpp" #include "file_manager/i_file_manager.hpp"
@ -30,6 +29,7 @@
#include "file_manager/i_upload_manager.hpp" #include "file_manager/i_upload_manager.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/db/sqlite/db_common.hpp"
#include "utils/file.hpp" #include "utils/file.hpp"
namespace repertory { namespace repertory {
@ -172,10 +172,16 @@ public:
get_handles() const -> std::vector<std::uint64_t> override; get_handles() const -> std::vector<std::uint64_t> override;
[[nodiscard]] auto [[nodiscard]] auto
get_open_data() const -> std::map<std::uint64_t, open_file_data> override; get_open_data() -> std::map<std::uint64_t, open_file_data> & override;
[[nodiscard]] auto get_open_data() const
-> const std::map<std::uint64_t, open_file_data> & override;
[[nodiscard]] auto [[nodiscard]] auto
get_open_data(std::uint64_t handle) const -> open_file_data override; get_open_data(std::uint64_t handle) -> open_file_data & override;
[[nodiscard]] auto get_open_data(std::uint64_t handle) const
-> const open_file_data & override;
[[nodiscard]] auto get_open_file_count() const -> std::size_t override; [[nodiscard]] auto get_open_file_count() const -> std::size_t override;
@ -452,7 +458,7 @@ private:
i_provider &provider_; i_provider &provider_;
private: private:
db::db3_t db_{nullptr}; utils::db::sqlite::db3_t db_{nullptr};
std::uint64_t next_handle_{0U}; std::uint64_t next_handle_{0U};
mutable std::recursive_mutex open_file_mtx_; mutable std::recursive_mutex open_file_mtx_;
std::unordered_map<std::string, std::shared_ptr<i_closeable_open_file>> std::unordered_map<std::string, std::shared_ptr<i_closeable_open_file>>
@ -561,4 +567,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_ #endif // REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_ #ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
#define INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_ #define REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -31,23 +31,22 @@ class i_file_manager {
INTERFACE_SETUP(i_file_manager); INTERFACE_SETUP(i_file_manager);
public: public:
[[nodiscard]] virtual auto evict_file(const std::string &api_path) [[nodiscard]] virtual auto
-> bool = 0; evict_file(const std::string &api_path) -> bool = 0;
[[nodiscard]] virtual auto get_directory_items(
const std::string &api_path) const -> directory_item_list = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
get_directory_items(const std::string &api_path) const get_open_files() const -> std::unordered_map<std::string, std::size_t> = 0;
-> directory_item_list = 0;
[[nodiscard]] virtual auto get_open_files() const
-> std::unordered_map<std::string, std::size_t> = 0;
[[nodiscard]] virtual auto has_no_open_file_handles() const -> bool = 0; [[nodiscard]] virtual auto has_no_open_file_handles() const -> bool = 0;
[[nodiscard]] virtual auto is_processing(const std::string &api_path) const [[nodiscard]] virtual auto
-> bool = 0; is_processing(const std::string &api_path) const -> bool = 0;
virtual void update_used_space(std::uint64_t &used_space) const = 0; virtual void update_used_space(std::uint64_t &used_space) const = 0;
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_ #endif // REPERTORY_INCLUDE_FILE_MANAGER_I_FILE_MANAGER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_ #ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
#define INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_ #define REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -40,19 +40,25 @@ public:
[[nodiscard]] virtual auto get_filesystem_item() const -> filesystem_item = 0; [[nodiscard]] virtual auto get_filesystem_item() const -> filesystem_item = 0;
[[nodiscard]] virtual auto get_open_data() const [[nodiscard]] virtual auto
-> std::map<std::uint64_t, open_file_data> = 0; get_open_data() -> std::map<std::uint64_t, open_file_data> & = 0;
[[nodiscard]] virtual auto get_open_data(std::uint64_t handle) const [[nodiscard]] virtual auto
-> open_file_data = 0; get_open_data() const -> const std::map<std::uint64_t, open_file_data> & = 0;
[[nodiscard]] virtual auto
get_open_data(std::uint64_t handle) -> open_file_data & = 0;
[[nodiscard]] virtual auto
get_open_data(std::uint64_t handle) const -> const open_file_data & = 0;
[[nodiscard]] virtual auto get_open_file_count() const -> std::size_t = 0; [[nodiscard]] virtual auto get_open_file_count() const -> std::size_t = 0;
[[nodiscard]] virtual auto get_read_state() const [[nodiscard]] virtual auto
-> boost::dynamic_bitset<> = 0; get_read_state() const -> boost::dynamic_bitset<> = 0;
[[nodiscard]] virtual auto get_read_state(std::size_t chunk) const [[nodiscard]] virtual auto
-> bool = 0; get_read_state(std::size_t chunk) const -> bool = 0;
[[nodiscard]] virtual auto get_source_path() const -> std::string = 0; [[nodiscard]] virtual auto get_source_path() const -> std::string = 0;
@ -68,11 +74,11 @@ public:
native_operation_callback callback) -> api_error = 0; native_operation_callback callback) -> api_error = 0;
[[nodiscard]] virtual auto read(std::size_t read_size, [[nodiscard]] virtual auto read(std::size_t read_size,
std::uint64_t read_offset, data_buffer &data) std::uint64_t read_offset,
-> api_error = 0; data_buffer &data) -> api_error = 0;
[[nodiscard]] virtual auto resize(std::uint64_t new_file_size) [[nodiscard]] virtual auto
-> api_error = 0; resize(std::uint64_t new_file_size) -> api_error = 0;
virtual void set_api_path(const std::string &api_path) = 0; virtual void set_api_path(const std::string &api_path) = 0;
@ -91,8 +97,8 @@ public:
virtual auto close() -> bool = 0; virtual auto close() -> bool = 0;
[[nodiscard]] virtual auto get_handles() const [[nodiscard]] virtual auto
-> std::vector<std::uint64_t> = 0; get_handles() const -> std::vector<std::uint64_t> = 0;
[[nodiscard]] virtual auto is_complete() const -> bool = 0; [[nodiscard]] virtual auto is_complete() const -> bool = 0;
@ -104,4 +110,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_ #endif // REPERTORY_INCLUDE_FILE_MANAGER_I_OPEN_FILE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_ #ifndef REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
#define INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_ #define REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_
namespace repertory { namespace repertory {
class i_open_file; class i_open_file;
@ -40,4 +40,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_ #endif // REPERTORY_INCLUDE_FILE_MANAGER_I_UPLOAD_MANAGER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PLATFORM_PLATFORM_HPP_ #ifndef REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
#define INCLUDE_PLATFORM_PLATFORM_HPP_ #define REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_
#include "platform/unix_platform.hpp" #include "platform/unix_platform.hpp"
#include "platform/win32_platform.hpp" #include "platform/win32_platform.hpp"
@ -29,4 +29,4 @@
#include "utils/windows.hpp" #include "utils/windows.hpp"
#include "utils/windows/windows_utils.hpp" #include "utils/windows/windows_utils.hpp"
#endif // INCLUDE_PLATFORM_PLATFORM_HPP_ #endif // REPERTORY_INCLUDE_PLATFORM_PLATFORM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PLATFORM_UNIXPLATFORM_HPP_ #ifndef REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
#define INCLUDE_PLATFORM_UNIXPLATFORM_HPP_ #define REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -77,4 +77,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_PLATFORM_UNIXPLATFORM_HPP_ #endif // REPERTORY_INCLUDE_PLATFORM_UNIXPLATFORM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PLATFORM_WINPLATFORM_HPP_ #ifndef REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
#define INCLUDE_PLATFORM_WINPLATFORM_HPP_ #define REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "app_config.hpp" #include "app_config.hpp"
@ -83,4 +83,4 @@ public:
} // namespace repertory } // namespace repertory
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_PLATFORM_WINPLATFORM_HPP_ #endif // REPERTORY_INCLUDE_PLATFORM_WINPLATFORM_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_
#include "providers/i_provider.hpp" #include "providers/i_provider.hpp"
#include "providers/meta_db.hpp" #include "providers/meta_db.hpp"
@ -191,4 +191,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_BASE_PROVIDER_HPP_

View File

@ -19,12 +19,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "database/db_common.hpp"
#include "providers/i_provider.hpp" #include "providers/i_provider.hpp"
#include "utils/db/sqlite/db_common.hpp"
#include "utils/encrypting_reader.hpp" #include "utils/encrypting_reader.hpp"
namespace repertory { namespace repertory {
@ -53,7 +53,7 @@ private:
private: private:
app_config &config_; app_config &config_;
db::db3_t db_; utils::db::sqlite::db3_t db_;
private: private:
i_file_manager *fm_ = nullptr; i_file_manager *fm_ = nullptr;
@ -217,4 +217,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_ENCRYPT_ENCRYPT_PROVIDER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_I_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_I_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -31,14 +31,13 @@ class i_provider {
INTERFACE_SETUP(i_provider); INTERFACE_SETUP(i_provider);
public: public:
[[nodiscard]] virtual auto create_directory(const std::string &api_path,
api_meta_map &meta)
-> api_error = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
create_directory_clone_source_meta(const std::string &source_api_path, create_directory(const std::string &api_path,
const std::string &api_path) api_meta_map &meta) -> api_error = 0;
-> api_error = 0;
[[nodiscard]] virtual auto create_directory_clone_source_meta(
const std::string &source_api_path,
const std::string &api_path) -> api_error = 0;
[[nodiscard]] virtual auto create_file(const std::string &api_path, [[nodiscard]] virtual auto create_file(const std::string &api_path,
api_meta_map &meta) -> api_error = 0; api_meta_map &meta) -> api_error = 0;
@ -47,9 +46,8 @@ public:
get_api_path_from_source(const std::string &source_path, get_api_path_from_source(const std::string &source_path,
std::string &api_path) const -> api_error = 0; std::string &api_path) const -> api_error = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto get_directory_item_count(
get_directory_item_count(const std::string &api_path) const const std::string &api_path) const -> std::uint64_t = 0;
-> std::uint64_t = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
get_directory_items(const std::string &api_path, get_directory_items(const std::string &api_path,
@ -58,38 +56,35 @@ public:
[[nodiscard]] virtual auto get_file(const std::string &api_path, [[nodiscard]] virtual auto get_file(const std::string &api_path,
api_file &file) const -> api_error = 0; api_file &file) const -> api_error = 0;
[[nodiscard]] virtual auto get_file_list(api_file_list &list) const [[nodiscard]] virtual auto
-> api_error = 0; get_file_list(api_file_list &list) const -> api_error = 0;
[[nodiscard]] virtual auto get_file_size(const std::string &api_path, [[nodiscard]] virtual auto
std::uint64_t &file_size) const get_file_size(const std::string &api_path,
-> api_error = 0; std::uint64_t &file_size) const -> api_error = 0;
[[nodiscard]] virtual auto get_filesystem_item(const std::string &api_path, [[nodiscard]] virtual auto
bool directory, get_filesystem_item(const std::string &api_path, bool directory,
filesystem_item &fsi) const filesystem_item &fsi) const -> api_error = 0;
-> api_error = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
get_filesystem_item_and_file(const std::string &api_path, api_file &file, get_filesystem_item_and_file(const std::string &api_path, api_file &file,
filesystem_item &fsi) const -> api_error = 0; filesystem_item &fsi) const -> api_error = 0;
[[nodiscard]] virtual auto get_filesystem_item_from_source_path(
const std::string &source_path,
filesystem_item &fsi) const -> api_error = 0;
[[nodiscard]] virtual auto [[nodiscard]] virtual auto
get_filesystem_item_from_source_path(const std::string &source_path, get_item_meta(const std::string &api_path,
filesystem_item &fsi) const api_meta_map &meta) const -> api_error = 0;
-> api_error = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path, [[nodiscard]] virtual auto
api_meta_map &meta) const get_item_meta(const std::string &api_path, const std::string &key,
-> api_error = 0; std::string &value) const -> api_error = 0;
[[nodiscard]] virtual auto get_item_meta(const std::string &api_path, [[nodiscard]] virtual auto
const std::string &key, get_pinned_files() const -> std::vector<std::string> = 0;
std::string &value) const
-> api_error = 0;
[[nodiscard]] virtual auto get_pinned_files() const
-> std::vector<std::string> = 0;
[[nodiscard]] virtual auto get_provider_type() const -> provider_type = 0; [[nodiscard]] virtual auto get_provider_type() const -> provider_type = 0;
@ -119,39 +114,37 @@ public:
std::uint64_t offset, data_buffer &data, std::uint64_t offset, data_buffer &data,
stop_type &stop_requested) -> api_error = 0; stop_type &stop_requested) -> api_error = 0;
[[nodiscard]] virtual auto remove_directory(const std::string &api_path) [[nodiscard]] virtual auto
-> api_error = 0; remove_directory(const std::string &api_path) -> api_error = 0;
[[nodiscard]] virtual auto remove_file(const std::string &api_path) [[nodiscard]] virtual auto
-> api_error = 0; remove_file(const std::string &api_path) -> api_error = 0;
[[nodiscard]] virtual auto remove_item_meta(const std::string &api_path, [[nodiscard]] virtual auto
const std::string &key) remove_item_meta(const std::string &api_path,
-> api_error = 0; const std::string &key) -> api_error = 0;
[[nodiscard]] virtual auto rename_file(const std::string &from_api_path, [[nodiscard]] virtual auto
const std::string &to_api_path) rename_file(const std::string &from_api_path,
-> api_error = 0; const std::string &to_api_path) -> api_error = 0;
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path, [[nodiscard]] virtual auto
const std::string &key, set_item_meta(const std::string &api_path, const std::string &key,
const std::string &value) const std::string &value) -> api_error = 0;
-> api_error = 0;
[[nodiscard]] virtual auto set_item_meta(const std::string &api_path, [[nodiscard]] virtual auto
const api_meta_map &meta) set_item_meta(const std::string &api_path,
-> api_error = 0; const api_meta_map &meta) -> api_error = 0;
[[nodiscard]] virtual auto start(api_item_added_callback api_item_added, [[nodiscard]] virtual auto start(api_item_added_callback api_item_added,
i_file_manager *mgr) -> bool = 0; i_file_manager *mgr) -> bool = 0;
virtual void stop() = 0; virtual void stop() = 0;
[[nodiscard]] virtual auto upload_file(const std::string &api_path, [[nodiscard]] virtual auto
const std::string &source_path, upload_file(const std::string &api_path, const std::string &source_path,
stop_type &stop_requested) stop_type &stop_requested) -> api_error = 0;
-> api_error = 0;
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_I_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_I_PROVIDER_HPP_

View File

@ -19,11 +19,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_META_DB_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_META_DB_HPP_
#define INCLUDE_PROVIDERS_META_DB_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_META_DB_HPP_
#include "database/db_common.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/db/sqlite/db_common.hpp"
namespace repertory { namespace repertory {
class app_config; class app_config;
@ -39,7 +39,7 @@ public:
auto operator=(meta_db &&) -> meta_db & = delete; auto operator=(meta_db &&) -> meta_db & = delete;
private: private:
db::db3_t db_; utils::db::sqlite::db3_t db_;
constexpr static const auto table_name = "meta"; constexpr static const auto table_name = "meta";
private: private:
@ -68,9 +68,9 @@ public:
[[nodiscard]] auto remove_item_meta(const std::string &api_path, [[nodiscard]] auto remove_item_meta(const std::string &api_path,
const std::string &key) -> api_error; const std::string &key) -> api_error;
[[nodiscard]] auto rename_item_meta(const std::string &from_api_path, [[nodiscard]] auto
const std::string &to_api_path) rename_item_meta(const std::string &from_api_path,
-> api_error; const std::string &to_api_path) -> api_error;
[[nodiscard]] auto set_item_meta(const std::string &api_path, [[nodiscard]] auto set_item_meta(const std::string &api_path,
const std::string &key, const std::string &key,
@ -81,4 +81,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_META_DB_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_META_DB_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -28,9 +28,9 @@ namespace repertory {
class app_config; class app_config;
class i_provider; class i_provider;
[[nodiscard]] auto create_provider(const provider_type &prov, [[nodiscard]] auto
app_config &config) create_provider(const provider_type &prov,
-> std::unique_ptr<i_provider>; app_config &config) -> std::unique_ptr<i_provider>;
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_PROVIDER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_
#include "providers/base_provider.hpp" #include "providers/base_provider.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -147,4 +147,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_S3_S3_PROVIDER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_ #ifndef REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
#define INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_ #define REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_
#include "providers/base_provider.hpp" #include "providers/base_provider.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -120,4 +120,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_ #endif // REPERTORY_INCLUDE_PROVIDERS_SIA_SIA_PROVIDER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_RPC_CLIENT_CLIENT_HPP_ #ifndef REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_
#define INCLUDE_RPC_CLIENT_CLIENT_HPP_ #define REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_
#include "types/rpc.hpp" #include "types/rpc.hpp"
@ -38,11 +38,11 @@ public:
[[nodiscard]] auto get_config() -> rpc_response; [[nodiscard]] auto get_config() -> rpc_response;
[[nodiscard]] auto get_config_value_by_name(const std::string &name) [[nodiscard]] auto
-> rpc_response; get_config_value_by_name(const std::string &name) -> rpc_response;
[[nodiscard]] auto get_directory_items(const std::string &api_path) [[nodiscard]] auto
-> rpc_response; get_directory_items(const std::string &api_path) -> rpc_response;
[[nodiscard]] auto get_open_files() -> rpc_response; [[nodiscard]] auto get_open_files() -> rpc_response;
@ -52,9 +52,9 @@ public:
[[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response; [[nodiscard]] auto pinned_status(const std::string &api_file) -> rpc_response;
[[nodiscard]] auto set_config_value_by_name(const std::string &name, [[nodiscard]] auto
const std::string &value) set_config_value_by_name(const std::string &name,
-> rpc_response; const std::string &value) -> rpc_response;
[[nodiscard]] auto unmount() -> rpc_response; [[nodiscard]] auto unmount() -> rpc_response;
@ -62,4 +62,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_RPC_CLIENT_CLIENT_HPP_ #endif // REPERTORY_INCLUDE_RPC_CLIENT_CLIENT_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_RPC_SERVER_FULL_SERVER_HPP_ #ifndef REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
#define INCLUDE_RPC_SERVER_FULL_SERVER_HPP_ #define REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_
#include "rpc/server/server.hpp" #include "rpc/server/server.hpp"
@ -64,4 +64,4 @@ protected:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_RPC_SERVER_FULL_SERVER_HPP_ #endif // REPERTORY_INCLUDE_RPC_SERVER_FULL_SERVER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_RPC_SERVER_SERVER_HPP_ #ifndef REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_
#define INCLUDE_RPC_SERVER_SERVER_HPP_ #define REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_
#include "types/rpc.hpp" #include "types/rpc.hpp"
@ -72,4 +72,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_RPC_SERVER_SERVER_HPP_ #endif // REPERTORY_INCLUDE_RPC_SERVER_SERVER_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_TYPES_REMOTE_HPP_ #ifndef REPERTORY_INCLUDE_TYPES_REMOTE_HPP_
#define INCLUDE_TYPES_REMOTE_HPP_ #define REPERTORY_INCLUDE_TYPES_REMOTE_HPP_
inline constexpr const auto PACKET_SERVICE_FUSE{1U}; inline constexpr const auto PACKET_SERVICE_FUSE{1U};
inline constexpr const auto PACKET_SERVICE_WINFSP{2U}; inline constexpr const auto PACKET_SERVICE_WINFSP{2U};
@ -160,4 +160,4 @@ create_os_open_flags(const open_flags &flags) -> std::uint32_t;
#endif // !defined(_WIN32) #endif // !defined(_WIN32)
} // namespace repertory::remote } // namespace repertory::remote
#endif // INCLUDE_TYPES_REMOTE_HPP_ #endif // REPERTORY_INCLUDE_TYPES_REMOTE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_TYPES_REPERTORY_HPP_ #ifndef REPERTORY_INCLUDE_TYPES_REPERTORY_HPP_
#define INCLUDE_TYPES_REPERTORY_HPP_ #define REPERTORY_INCLUDE_TYPES_REPERTORY_HPP_
namespace repertory { namespace repertory {
inline constexpr const auto max_time{std::numeric_limits<std::uint64_t>::max()}; inline constexpr const auto max_time{std::numeric_limits<std::uint64_t>::max()};
@ -150,7 +150,7 @@ enum class provider_type : std::size_t {
#if defined(_WIN32) #if defined(_WIN32)
struct open_file_data final { struct open_file_data final {
void *directory_buffer{}; PVOID directory_buffer{nullptr};
}; };
#else #else
using open_file_data = int; using open_file_data = int;
@ -289,4 +289,4 @@ using directory_item_list = std::vector<directory_item>;
using meta_provider_callback = std::function<void(directory_item &)>; using meta_provider_callback = std::function<void(directory_item &)>;
} // namespace repertory } // namespace repertory
#endif // INCLUDE_TYPES_REPERTORY_HPP_ #endif // REPERTORY_INCLUDE_TYPES_REPERTORY_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_TYPES_RPC_HPP_ #ifndef REPERTORY_INCLUDE_TYPES_RPC_HPP_
#define INCLUDE_TYPES_RPC_HPP_ #define REPERTORY_INCLUDE_TYPES_RPC_HPP_
namespace repertory { namespace repertory {
struct rpc_host_info { struct rpc_host_info {
@ -56,4 +56,4 @@ const std::string unpin_file = "unpin_file";
} // namespace rpc_method } // namespace rpc_method
} // namespace repertory } // namespace repertory
#endif // INCLUDE_TYPES_RPC_HPP_ #endif // REPERTORY_INCLUDE_TYPES_RPC_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_TYPES_S3_HPP_ #ifndef REPERTORY_INCLUDE_TYPES_S3_HPP_
#define INCLUDE_TYPES_S3_HPP_ #define REPERTORY_INCLUDE_TYPES_S3_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/string.hpp" #include "utils/string.hpp"
@ -73,4 +73,4 @@ struct head_object_result {
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_TYPES_S3_HPP_ #endif // REPERTORY_INCLUDE_TYPES_S3_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_ #ifndef REPERTORY_INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_
#define INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_ #define REPERTORY_INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_
namespace repertory { namespace repertory {
class startup_exception : public virtual std::runtime_error { class startup_exception : public virtual std::runtime_error {
@ -30,4 +30,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_ #endif // REPERTORY_INCLUDE_TYPES_STARTUP_EXCEPTION_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_CLI_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_CLI_UTILS_HPP_
#define INCLUDE_UTILS_CLI_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_CLI_UTILS_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -109,4 +109,4 @@ parse_drive_options(std::vector<const char *> args, provider_type &prov,
std::string &data_directory) -> std::vector<std::string>; std::string &data_directory) -> std::vector<std::string>;
} // namespace repertory::utils::cli } // namespace repertory::utils::cli
#endif // INCLUDE_UTILS_CLI_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_CLI_UTILS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_ERROR_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_ERROR_UTILS_HPP_
#define INCLUDE_UTILS_ERROR_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_ERROR_UTILS_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -92,4 +92,4 @@ void raise_url_error(std::string_view function, std::string_view url,
} // namespace repertory::utils::error } // namespace repertory::utils::error
#endif // INCLUDE_UTILS_ERROR_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_ERROR_UTILS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_FILE_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_FILE_UTILS_HPP_
#define INCLUDE_UTILS_FILE_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_FILE_UTILS_HPP_
#include "utils/file.hpp" #include "utils/file.hpp"
@ -35,4 +35,4 @@ read_file_lines(const std::string &path) -> std::vector<std::string>;
[[nodiscard]] auto reset_modified_time(const std::string &path) -> bool; [[nodiscard]] auto reset_modified_time(const std::string &path) -> bool;
} // namespace repertory::utils::file } // namespace repertory::utils::file
#endif // INCLUDE_UTILS_FILE_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_FILE_UTILS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_POLLING_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_POLLING_HPP_
#define INCLUDE_UTILS_POLLING_HPP_ #define REPERTORY_INCLUDE_UTILS_POLLING_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -83,4 +83,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_UTILS_POLLING_HPP_ #endif // REPERTORY_INCLUDE_UTILS_POLLING_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_
#define INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_ #define REPERTORY_INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -65,4 +65,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_ #endif // REPERTORY_INCLUDE_UTILS_SINGLE_THREAD_SERVICE_BASE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_THROTTLE_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_THROTTLE_HPP_
#define INCLUDE_UTILS_THROTTLE_HPP_ #define REPERTORY_INCLUDE_UTILS_THROTTLE_HPP_
namespace repertory { namespace repertory {
class throttle final { class throttle final {
@ -56,4 +56,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_UTILS_THROTTLE_HPP_ #endif // REPERTORY_INCLUDE_UTILS_THROTTLE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_TIMEOUT_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_TIMEOUT_HPP_
#define INCLUDE_UTILS_TIMEOUT_HPP_ #define REPERTORY_INCLUDE_UTILS_TIMEOUT_HPP_
namespace repertory { namespace repertory {
class timeout final { class timeout final {
@ -47,4 +47,4 @@ public:
}; };
} // namespace repertory } // namespace repertory
#endif // INCLUDE_UTILS_TIMEOUT_HPP_ #endif // REPERTORY_INCLUDE_UTILS_TIMEOUT_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_
#define INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_
#if !defined(_WIN32) #if !defined(_WIN32)
#include "types/remote.hpp" #include "types/remote.hpp"
@ -49,4 +49,4 @@ void windows_create_to_unix(const UINT32 &create_options,
} // namespace repertory::utils } // namespace repertory::utils
#endif // !_WIN32 #endif // !_WIN32
#endif // INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_UNIX_UNIX_UTILS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_UTILS_HPP_
#define INCLUDE_UTILS_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_UTILS_HPP_
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -35,4 +35,4 @@ create_volume_label(const provider_type &prov) -> std::string;
[[nodiscard]] auto get_attributes_from_meta(const api_meta_map &meta) -> DWORD; [[nodiscard]] auto get_attributes_from_meta(const api_meta_map &meta) -> DWORD;
} // namespace repertory::utils } // namespace repertory::utils
#endif // INCLUDE_UTILS_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_UTILS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_ #ifndef REPERTORY_INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_
#define INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_ #define REPERTORY_INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_
#if defined(_WIN32) #if defined(_WIN32)
#include "types/remote.hpp" #include "types/remote.hpp"
@ -51,4 +51,4 @@ unix_open_flags_to_flags_and_perms(const remote::file_mode &mode,
} // namespace repertory::utils } // namespace repertory::utils
#endif // _WIN32 #endif // _WIN32
#endif // INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_ #endif // REPERTORY_INCLUDE_UTILS_WINDOWS_WINDOWS_UTILS_HPP_

View File

@ -33,8 +33,8 @@
namespace repertory { namespace repertory {
// clang-format off // clang-format off
E_SIMPLE2(packet_client_timeout, error, true, E_SIMPLE2(packet_client_timeout, error, true,
std::string, event_name, en, E_STRING, std::string, event_name, en, E_FROM_STRING,
std::string, message, msg, E_STRING std::string, message, msg, E_FROM_STRING
); );
// clang-format on // clang-format on

View File

@ -48,8 +48,8 @@ namespace repertory::remote_fuse {
// clang-format off // clang-format off
E_SIMPLE3(remote_fuse_server_event, debug, true, E_SIMPLE3(remote_fuse_server_event, debug, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32 packet::error_type, result, res, E_FROM_INT32
); );
// clang-format on // clang-format on

View File

@ -40,8 +40,8 @@ namespace repertory::remote_winfsp {
// clang-format off // clang-format off
E_SIMPLE3(remote_winfsp_client_event, debug, true, E_SIMPLE3(remote_winfsp_client_event, debug, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
packet::error_type, result, res, E_FROM_INT32 packet::error_type, result, res, E_FROM_INT32
); );
// clang-format on // clang-format on

View File

@ -54,8 +54,8 @@ namespace repertory::remote_winfsp {
// clang-format off // clang-format off
E_SIMPLE3(remote_winfsp_server_event, debug, true, E_SIMPLE3(remote_winfsp_server_event, debug, true,
std::string, function, FUNC, E_STRING, std::string, function, FUNC, E_FROM_STRING,
std::string, api_path, AP, E_STRING, std::string, api_path, AP, E_FROM_STRING,
packet::error_type, result, RES, E_FROM_INT32 packet::error_type, result, RES, E_FROM_INT32
); );
// clang-format on // clang-format on

View File

@ -42,7 +42,7 @@ remote_winfsp_drive::winfsp_service::winfsp_service(
lock_data &lock, remote_winfsp_drive &drive, lock_data &lock, remote_winfsp_drive &drive,
std::vector<std::string> drive_args, app_config &config) std::vector<std::string> drive_args, app_config &config)
: Service(&(L"RepertoryRemote_" + : Service(&(L"RepertoryRemote_" +
utils::string::from_utf8(lock.get_unique_id()))[0u]), utils::string::from_utf8(lock.get_unique_id()))[0U]),
config_(config), config_(config),
lock_(lock), lock_(lock),
drive_(drive), drive_(drive),
@ -54,22 +54,22 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS {
static_cast<const char *>(__FUNCTION__), static_cast<const char *>(__FUNCTION__),
}; };
const auto mount_location = utils::string::to_lower( const auto mount_location = utils::string::to_lower(utils::path::absolute(
utils::path::absolute((drive_args_.size() > 1u) ? drive_args_[1u] : "")); (drive_args_.size() > 1U) ? drive_args_.at(1U) : ""));
const auto drive_letter = const auto drive_letter =
((mount_location.size() == 2u) || ((mount_location.size() == 2U) ||
((mount_location.size() == 3u) && (mount_location[2u] == '\\'))) && ((mount_location.size() == 3U) && (mount_location.at(2U) == '\\'))) &&
(mount_location[1u] == ':'); (mount_location.at(1U) == ':');
auto ret = drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED; auto ret = drive_letter ? STATUS_DEVICE_BUSY : STATUS_NOT_SUPPORTED;
if ((drive_letter && not utils::file::directory(mount_location).exists())) { if ((drive_letter && not utils::file::directory(mount_location).exists())) {
auto unicode_mount_location = utils::string::from_utf8(mount_location); auto unicode_mount_location = utils::string::from_utf8(mount_location);
host_.SetFileSystemName(&unicode_mount_location[0u]); host_.SetFileSystemName(&unicode_mount_location[0U]);
if (config_.get_enable_mount_manager()) { if (config_.get_enable_mount_manager()) {
unicode_mount_location = unicode_mount_location =
std::wstring(L"\\\\.\\") + unicode_mount_location[0u] + L":"; std::wstring(L"\\\\.\\") + unicode_mount_location[0U] + L":";
} }
ret = host_.Mount(&unicode_mount_location[0u]); ret = host_.Mount(&unicode_mount_location[0U]);
} else { } else {
std::cerr << (drive_letter ? "Mount location in use: " std::cerr << (drive_letter ? "Mount location in use: "
: "Mount location not supported: ") : "Mount location not supported: ")
@ -119,7 +119,7 @@ auto remote_winfsp_drive::CanDelete(PVOID /*file_node*/, PVOID file_desc,
VOID remote_winfsp_drive::Cleanup(PVOID /*file_node*/, PVOID file_desc, VOID remote_winfsp_drive::Cleanup(PVOID /*file_node*/, PVOID file_desc,
PWSTR file_name, ULONG flags) { PWSTR file_name, ULONG flags) {
BOOLEAN was_closed; BOOLEAN was_closed{};
remote_instance_->winfsp_cleanup(file_desc, file_name, flags, was_closed); remote_instance_->winfsp_cleanup(file_desc, file_name, flags, was_closed);
} }
@ -136,15 +136,15 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
remote::file_info fi{}; remote::file_info fi{};
std::string normalized_name; std::string normalized_name;
BOOLEAN exists = 0; BOOLEAN exists = 0;
const auto ret = remote_instance_->winfsp_create( auto ret = remote_instance_->winfsp_create(
file_name, create_options, granted_access, attributes, allocation_size, file_name, create_options, granted_access, attributes, allocation_size,
file_desc, &fi, normalized_name, exists); file_desc, &fi, normalized_name, exists);
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
set_file_info(ofi->FileInfo, fi); set_file_info(ofi->FileInfo, fi);
const auto file_path = utils::string::from_utf8(normalized_name); const auto file_path = utils::string::from_utf8(normalized_name);
wcsncpy(ofi->NormalizedName, &file_path[0], wcslen(&file_path[0])); wcsncpy(ofi->NormalizedName, file_path.data(), wcslen(file_path.c_str()));
ofi->NormalizedNameSize = ofi->NormalizedNameSize =
static_cast<UINT16>(wcslen(&file_path[0]) * sizeof(WCHAR)); static_cast<UINT16>(wcslen(file_path.c_str()) * sizeof(WCHAR));
} }
return ret; return ret;
@ -153,7 +153,7 @@ auto remote_winfsp_drive::Create(PWSTR file_name, UINT32 create_options,
auto remote_winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc, auto remote_winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_flush(file_desc, &fi); auto ret = remote_instance_->winfsp_flush(file_desc, &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);
return ret; return ret;
} }
@ -161,7 +161,7 @@ auto remote_winfsp_drive::Flush(PVOID /*file_node*/, PVOID file_desc,
auto remote_winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc, auto remote_winfsp_drive::GetFileInfo(PVOID /*file_node*/, PVOID file_desc,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_get_file_info(file_desc, &fi); auto ret = remote_instance_->winfsp_get_file_info(file_desc, &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);
return ret; return ret;
} }
@ -170,16 +170,16 @@ auto remote_winfsp_drive::GetSecurityByName(
PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor, PWSTR file_name, PUINT32 attributes, PSECURITY_DESCRIPTOR descriptor,
SIZE_T *descriptor_size) -> NTSTATUS { SIZE_T *descriptor_size) -> NTSTATUS {
std::wstring string_descriptor; std::wstring string_descriptor;
std::uint64_t sds = descriptor_size ? *descriptor_size : 0; std::uint64_t sds = (descriptor_size == nullptr) ? 0 : *descriptor_size;
auto ret = remote_instance_->winfsp_get_security_by_name( auto ret = remote_instance_->winfsp_get_security_by_name(
file_name, attributes, descriptor_size ? &sds : nullptr, file_name, attributes, descriptor_size ? &sds : nullptr,
string_descriptor); string_descriptor);
*descriptor_size = static_cast<SIZE_T>(sds); *descriptor_size = static_cast<SIZE_T>(sds);
if ((ret == STATUS_SUCCESS) && *descriptor_size) { if ((ret == STATUS_SUCCESS) && *descriptor_size) {
PSECURITY_DESCRIPTOR sd = nullptr; PSECURITY_DESCRIPTOR sd{nullptr};
ULONG sz2 = 0u; ULONG sz2{0U};
if (::ConvertStringSecurityDescriptorToSecurityDescriptorW( if (::ConvertStringSecurityDescriptorToSecurityDescriptorW(
&string_descriptor[0u], SDDL_REVISION_1, &sd, &sz2)) { string_descriptor.data(), SDDL_REVISION_1, &sd, &sz2)) {
if (sz2 > *descriptor_size) { if (sz2 > *descriptor_size) {
ret = STATUS_BUFFER_TOO_SMALL; ret = STATUS_BUFFER_TOO_SMALL;
} else { } else {
@ -196,15 +196,15 @@ auto remote_winfsp_drive::GetSecurityByName(
auto remote_winfsp_drive::GetVolumeInfo(VolumeInfo *volume_info) -> NTSTATUS { auto remote_winfsp_drive::GetVolumeInfo(VolumeInfo *volume_info) -> NTSTATUS {
std::string volume_label; std::string volume_label;
const auto ret = remote_instance_->winfsp_get_volume_info( auto ret = remote_instance_->winfsp_get_volume_info(
volume_info->TotalSize, volume_info->FreeSize, volume_label); volume_info->TotalSize, volume_info->FreeSize, volume_label);
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
const auto byte_size = const auto byte_size =
static_cast<UINT16>(volume_label.size() * sizeof(WCHAR)); static_cast<UINT16>(volume_label.size() * sizeof(WCHAR));
wcscpy_s(&volume_info->VolumeLabel[0u], 32, wcscpy_s(&volume_info->VolumeLabel[0U], 32,
&utils::string::from_utf8(volume_label)[0u]); utils::string::from_utf8(volume_label).c_str());
volume_info->VolumeLabelLength = volume_info->VolumeLabelLength =
std::min(static_cast<UINT16>(64u), byte_size); std::min(static_cast<UINT16>(64U), byte_size);
} }
return ret; return ret;
} }
@ -214,7 +214,7 @@ auto remote_winfsp_drive::Init(PVOID host) -> NTSTATUS {
if (not config_.get_enable_mount_manager()) { if (not config_.get_enable_mount_manager()) {
file_system_host->SetPrefix( file_system_host->SetPrefix(
&(L"\\repertory\\" + &(L"\\repertory\\" +
std::wstring(file_system_host->FileSystemName()).substr(0, 1))[0u]); std::wstring(file_system_host->FileSystemName()).substr(0U, 1U))[0U]);
} }
file_system_host->SetFileSystemName(std::wstring{REPERTORY_W}.data()); file_system_host->SetFileSystemName(std::wstring{REPERTORY_W}.data());
file_system_host->SetFlushAndPurgeOnCleanup(TRUE); file_system_host->SetFlushAndPurgeOnCleanup(TRUE);
@ -258,8 +258,7 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args)
c = std::make_unique<console_consumer>(config_.get_event_level()); c = std::make_unique<console_consumer>(config_.get_event_level());
} }
event_system::instance().start(); event_system::instance().start();
const auto ret = auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
event_system::instance().raise<drive_mount_result>(std::to_string(ret)); event_system::instance().raise<drive_mount_result>(std::to_string(ret));
event_system::instance().stop(); event_system::instance().stop();
c.reset(); c.reset();
@ -290,15 +289,15 @@ auto remote_winfsp_drive::Open(PWSTR file_name, UINT32 create_options,
OpenFileInfo *ofi) -> NTSTATUS { OpenFileInfo *ofi) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
std::string normalize_name; std::string normalize_name;
const auto ret = auto ret =
remote_instance_->winfsp_open(file_name, create_options, granted_access, remote_instance_->winfsp_open(file_name, create_options, granted_access,
file_desc, &fi, normalize_name); file_desc, &fi, normalize_name);
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
set_file_info(ofi->FileInfo, fi); set_file_info(ofi->FileInfo, fi);
const auto file_path = utils::string::from_utf8(normalize_name); const auto file_path = utils::string::from_utf8(normalize_name);
wcsncpy(ofi->NormalizedName, &file_path[0], wcslen(&file_path[0])); wcsncpy(ofi->NormalizedName, file_path.data(), wcslen(file_path.c_str()));
ofi->NormalizedNameSize = ofi->NormalizedNameSize =
static_cast<UINT16>(wcslen(&file_path[0]) * sizeof(WCHAR)); static_cast<UINT16>(wcslen(file_path.c_str()) * sizeof(WCHAR));
} }
return ret; return ret;
@ -310,7 +309,7 @@ auto remote_winfsp_drive::Overwrite(PVOID /*file_node*/, PVOID file_desc,
UINT64 allocation_size, UINT64 allocation_size,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_overwrite( auto ret = remote_instance_->winfsp_overwrite(
file_desc, attributes, replace_attributes, allocation_size, &fi); file_desc, attributes, replace_attributes, allocation_size, &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);
return ret; return ret;
@ -347,10 +346,12 @@ auto remote_winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
PVOID buffer, ULONG buffer_length, PVOID buffer, ULONG buffer_length,
PULONG bytes_transferred) -> NTSTATUS { PULONG bytes_transferred) -> NTSTATUS {
json item_list; json item_list;
NTSTATUS ret = remote_instance_->winfsp_read_directory(file_desc, pattern, auto ret{
marker, item_list); static_cast<NTSTATUS>(remote_instance_->winfsp_read_directory(
file_desc, pattern, marker, item_list)),
};
if (ret == STATUS_SUCCESS) { if (ret == STATUS_SUCCESS) {
PVOID *directory_buffer = nullptr; PVOID *directory_buffer{nullptr};
if ((ret = remote_instance_->winfsp_get_dir_buffer( if ((ret = remote_instance_->winfsp_get_dir_buffer(
file_desc, directory_buffer)) == STATUS_SUCCESS) { file_desc, directory_buffer)) == STATUS_SUCCESS) {
if (FspFileSystemAcquireDirectoryBuffer( if (FspFileSystemAcquireDirectoryBuffer(
@ -425,7 +426,7 @@ auto remote_winfsp_drive::SetBasicInfo(PVOID /*file_node*/, PVOID file_desc,
UINT64 change_time, UINT64 change_time,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_set_basic_info( auto ret = remote_instance_->winfsp_set_basic_info(
file_desc, attributes, creation_time, last_access_time, last_write_time, file_desc, attributes, creation_time, last_access_time, last_write_time,
change_time, &fi); change_time, &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);
@ -452,8 +453,8 @@ auto remote_winfsp_drive::SetFileSize(PVOID /*file_node*/, PVOID file_desc,
BOOLEAN set_allocation_size, BOOLEAN set_allocation_size,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_set_file_size( auto ret = remote_instance_->winfsp_set_file_size(file_desc, new_size,
file_desc, new_size, set_allocation_size, &fi); set_allocation_size, &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);
return ret; return ret;
} }
@ -480,7 +481,7 @@ auto remote_winfsp_drive::Write(PVOID /*file_node*/, PVOID file_desc,
PULONG bytes_transferred, PULONG bytes_transferred,
FileInfo *file_info) -> NTSTATUS { FileInfo *file_info) -> NTSTATUS {
remote::file_info fi{}; remote::file_info fi{};
const auto ret = remote_instance_->winfsp_write( auto ret = remote_instance_->winfsp_write(
file_desc, buffer, offset, length, write_to_end, constrained_io, file_desc, buffer, offset, length, write_to_end, constrained_io,
reinterpret_cast<PUINT32>(bytes_transferred), &fi); reinterpret_cast<PUINT32>(bytes_transferred), &fi);
set_file_info(*file_info, fi); set_file_info(*file_info, fi);

View File

@ -44,8 +44,8 @@
namespace repertory { namespace repertory {
// clang-format off // clang-format off
E_SIMPLE3(winfsp_event, debug, true, E_SIMPLE3(winfsp_event, debug, true,
std::string, function, func, E_STRING, std::string, function, func, E_FROM_STRING,
std::string, api_path, ap, E_STRING, std::string, api_path, ap, E_FROM_STRING,
NTSTATUS, result, res, E_FROM_INT32 NTSTATUS, result, res, E_FROM_INT32
); );
// clang-format on // clang-format on
@ -273,7 +273,7 @@ VOID winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) {
auto handle = auto handle =
static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(file_desc)); static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(file_desc));
if (handle != 0U) { if (handle != 0U) {
PVOID directory_buffer = nullptr; PVOID directory_buffer{nullptr};
std::shared_ptr<i_open_file> file; std::shared_ptr<i_open_file> file;
if (fm_->get_open_file(handle, false, file)) { if (fm_->get_open_file(handle, false, file)) {
@ -286,6 +286,7 @@ VOID winfsp_drive::Close(PVOID /*file_node*/, PVOID file_desc) {
FspFileSystemDeleteDirectoryBuffer(&directory_buffer); FspFileSystemDeleteDirectoryBuffer(&directory_buffer);
} }
} }
RAISE_WINFSP_EVENT(function_name, api_path, 0); RAISE_WINFSP_EVENT(function_name, api_path, 0);
} }
@ -921,10 +922,10 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
if (error == api_error::success) { if (error == api_error::success) {
directory_iterator iterator(std::move(list)); directory_iterator iterator(std::move(list));
auto status_result = STATUS_SUCCESS; auto status_result = STATUS_SUCCESS;
auto *directory_buffer = auto **directory_buffer =
file->get_open_data(handle).directory_buffer; &file->get_open_data(handle).directory_buffer;
if (FspFileSystemAcquireDirectoryBuffer( if (FspFileSystemAcquireDirectoryBuffer(
&directory_buffer, static_cast<BOOLEAN>(nullptr == marker), directory_buffer, static_cast<BOOLEAN>(nullptr == marker),
&status_result) != 0U) { &status_result) != 0U) {
directory_item dir_item{}; directory_item dir_item{};
auto offset = auto offset =
@ -968,15 +969,15 @@ auto winfsp_drive::ReadDirectory(PVOID /*file_node*/, PVOID file_desc,
display_name.data()); display_name.data());
FspFileSystemFillDirectoryBuffer( FspFileSystemFillDirectoryBuffer(
&directory_buffer, directory_info, &status_result); directory_buffer, directory_info, &status_result);
} }
FspFileSystemReleaseDirectoryBuffer(&directory_buffer); FspFileSystemReleaseDirectoryBuffer(directory_buffer);
} }
if (status_result == STATUS_SUCCESS) { if (status_result == STATUS_SUCCESS) {
FspFileSystemReadDirectoryBuffer(&directory_buffer, marker, FspFileSystemReadDirectoryBuffer(directory_buffer, marker, buffer,
buffer, buffer_length, buffer_length,
bytes_transferred); bytes_transferred);
if (error == api_error::directory_end_of_files) { if (error == api_error::directory_end_of_files) {
error = api_error::success; error = api_error::success;

View File

@ -22,16 +22,16 @@
#include "file_manager/file_manager.hpp" #include "file_manager/file_manager.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "database/db_common.hpp"
#include "database/db_delete.hpp"
#include "database/db_insert.hpp"
#include "database/db_select.hpp"
#include "database/db_update.hpp"
#include "file_manager/events.hpp" #include "file_manager/events.hpp"
#include "providers/i_provider.hpp" #include "providers/i_provider.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "types/startup_exception.hpp" #include "types/startup_exception.hpp"
#include "utils/common.hpp" #include "utils/common.hpp"
#include "utils/db/sqlite/db_common.hpp"
#include "utils/db/sqlite/db_delete.hpp"
#include "utils/db/sqlite/db_insert.hpp"
#include "utils/db/sqlite/db_select.hpp"
#include "utils/db/sqlite/db_update.hpp"
#include "utils/encrypting_reader.hpp" #include "utils/encrypting_reader.hpp"
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "utils/file.hpp" #include "utils/file.hpp"
@ -119,13 +119,13 @@ file_manager::file_manager(app_config &config, i_provider &provider)
for (auto &&create_item : sql_create_tables) { for (auto &&create_item : sql_create_tables) {
std::string err; std::string err;
if (not db::execute_sql(*db_, create_item.second, err)) { if (not utils::db::sqlite::execute_sql(*db_, create_item.second, err)) {
db_.reset(); db_.reset();
throw startup_exception(err); throw startup_exception(err);
} }
} }
db::set_journal_mode(*db_); utils::db::sqlite::set_journal_mode(*db_);
E_SUBSCRIBE_EXACT(file_upload_completed, E_SUBSCRIBE_EXACT(file_upload_completed,
[this](const file_upload_completed &completed) { [this](const file_upload_completed &completed) {
@ -354,10 +354,10 @@ auto file_manager::get_stored_downloads() const -> std::vector<json> {
std::vector<json> ret; std::vector<json> ret;
if (not provider_.is_direct_only()) { if (not provider_.is_direct_only()) {
auto result = db::db_select{*db_.get(), resume_table}.go(); auto result = utils::db::sqlite::db_select{*db_.get(), resume_table}.go();
while (result.has_row()) { while (result.has_row()) {
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not result.get_row(row)) { if (not result.get_row(row)) {
continue; continue;
} }
@ -390,12 +390,12 @@ auto file_manager::handle_file_rename(const std::string &from_api_path,
source_path = upload_lookup_.at(from_api_path)->get_source_path(); source_path = upload_lookup_.at(from_api_path)->get_source_path();
} }
} else { } else {
auto result = db::db_select{*db_.get(), upload_table} auto result = utils::db::sqlite::db_select{*db_.get(), upload_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(from_api_path) .equals(from_api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
should_upload = result.get_row(row) && row.has_value(); should_upload = result.get_row(row) && row.has_value();
if (should_upload && source_path.empty()) { if (should_upload && source_path.empty()) {
source_path = row->get_column("source_path").get_value<std::string>(); source_path = row->get_column("source_path").get_value<std::string>();
@ -438,7 +438,7 @@ auto file_manager::is_processing(const std::string &api_path) const -> bool {
} }
upload_lock.unlock(); upload_lock.unlock();
db::db_select query{*db_.get(), upload_table}; utils::db::sqlite::db_select query{*db_.get(), upload_table};
if (query.where("api_path").equals(api_path).go().has_row()) { if (query.where("api_path").equals(api_path).go().has_row()) {
return true; return true;
}; };
@ -521,7 +521,7 @@ void file_manager::queue_upload(const std::string &api_path,
remove_upload(api_path, true); remove_upload(api_path, true);
auto result = auto result =
db::db_insert{*db_.get(), upload_table} utils::db::sqlite::db_insert{*db_.get(), upload_table}
.or_replace() .or_replace()
.column_value("api_path", api_path) .column_value("api_path", api_path)
.column_value("date_time", .column_value("date_time",
@ -559,7 +559,7 @@ auto file_manager::remove_file(const std::string &api_path) -> api_error {
remove_upload(api_path); remove_upload(api_path);
auto result = db::db_delete{*db_.get(), resume_table} auto result = utils::db::sqlite::db_delete{*db_.get(), resume_table}
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
@ -585,7 +585,7 @@ auto file_manager::remove_file(const std::string &api_path) -> api_error {
void file_manager::remove_resume(const std::string &api_path, void file_manager::remove_resume(const std::string &api_path,
const std::string &source_path) { const std::string &source_path) {
auto result = db::db_delete{*db_.get(), resume_table} auto result = utils::db::sqlite::db_delete{*db_.get(), resume_table}
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
@ -613,7 +613,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
lock = std::make_unique<mutex_lock>(upload_mtx_); lock = std::make_unique<mutex_lock>(upload_mtx_);
} }
auto result = db::db_delete{*db_.get(), upload_table} auto result = utils::db::sqlite::db_delete{*db_.get(), upload_table}
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
@ -623,7 +623,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
"failed to remove from upload table"); "failed to remove from upload table");
} }
result = db::db_delete{*db_.get(), upload_active_table} result = utils::db::sqlite::db_delete{*db_.get(), upload_active_table}
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
@ -820,10 +820,11 @@ void file_manager::start() {
std::vector<active_item> active_items{}; std::vector<active_item> active_items{};
auto result = db::db_select{*db_.get(), upload_active_table}.go(); auto result =
utils::db::sqlite::db_select{*db_.get(), upload_active_table}.go();
while (result.has_row()) { while (result.has_row()) {
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
active_items.emplace_back(active_item{ active_items.emplace_back(active_item{
row->get_column("api_path").get_value<std::string>(), row->get_column("api_path").get_value<std::string>(),
@ -840,14 +841,14 @@ void file_manager::start() {
} }
active_items.clear(); active_items.clear();
result = db::db_select{*db_.get(), resume_table}.go(); result = utils::db::sqlite::db_select{*db_.get(), resume_table}.go();
if (not result.ok()) { if (not result.ok()) {
return; return;
} }
while (result.has_row()) { while (result.has_row()) {
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return; return;
} }
@ -957,7 +958,7 @@ void file_manager::store_resume(const i_open_file &file) {
return; return;
} }
auto result = db::db_insert{*db_.get(), resume_table} auto result = utils::db::sqlite::db_insert{*db_.get(), resume_table}
.or_replace() .or_replace()
.column_value("api_path", file.get_api_path()) .column_value("api_path", file.get_api_path())
.column_value("data", create_resume_entry(file).dump()) .column_value("data", create_resume_entry(file).dump())
@ -992,7 +993,7 @@ void file_manager::swap_renamed_items(std::string from_api_path,
return; return;
} }
auto result = db::db_update{*db_.get(), resume_table} auto result = utils::db::sqlite::db_update{*db_.get(), resume_table}
.column_value("api_path", to_api_path) .column_value("api_path", to_api_path)
.where("api_path") .where("api_path")
.equals(from_api_path) .equals(from_api_path)
@ -1014,10 +1015,11 @@ void file_manager::upload_completed(const file_upload_completed &evt) {
if (not utils::string::to_bool(evt.get_cancelled().get<std::string>())) { if (not utils::string::to_bool(evt.get_cancelled().get<std::string>())) {
auto err = api_error_from_string(evt.get_result().get<std::string>()); auto err = api_error_from_string(evt.get_result().get<std::string>());
if (err == api_error::success) { if (err == api_error::success) {
auto result = db::db_delete{*db_.get(), upload_active_table} auto result =
.where("api_path") utils::db::sqlite::db_delete{*db_.get(), upload_active_table}
.equals(evt.get_api_path().get<std::string>()) .where("api_path")
.go(); .equals(evt.get_api_path().get<std::string>())
.go();
if (not result.ok()) { if (not result.ok()) {
utils::error::raise_api_path_error( utils::error::raise_api_path_error(
function_name, evt.get_api_path().get<std::string>(), function_name, evt.get_api_path().get<std::string>(),
@ -1062,12 +1064,12 @@ void file_manager::upload_handler() {
} }
if (upload_lookup_.size() < config_.get_max_upload_count()) { if (upload_lookup_.size() < config_.get_max_upload_count()) {
auto result = db::db_select{*db_.get(), upload_table} auto result = utils::db::sqlite::db_select{*db_.get(), upload_table}
.order_by("api_path", true) .order_by("api_path", true)
.limit(1) .limit(1)
.go(); .go();
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
auto api_path = row->get_column("api_path").get_value<std::string>(); auto api_path = row->get_column("api_path").get_value<std::string>();
auto source_path = auto source_path =
@ -1088,15 +1090,17 @@ void file_manager::upload_handler() {
upload_lookup_[fsi.api_path] = upload_lookup_[fsi.api_path] =
std::make_unique<upload>(fsi, provider_); std::make_unique<upload>(fsi, provider_);
auto del_res = db::db_delete{*db_.get(), upload_table} auto del_res =
.where("api_path") utils::db::sqlite::db_delete{*db_.get(), upload_table}
.equals(api_path) .where("api_path")
.go(); .equals(api_path)
.go();
if (del_res.ok()) { if (del_res.ok()) {
auto ins_res = db::db_insert{*db_.get(), upload_active_table} auto ins_res =
.column_value("api_path", api_path) utils::db::sqlite::db_insert{*db_.get(), upload_active_table}
.column_value("source_path", source_path) .column_value("api_path", api_path)
.go(); .column_value("source_path", source_path)
.go();
if (not ins_res.ok()) { if (not ins_res.ok()) {
utils::error::raise_api_path_error( utils::error::raise_api_path_error(
function_name, api_path, source_path, function_name, api_path, source_path,

View File

@ -21,6 +21,7 @@
*/ */
#include "file_manager/file_manager.hpp" #include "file_manager/file_manager.hpp"
#include "providers/i_provider.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
namespace repertory { namespace repertory {
@ -82,6 +83,10 @@ auto file_manager::open_file_base::can_close() const -> bool {
return true; return true;
} }
if (provider_.is_direct_only()) {
return true;
}
const std::chrono::system_clock::time_point last_access = last_access_; const std::chrono::system_clock::time_point last_access = last_access_;
const auto duration = std::chrono::duration_cast<std::chrono::seconds>( const auto duration = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now() - last_access); std::chrono::system_clock::now() - last_access);
@ -164,14 +169,26 @@ auto file_manager::open_file_base::get_handles() const
return ret; return ret;
} }
auto file_manager::open_file_base::get_open_data() const auto file_manager::open_file_base::get_open_data()
-> std::map<std::uint64_t, open_file_data> { -> std::map<std::uint64_t, open_file_data> & {
recur_mutex_lock file_lock(file_mtx_); recur_mutex_lock file_lock(file_mtx_);
return open_data_; return open_data_;
} }
auto file_manager::open_file_base::get_open_data() const
-> const std::map<std::uint64_t, open_file_data> & {
recur_mutex_lock file_lock(file_mtx_);
return open_data_;
}
auto file_manager::open_file_base::get_open_data(std::uint64_t handle)
-> open_file_data & {
recur_mutex_lock file_lock(file_mtx_);
return open_data_.at(handle);
}
auto file_manager::open_file_base::get_open_data(std::uint64_t handle) const auto file_manager::open_file_base::get_open_data(std::uint64_t handle) const
-> open_file_data { -> const open_file_data & {
recur_mutex_lock file_lock(file_mtx_); recur_mutex_lock file_lock(file_mtx_);
return open_data_.at(handle); return open_data_.at(handle);
} }

View File

@ -21,14 +21,14 @@
*/ */
#include "providers/encrypt/encrypt_provider.hpp" #include "providers/encrypt/encrypt_provider.hpp"
#include "database/db_common.hpp"
#include "database/db_delete.hpp"
#include "database/db_insert.hpp"
#include "database/db_select.hpp"
#include "events/event_system.hpp" #include "events/event_system.hpp"
#include "events/events.hpp" #include "events/events.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
#include "utils/collection.hpp" #include "utils/collection.hpp"
#include "utils/db/sqlite/db_common.hpp"
#include "utils/db/sqlite/db_delete.hpp"
#include "utils/db/sqlite/db_insert.hpp"
#include "utils/db/sqlite/db_select.hpp"
#include "utils/encrypting_reader.hpp" #include "utils/encrypting_reader.hpp"
#include "utils/encryption.hpp" #include "utils/encryption.hpp"
#include "utils/file_utils.hpp" #include "utils/file_utils.hpp"
@ -194,12 +194,12 @@ auto encrypt_provider::get_api_path_from_source(
}; };
try { try {
auto result = db::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("data") .column("data")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
api_path = row->get_column("data") api_path = row->get_column("data")
.get_value_as_json() .get_value_as_json()
@ -208,7 +208,7 @@ auto encrypt_provider::get_api_path_from_source(
return api_error::success; return api_error::success;
} }
result = db::db_select{*db_, directory_table} result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
@ -273,12 +273,13 @@ auto encrypt_provider::get_directory_items(
try { try {
std::string current_api_path{}; std::string current_api_path{};
if (dir_entry->is_directory_item()) { if (dir_entry->is_directory_item()) {
auto result = db::db_select{*db_, directory_table} auto result =
.column("api_path") utils::db::sqlite::db_select{*db_, directory_table}
.where("source_path") .column("api_path")
.equals(dir_entry->get_path()) .where("source_path")
.go(); .equals(dir_entry->get_path())
std::optional<db::db_select::row> row; .go();
std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
current_api_path = current_api_path =
row->get_column("api_path").get_value<std::string>(); row->get_column("api_path").get_value<std::string>();
@ -287,7 +288,7 @@ auto encrypt_provider::get_directory_items(
process_directory_entry(*dir_entry.get(), cfg, process_directory_entry(*dir_entry.get(), cfg,
current_api_path); current_api_path);
result = db::db_select{*db_, directory_table} result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(dir_entry->get_path()) .equals(dir_entry->get_path())
@ -302,12 +303,12 @@ auto encrypt_provider::get_directory_items(
} }
} else { } else {
std::string api_path_data{}; std::string api_path_data{};
auto result = db::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("data") .column("data")
.where("source_path") .where("source_path")
.equals(dir_entry->get_path()) .equals(dir_entry->get_path())
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
api_path_data = api_path_data =
row->get_column("data").get_value<std::string>(); row->get_column("data").get_value<std::string>();
@ -387,12 +388,12 @@ auto encrypt_provider::get_file(const std::string &api_path,
return api_error::directory_exists; return api_error::directory_exists;
} }
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -443,12 +444,12 @@ auto encrypt_provider::get_file_size(
}; };
try { try {
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -468,12 +469,12 @@ auto encrypt_provider::get_file_size(
auto encrypt_provider::get_filesystem_item( auto encrypt_provider::get_filesystem_item(
const std::string &api_path, bool directory, const std::string &api_path, bool directory,
filesystem_item &fsi) const -> api_error { filesystem_item &fsi) const -> api_error {
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -481,7 +482,7 @@ auto encrypt_provider::get_filesystem_item(
auto source_path = row->get_column("source_path").get_value<std::string>(); auto source_path = row->get_column("source_path").get_value<std::string>();
if (directory) { if (directory) {
result = db::db_select{*db_, directory_table} result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
@ -500,7 +501,7 @@ auto encrypt_provider::get_filesystem_item(
return api_error::success; return api_error::success;
} }
result = db::db_select{*db_, file_table} result = utils::db::sqlite::db_select{*db_, file_table}
.column("data") .column("data")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
@ -586,12 +587,12 @@ auto encrypt_provider::get_item_meta(const std::string &api_path,
}; };
try { try {
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -635,10 +636,11 @@ auto encrypt_provider::get_total_drive_space() const -> std::uint64_t {
} }
auto encrypt_provider::get_total_item_count() const -> std::uint64_t { auto encrypt_provider::get_total_item_count() const -> std::uint64_t {
auto result = auto result = utils::db::sqlite::db_select{*db_, source_table}
db::db_select{*db_, source_table}.count("api_path", "count").go(); .count("api_path", "count")
.go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
return static_cast<std::uint64_t>( return static_cast<std::uint64_t>(
row->get_column("count").get_value<std::int64_t>()); row->get_column("count").get_value<std::int64_t>());
@ -656,12 +658,12 @@ auto encrypt_provider::get_used_drive_space() const -> std::uint64_t {
auto encrypt_provider::is_directory(const std::string &api_path, auto encrypt_provider::is_directory(const std::string &api_path,
bool &exists) const -> api_error { bool &exists) const -> api_error {
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
exists = false; exists = false;
return api_error::success; return api_error::success;
@ -677,12 +679,12 @@ auto encrypt_provider::is_directory(const std::string &api_path,
auto encrypt_provider::is_file(const std::string &api_path, auto encrypt_provider::is_file(const std::string &api_path,
bool &exists) const -> api_error { bool &exists) const -> api_error {
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
exists = false; exists = false;
return api_error::success; return api_error::success;
@ -739,12 +741,12 @@ auto encrypt_provider::process_directory_entry(
current_source_path = utils::path::combine(current_source_path, {part}); current_source_path = utils::path::combine(current_source_path, {part});
std::string current_api_path{}; std::string current_api_path{};
auto result = db::db_select{*db_, directory_table} auto result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(current_source_path) .equals(current_source_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
current_api_path = row->get_column("api_path").get_value<std::string>(); current_api_path = row->get_column("api_path").get_value<std::string>();
} }
@ -753,12 +755,12 @@ auto encrypt_provider::process_directory_entry(
current_api_path = utils::path::create_api_path( current_api_path = utils::path::create_api_path(
current_encrypted_path + '/' + encrypted_parts.at(current_idx)); current_encrypted_path + '/' + encrypted_parts.at(current_idx));
auto ins_res = db::db_insert{*db_, directory_table} auto ins_res = utils::db::sqlite::db_insert{*db_, directory_table}
.column_value("source_path", current_source_path) .column_value("source_path", current_source_path)
.column_value("api_path", current_api_path) .column_value("api_path", current_api_path)
.go(); .go();
// TODO handle error // TODO handle error
ins_res = db::db_insert{*db_, source_table} ins_res = utils::db::sqlite::db_insert{*db_, source_table}
.column_value("api_path", current_api_path) .column_value("api_path", current_api_path)
.column_value("source_path", current_source_path) .column_value("source_path", current_source_path)
.go(); .go();
@ -789,18 +791,18 @@ auto encrypt_provider::process_directory_entry(
utils::path::get_relative_path(dir_entry.get_path(), cfg.path); utils::path::get_relative_path(dir_entry.get_path(), cfg.path);
std::string api_path_data{}; std::string api_path_data{};
auto result = db::db_select{*db_, file_table} auto result = utils::db::sqlite::db_select{*db_, file_table}
.column("data") .column("data")
.where("source_path") .where("source_path")
.equals(dir_entry.get_path()) .equals(dir_entry.get_path())
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
api_path_data = row->get_column("data").get_value<std::string>(); api_path_data = row->get_column("data").get_value<std::string>();
} }
std::string api_parent{}; std::string api_parent{};
result = db::db_select{*db_, directory_table} result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(utils::path::get_parent_path(dir_entry.get_path())) .equals(utils::path::get_parent_path(dir_entry.get_path()))
@ -834,13 +836,13 @@ auto encrypt_provider::process_directory_entry(
.value_or(0U)), .value_or(0U)),
}, },
}; };
auto ins_res = db::db_insert{*db_, file_table} auto ins_res = utils::db::sqlite::db_insert{*db_, file_table}
.column_value("source_path", dir_entry.get_path()) .column_value("source_path", dir_entry.get_path())
.column_value("data", data.dump()) .column_value("data", data.dump())
.go(); .go();
// TODO handle error // TODO handle error
ins_res = db::db_insert{*db_, source_table} ins_res = utils::db::sqlite::db_insert{*db_, source_table}
.column_value("api_path", api_path) .column_value("api_path", api_path)
.column_value("source_path", dir_entry.get_path()) .column_value("source_path", dir_entry.get_path())
.go(); .go();
@ -865,12 +867,12 @@ auto encrypt_provider::read_file_bytes(const std::string &api_path,
static_cast<const char *>(__FUNCTION__), static_cast<const char *>(__FUNCTION__),
}; };
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (not(result.get_row(row) && row.has_value())) { if (not(result.get_row(row) && row.has_value())) {
return api_error::item_not_found; return api_error::item_not_found;
} }
@ -880,7 +882,7 @@ auto encrypt_provider::read_file_bytes(const std::string &api_path,
return api_error::item_not_found; return api_error::item_not_found;
} }
result = db::db_select{*db_, file_table} result = utils::db::sqlite::db_select{*db_, file_table}
.column("data") .column("data")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
@ -919,7 +921,7 @@ auto encrypt_provider::read_file_bytes(const std::string &api_path,
file_data["original_file_size"] = file_size; file_data["original_file_size"] = file_size;
file_data["iv_list"] = iv_list; file_data["iv_list"] = iv_list;
auto ins_res = db::db_insert{*db_, file_table} auto ins_res = utils::db::sqlite::db_insert{*db_, file_table}
.or_replace() .or_replace()
.column_value("source_path", source_path) .column_value("source_path", source_path)
.column_value("data", file_data.dump()) .column_value("data", file_data.dump())
@ -974,11 +976,11 @@ void encrypt_provider::remove_deleted_files() {
}; };
std::vector<removed_item> removed_list{}; std::vector<removed_item> removed_list{};
std::vector<db::db_select::row> row_list{}; std::vector<utils::db::sqlite::db_select::row> row_list{};
auto result = db::db_select{*db_, source_table}.go(); auto result = utils::db::sqlite::db_select{*db_, source_table}.go();
while (result.has_row()) { while (result.has_row()) {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
row_list.push_back(row.value()); row_list.push_back(row.value());
} }
@ -988,7 +990,7 @@ void encrypt_provider::remove_deleted_files() {
auto source_path = row.get_column("source_path").get_value<std::string>(); auto source_path = row.get_column("source_path").get_value<std::string>();
if (not utils::path::exists(source_path)) { if (not utils::path::exists(source_path)) {
auto api_path = row.get_column("api_path").get_value<std::string>(); auto api_path = row.get_column("api_path").get_value<std::string>();
result = db::db_select{*db_, file_table} result = utils::db::sqlite::db_select{*db_, file_table}
.column("source_path") .column("source_path")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
@ -1000,12 +1002,12 @@ void encrypt_provider::remove_deleted_files() {
for (auto &&item : removed_list) { for (auto &&item : removed_list) {
if (not item.directory) { if (not item.directory) {
auto del_res = db::db_delete{*db_, source_table} auto del_res = utils::db::sqlite::db_delete{*db_, source_table}
.where("api_path") .where("api_path")
.equals(item.api_path) .equals(item.api_path)
.go(); .go();
// TODO handle error // TODO handle error
del_res = db::db_delete{*db_, file_table} del_res = utils::db::sqlite::db_delete{*db_, file_table}
.where("source_path") .where("source_path")
.equals(item.source_path) .equals(item.source_path)
.go(); .go();
@ -1017,12 +1019,12 @@ void encrypt_provider::remove_deleted_files() {
for (auto &&item : removed_list) { for (auto &&item : removed_list) {
if (item.directory) { if (item.directory) {
auto del_res = db::db_delete{*db_, source_table} auto del_res = utils::db::sqlite::db_delete{*db_, source_table}
.where("api_path") .where("api_path")
.equals(item.api_path) .equals(item.api_path)
.go(); .go();
// TODO handle error // TODO handle error
del_res = db::db_delete{*db_, directory_table} del_res = utils::db::sqlite::db_delete{*db_, directory_table}
.where("source_path") .where("source_path")
.equals(item.source_path) .equals(item.source_path)
.go(); .go();
@ -1060,7 +1062,7 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
for (auto &&create : sql_create_tables) { for (auto &&create : sql_create_tables) {
std::string err; std::string err;
if (not db::execute_sql(*db_, create.second, err)) { if (not utils::db::sqlite::execute_sql(*db_, create.second, err)) {
utils::error::raise_error(function_name, "failed to create table|" + utils::error::raise_error(function_name, "failed to create table|" +
create.first + '|' + err); create.first + '|' + err);
db_.reset(); db_.reset();
@ -1068,21 +1070,21 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
} }
} }
db::set_journal_mode(*db_); utils::db::sqlite::set_journal_mode(*db_);
const auto cfg = config_.get_encrypt_config(); const auto cfg = config_.get_encrypt_config();
std::string source_path; std::string source_path;
auto result = db::db_select{*db_, source_table} auto result = utils::db::sqlite::db_select{*db_, source_table}
.column("source_path") .column("source_path")
.where("api_path") .where("api_path")
.equals("/") .equals("/")
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
source_path = row->get_column("source_path").get_value<std::string>(); source_path = row->get_column("source_path").get_value<std::string>();
} else { } else {
auto ins_res = db::db_insert{*db_, source_table} auto ins_res = utils::db::sqlite::db_insert{*db_, source_table}
.column_value("api_path", "/") .column_value("api_path", "/")
.column_value("source_path", cfg.path) .column_value("source_path", cfg.path)
.go(); .go();
@ -1090,13 +1092,13 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
source_path = cfg.path; source_path = cfg.path;
} }
result = db::db_select{*db_, directory_table} result = utils::db::sqlite::db_select{*db_, directory_table}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
.go(); .go();
if (not result.has_row()) { if (not result.has_row()) {
auto ins_res = db::db_insert{*db_, directory_table} auto ins_res = utils::db::sqlite::db_insert{*db_, directory_table}
.column_value("source_path", source_path) .column_value("source_path", source_path)
.column_value("api_path", "/") .column_value("api_path", "/")
.go(); .go();

View File

@ -22,10 +22,10 @@
#include "providers/meta_db.hpp" #include "providers/meta_db.hpp"
#include "app_config.hpp" #include "app_config.hpp"
#include "database/db_common.hpp" #include "utils/db/sqlite/db_common.hpp"
#include "database/db_delete.hpp" #include "utils/db/sqlite/db_delete.hpp"
#include "database/db_insert.hpp" #include "utils/db/sqlite/db_insert.hpp"
#include "database/db_select.hpp" #include "utils/db/sqlite/db_select.hpp"
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "utils/path.hpp" #include "utils/path.hpp"
#include "utils/string.hpp" #include "utils/string.hpp"
@ -60,28 +60,28 @@ meta_db::meta_db(const app_config &cfg) {
"source_path TEXT" "source_path TEXT"
");"; ");";
std::string err; std::string err;
if (not db::execute_sql(*db_, create, err)) { if (not utils::db::sqlite::execute_sql(*db_, create, err)) {
utils::error::raise_error(function_name, utils::error::raise_error(function_name,
"failed to create db|" + db_path + '|' + err); "failed to create db|" + db_path + '|' + err);
db_.reset(); db_.reset();
return; return;
} }
db::set_journal_mode(*db_); utils::db::sqlite::set_journal_mode(*db_);
} }
meta_db::~meta_db() { db_.reset(); } meta_db::~meta_db() { db_.reset(); }
auto meta_db::get_api_path(const std::string &source_path, auto meta_db::get_api_path(const std::string &source_path,
std::string &api_path) -> api_error { std::string &api_path) -> api_error {
auto result = db::db_select{*db_, table_name} auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("api_path") .column("api_path")
.where("source_path") .where("source_path")
.equals(source_path) .equals(source_path)
.limit(1) .limit(1)
.go(); .go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
api_path = row->get_column("api_path").get_value<std::string>(); api_path = row->get_column("api_path").get_value<std::string>();
return api_error::success; return api_error::success;
@ -93,9 +93,10 @@ auto meta_db::get_api_path(const std::string &source_path,
auto meta_db::get_api_path_list() -> std::vector<std::string> { auto meta_db::get_api_path_list() -> std::vector<std::string> {
std::vector<std::string> ret{}; std::vector<std::string> ret{};
auto result = db::db_select{*db_, table_name}.column("api_path").go(); auto result =
utils::db::sqlite::db_select{*db_, table_name}.column("api_path").go();
while (result.has_row()) { while (result.has_row()) {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
ret.push_back(row->get_column("api_path").get_value<std::string>()); ret.push_back(row->get_column("api_path").get_value<std::string>());
} }
@ -110,7 +111,7 @@ auto meta_db::get_item_meta(const std::string &api_path,
static_cast<const char *>(__FUNCTION__), static_cast<const char *>(__FUNCTION__),
}; };
auto result = db::db_select{*db_, table_name} auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("*") .column("*")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
@ -121,7 +122,7 @@ auto meta_db::get_item_meta(const std::string &api_path,
} }
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
meta = json::parse(row->get_column("data").get_value<std::string>()) meta = json::parse(row->get_column("data").get_value<std::string>())
.get<api_meta_map>(); .get<api_meta_map>();
@ -150,7 +151,7 @@ auto meta_db::get_item_meta(const std::string &api_path, const std::string &key,
static_cast<const char *>(__FUNCTION__), static_cast<const char *>(__FUNCTION__),
}; };
auto result = db::db_select{*db_, table_name} auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("*") .column("*")
.where("api_path") .where("api_path")
.equals(api_path) .equals(api_path)
@ -161,7 +162,7 @@ auto meta_db::get_item_meta(const std::string &api_path, const std::string &key,
} }
try { try {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
value = value =
key == META_SOURCE key == META_SOURCE
@ -195,13 +196,13 @@ auto meta_db::get_pinned_files() const -> std::vector<std::string> {
std::vector<std::string> ret{}; std::vector<std::string> ret{};
try { try {
auto result = db::db_select{*db_, table_name} auto result = utils::db::sqlite::db_select{*db_, table_name}
.column("api_path") .column("api_path")
.where("pinned") .where("pinned")
.equals(1) .equals(1)
.go(); .go();
while (result.has_row()) { while (result.has_row()) {
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
ret.emplace_back(row->get_column("api_path").get_value<std::string>()); ret.emplace_back(row->get_column("api_path").get_value<std::string>());
} }
@ -221,10 +222,11 @@ auto meta_db::get_total_item_count() const -> std::uint64_t {
std::uint64_t ret{}; std::uint64_t ret{};
try { try {
auto result = auto result = utils::db::sqlite::db_select{*db_, table_name}
db::db_select{*db_, table_name}.count("api_path", "count").go(); .count("api_path", "count")
.go();
std::optional<db::db_select::row> row; std::optional<utils::db::sqlite::db_select::row> row;
if (result.get_row(row) && row.has_value()) { if (result.get_row(row) && row.has_value()) {
ret = static_cast<std::uint64_t>( ret = static_cast<std::uint64_t>(
row->get_column("count").get_value<std::int64_t>()); row->get_column("count").get_value<std::int64_t>());
@ -242,8 +244,10 @@ void meta_db::remove_api_path(const std::string &api_path) {
static_cast<const char *>(__FUNCTION__), static_cast<const char *>(__FUNCTION__),
}; };
auto result = auto result = utils::db::sqlite::db_delete{*db_, table_name}
db::db_delete{*db_, table_name}.where("api_path").equals(api_path).go(); .where("api_path")
.equals(api_path)
.go();
if (not result.ok()) { if (not result.ok()) {
utils::error::raise_api_path_error( utils::error::raise_api_path_error(
function_name, api_path, result.get_error(), "failed to remove meta"); function_name, api_path, result.get_error(), "failed to remove meta");
@ -307,7 +311,7 @@ auto meta_db::update_item_meta(const std::string &api_path,
meta.erase(META_PINNED); meta.erase(META_PINNED);
meta.erase(META_SOURCE); meta.erase(META_SOURCE);
auto result = db::db_insert{*db_, table_name} auto result = utils::db::sqlite::db_insert{*db_, table_name}
.or_replace() .or_replace()
.column_value("api_path", api_path) .column_value("api_path", api_path)
.column_value("data", nlohmann::json(meta).dump()) .column_value("data", nlohmann::json(meta).dump())

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_ACTIONS_HPP_ #ifndef REPERTORY_INCLUDE_CLI_ACTIONS_HPP_
#define INCLUDE_CLI_ACTIONS_HPP_ #define REPERTORY_INCLUDE_CLI_ACTIONS_HPP_
#include "cli/check_version.hpp" #include "cli/check_version.hpp"
#include "cli/display_config.hpp" #include "cli/display_config.hpp"
@ -90,4 +90,4 @@ perform_action(const utils::cli::option &opt, std::vector<const char *> args,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_ACTIONS_HPP_ #endif // REPERTORY_INCLUDE_CLI_ACTIONS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_CHECK_VERSION_HPP_ #ifndef REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_
#define INCLUDE_CLI_CHECK_VERSION_HPP_ #define REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "types/repertory.hpp" #include "types/repertory.hpp"
@ -70,4 +70,4 @@ check_version(std::vector<const char *> /* args */,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_CHECK_VERSION_HPP_ #endif // REPERTORY_INCLUDE_CLI_CHECK_VERSION_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_DISPLAY_CONFIG_HPP_ #ifndef REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_
#define INCLUDE_CLI_DISPLAY_CONFIG_HPP_ #define REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -57,4 +57,4 @@ namespace repertory::cli::actions {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_DISPLAY_CONFIG_HPP_ #endif // REPERTORY_INCLUDE_CLI_DISPLAY_CONFIG_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_DRIVE_INFORMATION_HPP_ #ifndef REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_
#define INCLUDE_CLI_DRIVE_INFORMATION_HPP_ #define REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -57,4 +57,4 @@ drive_information(std::vector<const char *> /* args */,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_DRIVE_INFORMATION_HPP_ #endif // REPERTORY_INCLUDE_CLI_DRIVE_INFORMATION_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_GET_HPP_ #ifndef REPERTORY_INCLUDE_CLI_GET_HPP_
#define INCLUDE_CLI_GET_HPP_ #define REPERTORY_INCLUDE_CLI_GET_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -65,4 +65,4 @@ namespace repertory::cli::actions {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_GET_HPP_ #endif // REPERTORY_INCLUDE_CLI_GET_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_ #ifndef REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_
#define INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_ #define REPERTORY_INCLUDE_CLI_GET_DIRECTORY_ITEMS_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "rpc/client/client.hpp" #include "rpc/client/client.hpp"
@ -54,4 +54,4 @@ namespace repertory::cli::actions {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_GETDIRECTORYITEMS_HPP_ #endif // REPERTORY_INCLUDE_CLI_GETDIRECTORYITEMS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_GET_PINNED_FILES_HPP_ #ifndef REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_
#define INCLUDE_CLI_GET_PINNED_FILES_HPP_ #define REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "rpc/client/client.hpp" #include "rpc/client/client.hpp"
@ -52,4 +52,4 @@ namespace repertory::cli::actions {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_GET_PINNED_FILES_HPP_ #endif // REPERTORY_INCLUDE_CLI_GET_PINNED_FILES_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_VERSION_HPP_ #ifndef REPERTORY_INCLUDE_CLI_VERSION_HPP_
#define INCLUDE_CLI_VERSION_HPP_ #define REPERTORY_INCLUDE_CLI_VERSION_HPP_
#include "version.hpp" #include "version.hpp"
@ -32,4 +32,4 @@ template <typename drive> inline void version(std::vector<const char *> args) {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_VERSION_HPP_ #endif // REPERTORY_INCLUDE_CLI_VERSION_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_HELP_HPP_ #ifndef REPERTORY_INCLUDE_CLI_HELP_HPP_
#define INCLUDE_CLI_HELP_HPP_ #define REPERTORY_INCLUDE_CLI_HELP_HPP_
namespace repertory::cli::actions { namespace repertory::cli::actions {
template <typename drive> inline void help(std::vector<const char *> args) { template <typename drive> inline void help(std::vector<const char *> args) {
@ -88,4 +88,4 @@ template <typename drive> inline void help(std::vector<const char *> args) {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_HELP_HPP_ #endif // REPERTORY_INCLUDE_CLI_HELP_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_MOUNT_HPP_ #ifndef REPERTORY_INCLUDE_CLI_MOUNT_HPP_
#define INCLUDE_CLI_MOUNT_HPP_ #define REPERTORY_INCLUDE_CLI_MOUNT_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -176,4 +176,4 @@ mount(std::vector<const char *> args, std::string data_directory,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_MOUNT_HPP_ #endif // REPERTORY_INCLUDE_CLI_MOUNT_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_OPEN_FILES_HPP_ #ifndef REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_
#define INCLUDE_CLI_OPEN_FILES_HPP_ #define REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -30,11 +30,12 @@
#include "utils/cli_utils.hpp" #include "utils/cli_utils.hpp"
namespace repertory::cli::actions { namespace repertory::cli::actions {
[[nodiscard]] inline auto [[nodiscard]] inline auto open_files(std::vector<const char *> /* args */,
open_files(std::vector<const char *> /* args */, const std::string &data_directory,
const std::string &data_directory, const provider_type &prov, const provider_type &prov,
const std::string &unique_id, std::string user, std::string password) const std::string &unique_id,
-> exit_code { std::string user,
std::string password) -> exit_code {
auto ret = exit_code::success; auto ret = exit_code::success;
lock_data lock(prov, unique_id); lock_data lock(prov, unique_id);
const auto res = lock.grab_lock(1U); const auto res = lock.grab_lock(1U);
@ -56,4 +57,4 @@ open_files(std::vector<const char *> /* args */,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_OPEN_FILES_HPP_ #endif // REPERTORY_INCLUDE_CLI_OPEN_FILES_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_PIN_FILE_HPP_ #ifndef REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_
#define INCLUDE_CLI_PIN_FILE_HPP_ #define REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "rpc/client/client.hpp" #include "rpc/client/client.hpp"
@ -54,4 +54,4 @@ pin_file(std::vector<const char *> args, const std::string &data_directory,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_PIN_FILE_HPP_ #endif // REPERTORY_INCLUDE_CLI_PIN_FILE_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_PINNED_STATUS_HPP_ #ifndef REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_
#define INCLUDE_CLI_PINNED_STATUS_HPP_ #define REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "rpc/client/client.hpp" #include "rpc/client/client.hpp"
@ -54,4 +54,4 @@ pinned_status(std::vector<const char *> args, const std::string &data_directory,
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_PINNED_STATUS_HPP_ #endif // REPERTORY_INCLUDE_CLI_PINNED_STATUS_HPP_

View File

@ -19,8 +19,8 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#ifndef INCLUDE_CLI_SET_HPP_ #ifndef REPERTORY_INCLUDE_CLI_SET_HPP_
#define INCLUDE_CLI_SET_HPP_ #define REPERTORY_INCLUDE_CLI_SET_HPP_
#include "app_config.hpp" #include "app_config.hpp"
#include "platform/platform.hpp" #include "platform/platform.hpp"
@ -77,4 +77,4 @@ namespace repertory::cli::actions {
} }
} // namespace repertory::cli::actions } // namespace repertory::cli::actions
#endif // INCLUDE_CLI_SET_HPP_ #endif // REPERTORY_INCLUDE_CLI_SET_HPP_

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