refactor event system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
@ -25,7 +25,7 @@
|
|||||||
#include "app_config.hpp"
|
#include "app_config.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"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/curl_error.hpp"
|
#include "events/types/curl_error.hpp"
|
||||||
#include "utils/encryption.hpp"
|
#include "utils/encryption.hpp"
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (curl_code != CURLE_OK) {
|
if (curl_code != CURLE_OK) {
|
||||||
event_system2::instance().raise<curl_error>(curl_code, function_name,
|
event_system::instance().raise<curl_error>(curl_code, function_name,
|
||||||
url);
|
url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
#define REPERTORY_INCLUDE_DRIVES_FUSE_FUSE_BASE_HPP_
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#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"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "drives/fuse/fuse_base.hpp"
|
#include "drives/fuse/fuse_base.hpp"
|
||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class app_config;
|
class app_config;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
#include "drives/remote/remote_open_file_table.hpp"
|
#include "drives/remote/remote_open_file_table.hpp"
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -58,7 +58,7 @@ public:
|
|||||||
drive_(drv),
|
drive_(drv),
|
||||||
mount_location_(std::move(mount_location)),
|
mount_location_(std::move(mount_location)),
|
||||||
client_pool_(config.get_remote_mount().client_pool_size) {
|
client_pool_(config.get_remote_mount().client_pool_size) {
|
||||||
event_system2::instance().raise<service_start_begin>("remote_server_base");
|
event_system::instance().raise<service_start_begin>("remote_server_base");
|
||||||
handler_lookup_.insert(
|
handler_lookup_.insert(
|
||||||
{"::winfsp_can_delete",
|
{"::winfsp_can_delete",
|
||||||
[this](std::uint32_t, const std::string &, std::uint64_t,
|
[this](std::uint32_t, const std::string &, std::uint64_t,
|
||||||
@ -1375,14 +1375,14 @@ public:
|
|||||||
method, request, response,
|
method, request, response,
|
||||||
message_complete);
|
message_complete);
|
||||||
});
|
});
|
||||||
event_system2::instance().raise<service_start_end>("remote_server_base");
|
event_system::instance().raise<service_start_end>("remote_server_base");
|
||||||
}
|
}
|
||||||
|
|
||||||
~remote_server_base() override {
|
~remote_server_base() override {
|
||||||
event_system2::instance().raise<service_stop_begin>("remote_server_base");
|
event_system::instance().raise<service_stop_begin>("remote_server_base");
|
||||||
client_pool_.shutdown();
|
client_pool_.shutdown();
|
||||||
packet_server_.reset();
|
packet_server_.reset();
|
||||||
event_system2::instance().raise<service_stop_end>("remote_server_base");
|
event_system::instance().raise<service_stop_end>("remote_server_base");
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class app_config;
|
class app_config;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "drives/eviction.hpp"
|
#include "drives/eviction.hpp"
|
||||||
#include "drives/winfsp/i_winfsp_drive.hpp"
|
#include "drives/winfsp/i_winfsp_drive.hpp"
|
||||||
#include "drives/winfsp/remotewinfsp/remote_server.hpp"
|
#include "drives/winfsp/remotewinfsp/remote_server.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "file_manager/file_manager.hpp"
|
#include "file_manager/file_manager.hpp"
|
||||||
#include "rpc/server/full_server.hpp"
|
#include "rpc/server/full_server.hpp"
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_CONSOLE_CONSUMER_HPP_
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
#ifndef REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
#define REPERTORY_INCLUDE_EVENTS_CONSUMERS_LOGGING_CONSUMER_HPP_
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
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 REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM2_HPP_
|
#ifndef REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||||
#define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM2_HPP_
|
#define REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
class i_event;
|
class i_event;
|
||||||
|
|
||||||
class event_system2 final {
|
class event_system final {
|
||||||
private:
|
private:
|
||||||
static constexpr const std::uint8_t max_queue_retry{
|
static constexpr const std::uint8_t max_queue_retry{
|
||||||
30U,
|
30U,
|
||||||
@ -40,31 +40,31 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
event_system2(const event_system2 &) = delete;
|
event_system(const event_system &) = delete;
|
||||||
event_system2(event_system2 &&) = delete;
|
event_system(event_system &&) = delete;
|
||||||
auto operator=(const event_system2 &) -> event_system2 & = delete;
|
auto operator=(const event_system &) -> event_system & = delete;
|
||||||
auto operator=(event_system2 &&) -> event_system2 & = delete;
|
auto operator=(event_system &&) -> event_system & = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
event_system2() = default;
|
event_system() = default;
|
||||||
|
|
||||||
~event_system2() { stop(); }
|
~event_system() { stop(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class event_consumer final {
|
class event_consumer final {
|
||||||
public:
|
public:
|
||||||
explicit event_consumer(std::function<void(const i_event &)> callback)
|
explicit event_consumer(std::function<void(const i_event &)> callback)
|
||||||
: callback_(std::move(callback)) {
|
: callback_(std::move(callback)) {
|
||||||
event_system2::instance().attach(this);
|
event_system::instance().attach(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
event_consumer(std::string_view event_name,
|
event_consumer(std::string_view event_name,
|
||||||
std::function<void(const i_event &)> callback)
|
std::function<void(const i_event &)> callback)
|
||||||
: callback_(std::move(callback)) {
|
: callback_(std::move(callback)) {
|
||||||
event_system2::instance().attach(event_name, this);
|
event_system::instance().attach(event_name, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
~event_consumer() { event_system2::instance().release(this); }
|
~event_consumer() { event_system::instance().release(this); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
event_consumer(const event_consumer &) = delete;
|
event_consumer(const event_consumer &) = delete;
|
||||||
@ -80,10 +80,10 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static event_system2 instance_;
|
static event_system instance_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static auto instance() -> event_system2 &;
|
[[nodiscard]] static auto instance() -> event_system &;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, std::deque<event_consumer *>>
|
std::unordered_map<std::string, std::deque<event_consumer *>>
|
||||||
@ -119,7 +119,7 @@ public:
|
|||||||
void stop();
|
void stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
using event_consumer = event_system2::event_consumer;
|
using event_consumer = event_system::event_consumer;
|
||||||
|
|
||||||
#define E_CONSUMER2() \
|
#define E_CONSUMER2() \
|
||||||
private: \
|
private: \
|
||||||
@ -142,4 +142,4 @@ private: \
|
|||||||
[this](const i_event &evt) { callback(evt); }))
|
[this](const i_event &evt) { callback(evt); }))
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM2_HPP_
|
#endif // REPERTORY_INCLUDE_EVENTS_EVENT_SYSTEM_HPP_
|
@ -23,7 +23,7 @@
|
|||||||
#define REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
#define REPERTORY_INCLUDE_FILE_MANAGER_FILE_MANAGER_HPP_
|
||||||
|
|
||||||
#include "db/i_file_mgr_db.hpp"
|
#include "db/i_file_mgr_db.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/file_upload_completed.hpp"
|
#include "events/types/file_upload_completed.hpp"
|
||||||
#include "file_manager/i_file_manager.hpp"
|
#include "file_manager/i_file_manager.hpp"
|
||||||
#include "file_manager/i_open_file.hpp"
|
#include "file_manager/i_open_file.hpp"
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/event_level_changed.hpp"
|
#include "events/types/event_level_changed.hpp"
|
||||||
#include "file_manager/cache_size_mgr.hpp"
|
#include "file_manager/cache_size_mgr.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
@ -1149,7 +1149,7 @@ void app_config::set_event_level(const event_level &value) {
|
|||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
if (set_value(event_level_, value)) {
|
if (set_value(event_level_, value)) {
|
||||||
event_system2::instance().raise<event_level_changed>(function_name, value);
|
event_system::instance().raise<event_level_changed>(function_name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "comm/packet/client_pool.hpp"
|
#include "comm/packet/client_pool.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -46,7 +46,7 @@ void client_pool::pool::execute(
|
|||||||
client_pool::pool::pool(std::uint8_t pool_size) {
|
client_pool::pool::pool(std::uint8_t pool_size) {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_begin>("client_pool");
|
event_system::instance().raise<service_start_begin>("client_pool");
|
||||||
|
|
||||||
for (std::uint8_t i = 0U; i < pool_size; i++) {
|
for (std::uint8_t i = 0U; i < pool_size; i++) {
|
||||||
pool_queues_.emplace_back(std::make_unique<work_queue>());
|
pool_queues_.emplace_back(std::make_unique<work_queue>());
|
||||||
@ -109,7 +109,7 @@ client_pool::pool::pool(std::uint8_t pool_size) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_end>("client_pool");
|
event_system::instance().raise<service_start_end>("client_pool");
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_pool::pool::shutdown() {
|
void client_pool::pool::shutdown() {
|
||||||
@ -155,7 +155,7 @@ void client_pool::shutdown() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_begin>("client_pool");
|
event_system::instance().raise<service_stop_begin>("client_pool");
|
||||||
unique_mutex_lock pool_lock(pool_mutex_);
|
unique_mutex_lock pool_lock(pool_mutex_);
|
||||||
if (not shutdown_) {
|
if (not shutdown_) {
|
||||||
shutdown_ = true;
|
shutdown_ = true;
|
||||||
@ -165,6 +165,6 @@ void client_pool::shutdown() {
|
|||||||
pool_lookup_.clear();
|
pool_lookup_.clear();
|
||||||
}
|
}
|
||||||
pool_lock.unlock();
|
pool_lock.unlock();
|
||||||
event_system2::instance().raise<service_stop_end>("client_pool");
|
event_system::instance().raise<service_stop_end>("client_pool");
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "comm/packet/packet_client.hpp"
|
#include "comm/packet/packet_client.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/collection.hpp"
|
#include "utils/collection.hpp"
|
||||||
@ -183,7 +183,7 @@ auto packet_client::send(std::string_view method, packet &request,
|
|||||||
|
|
||||||
timeout request_timeout(
|
timeout request_timeout(
|
||||||
[method, current_client]() {
|
[method, current_client]() {
|
||||||
event_system2::instance().raise<packet_client_timeout>(
|
event_system::instance().raise<packet_client_timeout>(
|
||||||
"request", std::string{method});
|
"request", std::string{method});
|
||||||
packet_client::close(*current_client);
|
packet_client::close(*current_client);
|
||||||
},
|
},
|
||||||
@ -205,7 +205,7 @@ auto packet_client::send(std::string_view method, packet &request,
|
|||||||
|
|
||||||
timeout response_timeout(
|
timeout response_timeout(
|
||||||
[method, current_client]() {
|
[method, current_client]() {
|
||||||
event_system2::instance().raise<packet_client_timeout>(
|
event_system::instance().raise<packet_client_timeout>(
|
||||||
"response", std::string{method});
|
"response", std::string{method});
|
||||||
packet_client::close(*current_client);
|
packet_client::close(*current_client);
|
||||||
},
|
},
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "comm/packet/packet_server.hpp"
|
#include "comm/packet/packet_server.hpp"
|
||||||
|
|
||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -40,13 +40,13 @@ packet_server::packet_server(std::uint16_t port, std::string token,
|
|||||||
: encryption_token_(std::move(token)),
|
: encryption_token_(std::move(token)),
|
||||||
closed_(std::move(closed)),
|
closed_(std::move(closed)),
|
||||||
message_handler_(std::move(message_handler)) {
|
message_handler_(std::move(message_handler)) {
|
||||||
event_system2::instance().raise<service_start_begin>("packet_server");
|
event_system::instance().raise<service_start_begin>("packet_server");
|
||||||
initialize(port, pool_size);
|
initialize(port, pool_size);
|
||||||
event_system2::instance().raise<service_start_end>("packet_server");
|
event_system::instance().raise<service_start_end>("packet_server");
|
||||||
}
|
}
|
||||||
|
|
||||||
packet_server::~packet_server() {
|
packet_server::~packet_server() {
|
||||||
event_system2::instance().raise<service_stop_begin>("packet_server");
|
event_system::instance().raise<service_stop_begin>("packet_server");
|
||||||
std::thread([this]() {
|
std::thread([this]() {
|
||||||
for (std::size_t i = 0U; i < service_threads_.size(); i++) {
|
for (std::size_t i = 0U; i < service_threads_.size(); i++) {
|
||||||
io_context_.stop();
|
io_context_.stop();
|
||||||
@ -55,7 +55,7 @@ packet_server::~packet_server() {
|
|||||||
|
|
||||||
server_thread_->join();
|
server_thread_->join();
|
||||||
server_thread_.reset();
|
server_thread_.reset();
|
||||||
event_system2::instance().raise<service_stop_end>("packet_server");
|
event_system::instance().raise<service_stop_end>("packet_server");
|
||||||
}
|
}
|
||||||
|
|
||||||
void packet_server::add_client(connection &conn, const std::string &client_id) {
|
void packet_server::add_client(connection &conn, const std::string &client_id) {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "drives/fuse/fuse_base.hpp"
|
#include "drives/fuse/fuse_base.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/unmount_requested.hpp"
|
#include "events/types/unmount_requested.hpp"
|
||||||
#include "events/types/unmount_result.hpp"
|
#include "events/types/unmount_result.hpp"
|
||||||
#include "initialize.hpp"
|
#include "initialize.hpp"
|
||||||
@ -372,13 +372,13 @@ auto fuse_base::init_impl(struct fuse_conn_info *conn) -> void * {
|
|||||||
if (not utils::file::change_to_process_directory()) {
|
if (not utils::file::change_to_process_directory()) {
|
||||||
utils::error::raise_error(function_name,
|
utils::error::raise_error(function_name,
|
||||||
"failed to change to process directory");
|
"failed to change to process directory");
|
||||||
event_system2::instance().raise<unmount_requested>();
|
event_system::instance().raise<unmount_requested>();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not console_enabled_ && not repertory::project_initialize()) {
|
if (not console_enabled_ && not repertory::project_initialize()) {
|
||||||
utils::error::raise_error(function_name, "failed to initialize repertory");
|
utils::error::raise_error(function_name, "failed to initialize repertory");
|
||||||
event_system2::instance().raise<unmount_requested>();
|
event_system::instance().raise<unmount_requested>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
@ -601,7 +601,7 @@ auto fuse_base::listxattr_(const char *path, char *buffer, size_t size) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) {
|
void fuse_base::notify_fuse_args_parsed(const std::vector<std::string> &args) {
|
||||||
event_system2::instance().raise<fuse_args_parsed>(std::accumulate(
|
event_system::instance().raise<fuse_args_parsed>(std::accumulate(
|
||||||
args.begin(), args.end(), std::string(),
|
args.begin(), args.end(), std::string(),
|
||||||
[](auto &&command_line, auto &&arg) -> auto {
|
[](auto &&command_line, auto &&arg) -> auto {
|
||||||
command_line += (command_line.empty() ? arg : (" " + std::string(arg)));
|
command_line += (command_line.empty() ? arg : (" " + std::string(arg)));
|
||||||
@ -700,7 +700,7 @@ void fuse_base::raise_fuse_event(std::string_view function_name,
|
|||||||
if (((config_.get_event_level() >= fuse_event::level) && (ret != 0)) ||
|
if (((config_.get_event_level() >= fuse_event::level) && (ret != 0)) ||
|
||||||
(config_.get_event_level() >= event_level::trace)) {
|
(config_.get_event_level() >= event_level::trace)) {
|
||||||
std::string func{function_name};
|
std::string func{function_name};
|
||||||
event_system2::instance().raise<fuse_event>(
|
event_system::instance().raise<fuse_event>(
|
||||||
utils::string::right_trim(func, '_'), std::string{api_path}, ret);
|
utils::string::right_trim(func, '_'), std::string{api_path}, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -753,7 +753,7 @@ void fuse_base::shutdown() {
|
|||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
auto res = unmount(get_mount_location());
|
auto res = unmount(get_mount_location());
|
||||||
event_system2::instance().raise<unmount_result>(function_name,
|
event_system::instance().raise<unmount_result>(function_name,
|
||||||
get_mount_location(), res);
|
get_mount_location(), res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "drives/fuse/remotefuse/remote_server.hpp"
|
#include "drives/fuse/remotefuse/remote_server.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/consumers/logging_consumer.hpp"
|
#include "events/consumers/logging_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/drive_mount_result.hpp"
|
#include "events/types/drive_mount_result.hpp"
|
||||||
#include "events/types/drive_mounted.hpp"
|
#include "events/types/drive_mounted.hpp"
|
||||||
#include "events/types/drive_unmount_pending.hpp"
|
#include "events/types/drive_unmount_pending.hpp"
|
||||||
@ -293,7 +293,7 @@ void fuse_drive::stop_all() {
|
|||||||
void fuse_drive::destroy_impl(void *ptr) {
|
void fuse_drive::destroy_impl(void *ptr) {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_unmount_pending>(function_name,
|
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
|
|
||||||
stop_all();
|
stop_all();
|
||||||
@ -302,7 +302,7 @@ void fuse_drive::destroy_impl(void *ptr) {
|
|||||||
|
|
||||||
fuse_base::destroy_impl(ptr);
|
fuse_base::destroy_impl(ptr);
|
||||||
|
|
||||||
event_system2::instance().raise<drive_unmounted>(function_name,
|
event_system::instance().raise<drive_unmounted>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
|
|||||||
|
|
||||||
logging_consumer_ = std::make_unique<logging_consumer>(
|
logging_consumer_ = std::make_unique<logging_consumer>(
|
||||||
config_.get_event_level(), config_.get_log_directory());
|
config_.get_event_level(), config_.get_log_directory());
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
was_mounted_ = true;
|
was_mounted_ = true;
|
||||||
|
|
||||||
fm_ = std::make_unique<file_manager>(config_, provider_);
|
fm_ = std::make_unique<file_manager>(config_, provider_);
|
||||||
@ -616,7 +616,7 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
|
|||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<drive_mounted>(function_name,
|
event_system::instance().raise<drive_mounted>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::raise_error(function_name, e, "exception during fuse init");
|
utils::error::raise_error(function_name, e, "exception during fuse init");
|
||||||
@ -665,9 +665,9 @@ auto fuse_drive::mkdir_impl(std::string api_path, mode_t mode) -> api_error {
|
|||||||
|
|
||||||
void fuse_drive::notify_fuse_main_exit(int &ret) {
|
void fuse_drive::notify_fuse_main_exit(int &ret) {
|
||||||
if (was_mounted_) {
|
if (was_mounted_) {
|
||||||
event_system2::instance().raise<drive_mount_result>(
|
event_system::instance().raise<drive_mount_result>(
|
||||||
function_name, get_mount_location(), std::to_string(ret));
|
function_name, get_mount_location(), std::to_string(ret));
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
logging_consumer_.reset();
|
logging_consumer_.reset();
|
||||||
console_consumer_.reset();
|
console_consumer_.reset();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/consumers/logging_consumer.hpp"
|
#include "events/consumers/logging_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/drive_mount_result.hpp"
|
#include "events/types/drive_mount_result.hpp"
|
||||||
#include "events/types/drive_mounted.hpp"
|
#include "events/types/drive_mounted.hpp"
|
||||||
#include "events/types/drive_unmount_pending.hpp"
|
#include "events/types/drive_unmount_pending.hpp"
|
||||||
@ -93,7 +93,7 @@ auto remote_fuse_drive::create_impl(std::string api_path, mode_t mode,
|
|||||||
void remote_fuse_drive::destroy_impl(void *ptr) {
|
void remote_fuse_drive::destroy_impl(void *ptr) {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_unmount_pending>(function_name,
|
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
|
|
||||||
if (server_) {
|
if (server_) {
|
||||||
@ -115,7 +115,7 @@ void remote_fuse_drive::destroy_impl(void *ptr) {
|
|||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<drive_unmounted>(function_name,
|
event_system::instance().raise<drive_unmounted>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
|
|
||||||
fuse_base::destroy_impl(ptr);
|
fuse_base::destroy_impl(ptr);
|
||||||
@ -246,7 +246,7 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
|
|||||||
}
|
}
|
||||||
logging_consumer_ = std::make_shared<logging_consumer>(
|
logging_consumer_ = std::make_shared<logging_consumer>(
|
||||||
config_.get_event_level(), config_.get_log_directory());
|
config_.get_event_level(), config_.get_log_directory());
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
if (not lock_data_.set_mount_state(true, get_mount_location(), getpid())) {
|
if (not lock_data_.set_mount_state(true, get_mount_location(), getpid())) {
|
||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
@ -258,11 +258,11 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
|
|||||||
if (remote_instance_->fuse_init() != 0) {
|
if (remote_instance_->fuse_init() != 0) {
|
||||||
utils::error::raise_error(function_name,
|
utils::error::raise_error(function_name,
|
||||||
"failed to connect to remote server");
|
"failed to connect to remote server");
|
||||||
event_system2::instance().raise<unmount_requested>();
|
event_system::instance().raise<unmount_requested>();
|
||||||
} else {
|
} else {
|
||||||
server_ = std::make_shared<server>(config_);
|
server_ = std::make_shared<server>(config_);
|
||||||
server_->start();
|
server_->start();
|
||||||
event_system2::instance().raise<drive_mounted>(function_name,
|
event_system::instance().raise<drive_mounted>(function_name,
|
||||||
get_mount_location());
|
get_mount_location());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,9 +279,9 @@ void remote_fuse_drive::notify_fuse_main_exit(int &ret) {
|
|||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
if (was_mounted_) {
|
if (was_mounted_) {
|
||||||
event_system2::instance().raise<drive_mount_result>(
|
event_system::instance().raise<drive_mount_result>(
|
||||||
function_name, get_mount_location(), std::to_string(ret));
|
function_name, get_mount_location(), std::to_string(ret));
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
logging_consumer_.reset();
|
logging_consumer_.reset();
|
||||||
console_consumer_.reset();
|
console_consumer_.reset();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "comm/packet/packet.hpp"
|
#include "comm/packet/packet.hpp"
|
||||||
#include "drives/directory_iterator.hpp"
|
#include "drives/directory_iterator.hpp"
|
||||||
#include "drives/remote/remote_open_file_table.hpp"
|
#include "drives/remote/remote_open_file_table.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -43,7 +43,7 @@ namespace repertory::remote_fuse {
|
|||||||
(((config_.get_event_level() >= remote_fuse_server_event::level) && \
|
(((config_.get_event_level() >= remote_fuse_server_event::level) && \
|
||||||
((ret) < 0)) || \
|
((ret) < 0)) || \
|
||||||
(config_.get_event_level() >= event_level::trace))) \
|
(config_.get_event_level() >= event_level::trace))) \
|
||||||
event_system2::instance().raise<remote_fuse_server_event>(std::string{func}, \
|
event_system::instance().raise<remote_fuse_server_event>(std::string{func}, \
|
||||||
file, ret)
|
file, ret)
|
||||||
|
|
||||||
remote_server::remote_server(app_config &config, i_fuse_drive &drive,
|
remote_server::remote_server(app_config &config, i_fuse_drive &drive,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "drives/remote/remote_open_file_table.hpp"
|
#include "drives/remote/remote_open_file_table.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "utils/collection.hpp"
|
#include "utils/collection.hpp"
|
||||||
#include "utils/config.hpp"
|
#include "utils/config.hpp"
|
||||||
#include "utils/utils.hpp"
|
#include "utils/utils.hpp"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/drive_mounted.hpp"
|
#include "events/types/drive_mounted.hpp"
|
||||||
#include "events/types/drive_unmount_pending.hpp"
|
#include "events/types/drive_unmount_pending.hpp"
|
||||||
#include "events/types/drive_unmounted.hpp"
|
#include "events/types/drive_unmounted.hpp"
|
||||||
@ -37,7 +37,7 @@ namespace repertory::remote_winfsp {
|
|||||||
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \
|
(((config_.get_event_level() >= remote_winfsp_client_event::level) && \
|
||||||
((ret) != STATUS_SUCCESS)) || \
|
((ret) != STATUS_SUCCESS)) || \
|
||||||
(config_.get_event_level() >= event_level::trace))) \
|
(config_.get_event_level() >= event_level::trace))) \
|
||||||
event_system2::instance().raise<remote_winfsp_client_event>( \
|
event_system::instance().raise<remote_winfsp_client_event>( \
|
||||||
std::string{func}, file, ret)
|
std::string{func}, file, ret)
|
||||||
|
|
||||||
remote_client::remote_client(const app_config &config)
|
remote_client::remote_client(const app_config &config)
|
||||||
@ -350,7 +350,7 @@ auto remote_client::winfsp_mounted(const std::wstring &location)
|
|||||||
auto mount_location{
|
auto mount_location{
|
||||||
utils::string::to_utf8(location),
|
utils::string::to_utf8(location),
|
||||||
};
|
};
|
||||||
event_system2::instance().raise<drive_mounted>(function_name, mount_location);
|
event_system::instance().raise<drive_mounted>(function_name, mount_location);
|
||||||
|
|
||||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
||||||
return ret;
|
return ret;
|
||||||
@ -556,7 +556,7 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
|
|||||||
auto mount_location{
|
auto mount_location{
|
||||||
utils::string::to_utf8(location),
|
utils::string::to_utf8(location),
|
||||||
};
|
};
|
||||||
event_system2::instance().raise<drive_unmount_pending>(function_name,
|
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||||
mount_location);
|
mount_location);
|
||||||
packet request;
|
packet request;
|
||||||
request.encode(location);
|
request.encode(location);
|
||||||
@ -565,7 +565,7 @@ auto remote_client::winfsp_unmounted(const std::wstring &location)
|
|||||||
auto ret{
|
auto ret{
|
||||||
packet_client_.send(function_name, request, service_flags),
|
packet_client_.send(function_name, request, service_flags),
|
||||||
};
|
};
|
||||||
event_system2::instance().raise<drive_unmounted>(function_name,
|
event_system::instance().raise<drive_unmounted>(function_name,
|
||||||
mount_location);
|
mount_location);
|
||||||
|
|
||||||
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
RAISE_REMOTE_WINFSP_CLIENT_EVENT(function_name, mount_location, ret);
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
#include "drives/fuse/remotefuse/i_remote_instance.hpp"
|
||||||
#include "drives/remote/remote_open_file_table.hpp"
|
#include "drives/remote/remote_open_file_table.hpp"
|
||||||
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
#include "drives/winfsp/remotewinfsp/i_remote_instance.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "types/remote.hpp"
|
#include "types/remote.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
@ -48,7 +48,7 @@ namespace repertory::remote_winfsp {
|
|||||||
(((config_.get_event_level() >= remote_winfsp_server_event::level) && \
|
(((config_.get_event_level() >= remote_winfsp_server_event::level) && \
|
||||||
((ret) != STATUS_SUCCESS)) || \
|
((ret) != STATUS_SUCCESS)) || \
|
||||||
(config_.get_event_level() >= event_level::trace))) \
|
(config_.get_event_level() >= event_level::trace))) \
|
||||||
event_system2::instance().raise<remote_winfsp_server_event>( \
|
event_system::instance().raise<remote_winfsp_server_event>( \
|
||||||
std::string{func}, file, ret)
|
std::string{func}, file, ret)
|
||||||
|
|
||||||
auto remote_server::get_next_handle() -> std::uint64_t {
|
auto remote_server::get_next_handle() -> std::uint64_t {
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/consumers/logging_consumer.hpp"
|
#include "events/consumers/logging_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/drive_mount_failed.hpp"
|
#include "events/types/drive_mount_failed.hpp"
|
||||||
#include "events/types/drive_mount_result.hpp"
|
#include "events/types/drive_mount_result.hpp"
|
||||||
#include "events/types/unmount_requested.hpp"
|
#include "events/types/unmount_requested.hpp"
|
||||||
@ -77,7 +77,7 @@ auto remote_winfsp_drive::winfsp_service::OnStart(ULONG, PWSTR *) -> NTSTATUS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret != STATUS_SUCCESS) {
|
if (ret != STATUS_SUCCESS) {
|
||||||
event_system2::instance().raise<drive_mount_failed>(function_name,
|
event_system::instance().raise<drive_mount_failed>(function_name,
|
||||||
mount_location, ret);
|
mount_location, ret);
|
||||||
if (not lock_.set_mount_state(false, "", -1)) {
|
if (not lock_.set_mount_state(false, "", -1)) {
|
||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
@ -257,13 +257,13 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args)
|
|||||||
if (enable_console) {
|
if (enable_console) {
|
||||||
c = std::make_unique<console_consumer>(config_.get_event_level());
|
c = std::make_unique<console_consumer>(config_.get_event_level());
|
||||||
}
|
}
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
|
auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_mount_result>(function_name, "",
|
event_system::instance().raise<drive_mount_result>(function_name, "",
|
||||||
std::to_string(ret));
|
std::to_string(ret));
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
c.reset();
|
c.reset();
|
||||||
return static_cast<int>(ret);
|
return static_cast<int>(ret);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "drives/directory_iterator.hpp"
|
#include "drives/directory_iterator.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/consumers/logging_consumer.hpp"
|
#include "events/consumers/logging_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/drive_mount_failed.hpp"
|
#include "events/types/drive_mount_failed.hpp"
|
||||||
#include "events/types/drive_mount_result.hpp"
|
#include "events/types/drive_mount_result.hpp"
|
||||||
#include "events/types/drive_mounted.hpp"
|
#include "events/types/drive_mounted.hpp"
|
||||||
@ -54,7 +54,7 @@ namespace repertory {
|
|||||||
(((config_.get_event_level() >= winfsp_event::level) && \
|
(((config_.get_event_level() >= winfsp_event::level) && \
|
||||||
(ret != STATUS_SUCCESS)) || \
|
(ret != STATUS_SUCCESS)) || \
|
||||||
(config_.get_event_level() >= event_level::trace))) \
|
(config_.get_event_level() >= event_level::trace))) \
|
||||||
event_system2::instance().raise<winfsp_event>(std::string{func}, file, ret)
|
event_system::instance().raise<winfsp_event>(std::string{func}, file, ret)
|
||||||
|
|
||||||
winfsp_drive::winfsp_service::winfsp_service(
|
winfsp_drive::winfsp_service::winfsp_service(
|
||||||
lock_data &lock, winfsp_drive &drive, std::vector<std::string> drive_args,
|
lock_data &lock, winfsp_drive &drive, std::vector<std::string> drive_args,
|
||||||
@ -125,7 +125,7 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
|
|||||||
utils::error::raise_error(function_name, ret, "failed to set mount state");
|
utils::error::raise_error(function_name, ret, "failed to set mount state");
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<drive_mount_failed>(function_name,
|
event_system::instance().raise<drive_mount_failed>(function_name,
|
||||||
mount_location, ret);
|
mount_location, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -134,11 +134,11 @@ auto winfsp_drive::winfsp_service::OnStart(ULONG /*Argc*/,
|
|||||||
auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
|
auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
|
||||||
REPERTORY_USES_FUNCTION_NAME();
|
REPERTORY_USES_FUNCTION_NAME();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_stop_begin>();
|
event_system::instance().raise<drive_stop_begin>();
|
||||||
|
|
||||||
timeout stop_timeout(
|
timeout stop_timeout(
|
||||||
[]() {
|
[]() {
|
||||||
event_system2::instance().raise<drive_stop_timed_out>();
|
event_system::instance().raise<drive_stop_timed_out>();
|
||||||
app_config::set_stop_requested();
|
app_config::set_stop_requested();
|
||||||
},
|
},
|
||||||
30s);
|
30s);
|
||||||
@ -146,7 +146,7 @@ auto winfsp_drive::winfsp_service::OnStop() -> NTSTATUS {
|
|||||||
|
|
||||||
stop_timeout.disable();
|
stop_timeout.disable();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_stop_end>();
|
event_system::instance().raise<drive_stop_end>();
|
||||||
|
|
||||||
if (not lock_.set_mount_state(false, "", -1)) {
|
if (not lock_.set_mount_state(false, "", -1)) {
|
||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
@ -615,14 +615,14 @@ auto winfsp_drive::mount(const std::vector<std::string> &drive_args) -> int {
|
|||||||
cons = std::make_unique<console_consumer>(config_.get_event_level());
|
cons = std::make_unique<console_consumer>(config_.get_event_level());
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto svc = winfsp_service(lock_, *this, parsed_drive_args, config_);
|
auto svc = winfsp_service(lock_, *this, parsed_drive_args, config_);
|
||||||
auto ret = svc.Run();
|
auto ret = svc.Run();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_mount_result>(function_name, "",
|
event_system::instance().raise<drive_mount_result>(function_name, "",
|
||||||
std::to_string(ret));
|
std::to_string(ret));
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
cons.reset();
|
cons.reset();
|
||||||
|
|
||||||
return static_cast<int>(ret);
|
return static_cast<int>(ret);
|
||||||
@ -674,7 +674,7 @@ auto winfsp_drive::Mounted(PVOID host) -> NTSTATUS {
|
|||||||
utils::error::raise_error(function_name, "failed to set mount state");
|
utils::error::raise_error(function_name, "failed to set mount state");
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<drive_mounted>(function_name,
|
event_system::instance().raise<drive_mounted>(function_name,
|
||||||
mount_location);
|
mount_location);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
@ -1213,12 +1213,12 @@ VOID winfsp_drive::Unmounted(PVOID host) {
|
|||||||
|
|
||||||
auto *file_system_host = reinterpret_cast<FileSystemHost *>(host);
|
auto *file_system_host = reinterpret_cast<FileSystemHost *>(host);
|
||||||
auto mount_location = parse_mount_location(file_system_host->MountPoint());
|
auto mount_location = parse_mount_location(file_system_host->MountPoint());
|
||||||
event_system2::instance().raise<drive_unmount_pending>(function_name,
|
event_system::instance().raise<drive_unmount_pending>(function_name,
|
||||||
mount_location);
|
mount_location);
|
||||||
|
|
||||||
stop_all();
|
stop_all();
|
||||||
|
|
||||||
event_system2::instance().raise<drive_unmounted>(function_name,
|
event_system::instance().raise<drive_unmounted>(function_name,
|
||||||
mount_location);
|
mount_location);
|
||||||
config_.save();
|
config_.save();
|
||||||
}
|
}
|
||||||
|
@ -19,33 +19,33 @@
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/i_event.hpp"
|
#include "events/i_event.hpp"
|
||||||
#include "utils/collection.hpp"
|
#include "utils/collection.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
event_system2 event_system2::instance_{};
|
event_system event_system::instance_{};
|
||||||
|
|
||||||
auto event_system2::instance() -> event_system2 & { return instance_; }
|
auto event_system::instance() -> event_system & { return instance_; }
|
||||||
|
|
||||||
void event_system2::attach(event_consumer *consumer) {
|
void event_system::attach(event_consumer *consumer) {
|
||||||
recur_mutex_lock lock(consumer_mutex_);
|
recur_mutex_lock lock(consumer_mutex_);
|
||||||
event_consumers_[""].push_back(consumer);
|
event_consumers_[""].push_back(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::attach(std::string_view event_name,
|
void event_system::attach(std::string_view event_name,
|
||||||
event_consumer *consumer) {
|
event_consumer *consumer) {
|
||||||
recur_mutex_lock lock(consumer_mutex_);
|
recur_mutex_lock lock(consumer_mutex_);
|
||||||
event_consumers_[std::string{event_name}].push_back(consumer);
|
event_consumers_[std::string{event_name}].push_back(consumer);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto event_system2::get_stop_requested() const -> bool {
|
auto event_system::get_stop_requested() const -> bool {
|
||||||
return stop_requested_ || app_config::get_stop_requested();
|
return stop_requested_ || app_config::get_stop_requested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::process_events() {
|
void event_system::process_events() {
|
||||||
unique_mutex_lock lock(event_mutex_);
|
unique_mutex_lock lock(event_mutex_);
|
||||||
const auto lock_and_notify = [this, &lock]() {
|
const auto lock_and_notify = [this, &lock]() {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
@ -90,7 +90,7 @@ void event_system2::process_events() {
|
|||||||
lock_and_notify();
|
lock_and_notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::queue_event(std::shared_ptr<i_event> evt) {
|
void event_system::queue_event(std::shared_ptr<i_event> evt) {
|
||||||
unique_mutex_lock lock(event_mutex_);
|
unique_mutex_lock lock(event_mutex_);
|
||||||
event_list_.push_back(std::move(evt));
|
event_list_.push_back(std::move(evt));
|
||||||
auto size = event_list_.size();
|
auto size = event_list_.size();
|
||||||
@ -113,7 +113,7 @@ void event_system2::queue_event(std::shared_ptr<i_event> evt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::release(event_consumer *consumer) {
|
void event_system::release(event_consumer *consumer) {
|
||||||
recur_mutex_lock lock(consumer_mutex_);
|
recur_mutex_lock lock(consumer_mutex_);
|
||||||
auto iter =
|
auto iter =
|
||||||
std::ranges::find_if(event_consumers_, [&consumer](auto &&item) -> bool {
|
std::ranges::find_if(event_consumers_, [&consumer](auto &&item) -> bool {
|
||||||
@ -125,7 +125,7 @@ void event_system2::release(event_consumer *consumer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::start() {
|
void event_system::start() {
|
||||||
mutex_lock lock(run_mutex_);
|
mutex_lock lock(run_mutex_);
|
||||||
if (event_thread_) {
|
if (event_thread_) {
|
||||||
event_notify_.notify_all();
|
event_notify_.notify_all();
|
||||||
@ -142,7 +142,7 @@ void event_system2::start() {
|
|||||||
event_notify_.notify_all();
|
event_notify_.notify_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_system2::stop() {
|
void event_system::stop() {
|
||||||
unique_mutex_lock lock(run_mutex_);
|
unique_mutex_lock lock(run_mutex_);
|
||||||
if (not event_thread_) {
|
if (not event_thread_) {
|
||||||
event_notify_.notify_all();
|
event_notify_.notify_all();
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event.hpp"
|
#include "events/event.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "types/startup_exception.hpp"
|
#include "types/startup_exception.hpp"
|
||||||
#include "utils/file_utils.hpp"
|
#include "utils/file_utils.hpp"
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ auto cache_size_mgr::expand(std::uint64_t size) -> api_error {
|
|||||||
while (not get_stop_requested() && cache_size_ > max_cache_size &&
|
while (not get_stop_requested() && cache_size_ > max_cache_size &&
|
||||||
cache_dir.count() > 1U) {
|
cache_dir.count() > 1U) {
|
||||||
if (last_cache_size != cache_size_) {
|
if (last_cache_size != cache_size_) {
|
||||||
event_system2::instance().raise<max_cache_size_reached>(cache_size_,
|
event_system::instance().raise<max_cache_size_reached>(cache_size_,
|
||||||
max_cache_size);
|
max_cache_size);
|
||||||
last_cache_size = cache_size_;
|
last_cache_size = cache_size_;
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ auto cache_size_mgr::shrink(std::uint64_t size) -> api_error {
|
|||||||
if (cache_size_ >= size) {
|
if (cache_size_ >= size) {
|
||||||
cache_size_ -= size;
|
cache_size_ -= size;
|
||||||
} else {
|
} else {
|
||||||
event_system2::instance().raise<invalid_cache_size>(cache_size_, size);
|
event_system::instance().raise<invalid_cache_size>(cache_size_, size);
|
||||||
cache_size_ = 0U;
|
cache_size_ = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void file_manager::close_timed_out_files() {
|
|||||||
|
|
||||||
for (auto &closeable_file : closeable_list) {
|
for (auto &closeable_file : closeable_list) {
|
||||||
closeable_file->close();
|
closeable_file->close();
|
||||||
event_system2::instance().raise<item_timeout>(
|
event_system::instance().raise<item_timeout>(
|
||||||
closeable_file->get_api_path());
|
closeable_file->get_api_path());
|
||||||
}
|
}
|
||||||
closeable_list.clear();
|
closeable_list.clear();
|
||||||
@ -194,7 +194,7 @@ auto file_manager::evict_file(const std::string &api_path) -> bool {
|
|||||||
auto removed = remove_source_and_shrink_cache(api_path, fsi.source_path,
|
auto removed = remove_source_and_shrink_cache(api_path, fsi.source_path,
|
||||||
fsi.size, allocated);
|
fsi.size, allocated);
|
||||||
if (removed) {
|
if (removed) {
|
||||||
event_system2::instance().raise<filesystem_item_evicted>(
|
event_system::instance().raise<filesystem_item_evicted>(
|
||||||
api_path, function_name, fsi.source_path);
|
api_path, function_name, fsi.source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ auto file_manager::open(const std::string &api_path, bool directory,
|
|||||||
? download_type::ring_buffer
|
? download_type::ring_buffer
|
||||||
: preferred_type);
|
: preferred_type);
|
||||||
if (not directory) {
|
if (not directory) {
|
||||||
event_system2::instance().raise<download_type_selected>(
|
event_system::instance().raise<download_type_selected>(
|
||||||
fsi.api_path, fsi.source_path, type);
|
fsi.api_path, fsi.source_path, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -549,10 +549,10 @@ void file_manager::queue_upload(const std::string &api_path,
|
|||||||
source_path,
|
source_path,
|
||||||
})) {
|
})) {
|
||||||
remove_resume(api_path, source_path, true);
|
remove_resume(api_path, source_path, true);
|
||||||
event_system2::instance().raise<file_upload_queued>(api_path, function_name,
|
event_system::instance().raise<file_upload_queued>(api_path, function_name,
|
||||||
source_path);
|
source_path);
|
||||||
} else {
|
} else {
|
||||||
event_system2::instance().raise<file_upload_failed>(
|
event_system::instance().raise<file_upload_failed>(
|
||||||
api_path, "failed to queue upload", function_name, source_path);
|
api_path, "failed to queue upload", function_name, source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ void file_manager::remove_resume(const std::string &api_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mgr_db_->remove_resume(api_path)) {
|
if (mgr_db_->remove_resume(api_path)) {
|
||||||
event_system2::instance().raise<download_resume_removed>(api_path,
|
event_system::instance().raise<download_resume_removed>(api_path,
|
||||||
source_path);
|
source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +684,7 @@ void file_manager::remove_upload(const std::string &api_path, bool no_lock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (removed) {
|
if (removed) {
|
||||||
event_system2::instance().raise<file_upload_removed>(api_path,
|
event_system::instance().raise<file_upload_removed>(api_path,
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,7 +849,7 @@ void file_manager::start() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_begin>("file_manager");
|
event_system::instance().raise<service_start_begin>("file_manager");
|
||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
|
|
||||||
polling::instance().set_callback({
|
polling::instance().set_callback({
|
||||||
@ -860,7 +860,7 @@ void file_manager::start() {
|
|||||||
|
|
||||||
if (provider_.is_read_only()) {
|
if (provider_.is_read_only()) {
|
||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
event_system2::instance().raise<service_start_end>("file_manager");
|
event_system::instance().raise<service_start_end>("file_manager");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,14 +873,14 @@ void file_manager::start() {
|
|||||||
filesystem_item fsi{};
|
filesystem_item fsi{};
|
||||||
auto res = provider_.get_filesystem_item(entry.api_path, false, fsi);
|
auto res = provider_.get_filesystem_item(entry.api_path, false, fsi);
|
||||||
if (res != api_error::success) {
|
if (res != api_error::success) {
|
||||||
event_system2::instance().raise<download_restore_failed>(
|
event_system::instance().raise<download_restore_failed>(
|
||||||
entry.api_path, entry.source_path,
|
entry.api_path, entry.source_path,
|
||||||
"failed to get filesystem item|" + api_error_to_string(res));
|
"failed to get filesystem item|" + api_error_to_string(res));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.source_path != fsi.source_path) {
|
if (entry.source_path != fsi.source_path) {
|
||||||
event_system2::instance().raise<download_restore_failed>(
|
event_system::instance().raise<download_restore_failed>(
|
||||||
fsi.api_path, fsi.source_path,
|
fsi.api_path, fsi.source_path,
|
||||||
"source path mismatch|expected|" + entry.source_path + "|actual|" +
|
"source path mismatch|expected|" + entry.source_path + "|actual|" +
|
||||||
fsi.source_path);
|
fsi.source_path);
|
||||||
@ -889,7 +889,7 @@ void file_manager::start() {
|
|||||||
|
|
||||||
auto opt_size = utils::file::file{fsi.source_path}.size();
|
auto opt_size = utils::file::file{fsi.source_path}.size();
|
||||||
if (not opt_size.has_value()) {
|
if (not opt_size.has_value()) {
|
||||||
event_system2::instance().raise<download_restore_failed>(
|
event_system::instance().raise<download_restore_failed>(
|
||||||
fsi.api_path, fsi.source_path,
|
fsi.api_path, fsi.source_path,
|
||||||
"failed to get file size: " +
|
"failed to get file size: " +
|
||||||
std::to_string(utils::get_last_error_code()));
|
std::to_string(utils::get_last_error_code()));
|
||||||
@ -898,7 +898,7 @@ void file_manager::start() {
|
|||||||
|
|
||||||
auto file_size{opt_size.value()};
|
auto file_size{opt_size.value()};
|
||||||
if (file_size != fsi.size) {
|
if (file_size != fsi.size) {
|
||||||
event_system2::instance().raise<download_restore_failed>(
|
event_system::instance().raise<download_restore_failed>(
|
||||||
fsi.api_path, fsi.source_path,
|
fsi.api_path, fsi.source_path,
|
||||||
"file size mismatch|expected|" + std::to_string(fsi.size) +
|
"file size mismatch|expected|" + std::to_string(fsi.size) +
|
||||||
"|actual|" + std::to_string(file_size));
|
"|actual|" + std::to_string(file_size));
|
||||||
@ -912,7 +912,7 @@ void file_manager::start() {
|
|||||||
: 0U,
|
: 0U,
|
||||||
fsi, provider_, entry.read_state, *this);
|
fsi, provider_, entry.read_state, *this);
|
||||||
open_file_lookup_[entry.api_path] = closeable_file;
|
open_file_lookup_[entry.api_path] = closeable_file;
|
||||||
event_system2::instance().raise<download_restored>(fsi.api_path,
|
event_system::instance().raise<download_restored>(fsi.api_path,
|
||||||
fsi.source_path);
|
fsi.source_path);
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
utils::error::raise_error(function_name, ex, "query error");
|
utils::error::raise_error(function_name, ex, "query error");
|
||||||
@ -920,7 +920,7 @@ void file_manager::start() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
upload_thread_ = std::make_unique<std::thread>([this] { upload_handler(); });
|
upload_thread_ = std::make_unique<std::thread>([this] { upload_handler(); });
|
||||||
event_system2::instance().raise<service_start_end>("file_manager");
|
event_system::instance().raise<service_start_end>("file_manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_manager::stop() {
|
void file_manager::stop() {
|
||||||
@ -928,7 +928,7 @@ void file_manager::stop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_begin>("file_manager");
|
event_system::instance().raise<service_stop_begin>("file_manager");
|
||||||
|
|
||||||
stop_requested_ = true;
|
stop_requested_ = true;
|
||||||
|
|
||||||
@ -962,7 +962,7 @@ void file_manager::stop() {
|
|||||||
|
|
||||||
upload_thread_.reset();
|
upload_thread_.reset();
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_end>("file_manager");
|
event_system::instance().raise<service_stop_end>("file_manager");
|
||||||
}
|
}
|
||||||
|
|
||||||
void file_manager::store_resume(const i_open_file &file) {
|
void file_manager::store_resume(const i_open_file &file) {
|
||||||
@ -976,12 +976,12 @@ void file_manager::store_resume(const i_open_file &file) {
|
|||||||
file.get_read_state(),
|
file.get_read_state(),
|
||||||
file.get_source_path(),
|
file.get_source_path(),
|
||||||
})) {
|
})) {
|
||||||
event_system2::instance().raise<download_resume_added>(
|
event_system::instance().raise<download_resume_added>(
|
||||||
file.get_api_path(), file.get_source_path());
|
file.get_api_path(), file.get_source_path());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<download_resume_add_failed>(
|
event_system::instance().raise<download_resume_add_failed>(
|
||||||
file.get_api_path(), file.get_source_path(), "failed to store resume");
|
file.get_api_path(), file.get_source_path(), "failed to store resume");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1029,11 +1029,11 @@ void file_manager::upload_completed(const file_upload_completed &evt) {
|
|||||||
auto res = provider_.is_file(evt.api_path, exists);
|
auto res = provider_.is_file(evt.api_path, exists);
|
||||||
if ((res == api_error::success && not exists) ||
|
if ((res == api_error::success && not exists) ||
|
||||||
not utils::file::file(evt.source_path).exists()) {
|
not utils::file::file(evt.source_path).exists()) {
|
||||||
event_system2::instance().raise<file_upload_not_found>(
|
event_system::instance().raise<file_upload_not_found>(
|
||||||
evt.api_path, function_name, evt.source_path);
|
evt.api_path, function_name, evt.source_path);
|
||||||
remove_upload(evt.api_path, true);
|
remove_upload(evt.api_path, true);
|
||||||
} else {
|
} else {
|
||||||
event_system2::instance().raise<file_upload_retry>(
|
event_system::instance().raise<file_upload_retry>(
|
||||||
evt.api_path, evt.error, function_name, evt.source_path);
|
evt.api_path, evt.error, function_name, evt.source_path);
|
||||||
|
|
||||||
queue_upload(evt.api_path, evt.source_path, true);
|
queue_upload(evt.api_path, evt.source_path, true);
|
||||||
@ -1065,7 +1065,7 @@ void file_manager::upload_handler() {
|
|||||||
switch (res) {
|
switch (res) {
|
||||||
case api_error::item_not_found: {
|
case api_error::item_not_found: {
|
||||||
should_wait = false;
|
should_wait = false;
|
||||||
event_system2::instance().raise<file_upload_not_found>(
|
event_system::instance().raise<file_upload_not_found>(
|
||||||
entry->api_path, function_name, entry->source_path);
|
entry->api_path, function_name, entry->source_path);
|
||||||
remove_upload(entry->api_path, true);
|
remove_upload(entry->api_path, true);
|
||||||
} break;
|
} break;
|
||||||
@ -1089,7 +1089,7 @@ void file_manager::upload_handler() {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
event_system2::instance().raise<file_upload_retry>(
|
event_system::instance().raise<file_upload_retry>(
|
||||||
entry->api_path, res, function_name, entry->source_path);
|
entry->api_path, res, function_name, entry->source_path);
|
||||||
queue_upload(entry->api_path, entry->source_path, true);
|
queue_upload(entry->api_path, entry->source_path, true);
|
||||||
} break;
|
} break;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "file_manager/open_file.hpp"
|
#include "file_manager/open_file.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/download_begin.hpp"
|
#include "events/types/download_begin.hpp"
|
||||||
#include "events/types/download_end.hpp"
|
#include "events/types/download_end.hpp"
|
||||||
#include "events/types/download_progress.hpp"
|
#include "events/types/download_progress.hpp"
|
||||||
@ -299,7 +299,7 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active,
|
|||||||
auto data_size = (chunk == read_state.size() - 1U) ? get_last_chunk_size()
|
auto data_size = (chunk == read_state.size() - 1U) ? get_last_chunk_size()
|
||||||
: get_chunk_size();
|
: get_chunk_size();
|
||||||
if (get_active_downloads().empty() && (read_state.count() == 0U)) {
|
if (get_active_downloads().empty() && (read_state.count() == 0U)) {
|
||||||
event_system2::instance().raise<download_begin>(
|
event_system::instance().raise<download_begin>(
|
||||||
get_api_path(), get_source_path(), function_name);
|
get_api_path(), get_source_path(), function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,17 +322,17 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active,
|
|||||||
auto progress = (static_cast<double>(state.count()) /
|
auto progress = (static_cast<double>(state.count()) /
|
||||||
static_cast<double>(state.size())) *
|
static_cast<double>(state.size())) *
|
||||||
100.0;
|
100.0;
|
||||||
event_system2::instance().raise<download_progress>(
|
event_system::instance().raise<download_progress>(
|
||||||
get_api_path(), get_source_path(), function_name, progress);
|
get_api_path(), get_source_path(), function_name, progress);
|
||||||
if (state.all() && not notified_) {
|
if (state.all() && not notified_) {
|
||||||
notified_ = true;
|
notified_ = true;
|
||||||
event_system2::instance().raise<download_end>(
|
event_system::instance().raise<download_end>(
|
||||||
get_api_path(), get_source_path(), get_api_error(),
|
get_api_path(), get_source_path(), get_api_error(),
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
} else if (not notified_) {
|
} else if (not notified_) {
|
||||||
notified_ = true;
|
notified_ = true;
|
||||||
event_system2::instance().raise<download_end>(
|
event_system::instance().raise<download_end>(
|
||||||
get_api_path(), get_source_path(), get_api_error(),
|
get_api_path(), get_source_path(), get_api_error(),
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "file_manager/open_file_base.hpp"
|
#include "file_manager/open_file_base.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/filesystem_item_closed.hpp"
|
#include "events/types/filesystem_item_closed.hpp"
|
||||||
#include "events/types/filesystem_item_handle_closed.hpp"
|
#include "events/types/filesystem_item_handle_closed.hpp"
|
||||||
#include "events/types/filesystem_item_handle_opened.hpp"
|
#include "events/types/filesystem_item_handle_opened.hpp"
|
||||||
@ -98,11 +98,11 @@ void open_file_base::add(std::uint64_t handle, open_file_data ofd) {
|
|||||||
recur_mutex_lock file_lock(file_mtx_);
|
recur_mutex_lock file_lock(file_mtx_);
|
||||||
open_data_[handle] = ofd;
|
open_data_[handle] = ofd;
|
||||||
if (open_data_.size() == 1U) {
|
if (open_data_.size() == 1U) {
|
||||||
event_system2::instance().raise<filesystem_item_opened>(
|
event_system::instance().raise<filesystem_item_opened>(
|
||||||
fsi_.api_path, fsi_.directory, function_name, fsi_.source_path);
|
fsi_.api_path, fsi_.directory, function_name, fsi_.source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<filesystem_item_handle_opened>(
|
event_system::instance().raise<filesystem_item_handle_opened>(
|
||||||
fsi_.api_path, fsi_.directory, function_name, handle, fsi_.source_path);
|
fsi_.api_path, fsi_.directory, function_name, handle, fsi_.source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,14 +322,14 @@ void open_file_base::remove(std::uint64_t handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open_data_.erase(handle);
|
open_data_.erase(handle);
|
||||||
event_system2::instance().raise<filesystem_item_handle_closed>(
|
event_system::instance().raise<filesystem_item_handle_closed>(
|
||||||
fsi_.api_path, modified_, fsi_.directory, function_name, handle,
|
fsi_.api_path, modified_, fsi_.directory, function_name, handle,
|
||||||
fsi_.source_path);
|
fsi_.source_path);
|
||||||
if (not open_data_.empty()) {
|
if (not open_data_.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<filesystem_item_closed>(
|
event_system::instance().raise<filesystem_item_closed>(
|
||||||
fsi_.api_path, modified_, fsi_.directory, function_name,
|
fsi_.api_path, modified_, fsi_.directory, function_name,
|
||||||
fsi_.source_path);
|
fsi_.source_path);
|
||||||
}
|
}
|
||||||
@ -346,12 +346,12 @@ void open_file_base::remove_all() {
|
|||||||
open_data_.clear();
|
open_data_.clear();
|
||||||
|
|
||||||
for (const auto &data : open_data) {
|
for (const auto &data : open_data) {
|
||||||
event_system2::instance().raise<filesystem_item_handle_closed>(
|
event_system::instance().raise<filesystem_item_handle_closed>(
|
||||||
fsi_.api_path, modified_, fsi_.directory, function_name, data.first,
|
fsi_.api_path, modified_, fsi_.directory, function_name, data.first,
|
||||||
fsi_.source_path);
|
fsi_.source_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<filesystem_item_closed>(
|
event_system::instance().raise<filesystem_item_closed>(
|
||||||
fsi_.api_path, modified_, fsi_.directory, function_name,
|
fsi_.api_path, modified_, fsi_.directory, function_name,
|
||||||
fsi_.source_path);
|
fsi_.source_path);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "file_manager/ring_buffer_base.hpp"
|
#include "file_manager/ring_buffer_base.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/download_begin.hpp"
|
#include "events/types/download_begin.hpp"
|
||||||
#include "events/types/download_end.hpp"
|
#include "events/types/download_end.hpp"
|
||||||
#include "events/types/download_progress.hpp"
|
#include "events/types/download_progress.hpp"
|
||||||
@ -67,7 +67,7 @@ auto ring_buffer_base::check_start() -> api_error {
|
|||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<download_begin>(
|
event_system::instance().raise<download_begin>(
|
||||||
get_api_path(), get_source_path(), function_name);
|
get_api_path(), get_source_path(), function_name);
|
||||||
reader_thread_ =
|
reader_thread_ =
|
||||||
std::make_unique<std::thread>([this]() { reader_thread(); });
|
std::make_unique<std::thread>([this]() { reader_thread(); });
|
||||||
@ -160,7 +160,7 @@ auto ring_buffer_base::download_chunk(std::size_t chunk,
|
|||||||
auto progress = (static_cast<double>(chunk + 1U) /
|
auto progress = (static_cast<double>(chunk + 1U) /
|
||||||
static_cast<double>(total_chunks_)) *
|
static_cast<double>(total_chunks_)) *
|
||||||
100.0;
|
100.0;
|
||||||
event_system2::instance().raise<download_progress>(
|
event_system::instance().raise<download_progress>(
|
||||||
get_api_path(), get_source_path(), function_name, progress);
|
get_api_path(), get_source_path(), function_name, progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ void ring_buffer_base::reader_thread() {
|
|||||||
download_chunk(next_chunk, true);
|
download_chunk(next_chunk, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<download_end>(
|
event_system::instance().raise<download_end>(
|
||||||
get_api_path(), get_source_path(), api_error::download_stopped,
|
get_api_path(), get_source_path(), api_error::download_stopped,
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "file_manager/upload.hpp"
|
#include "file_manager/upload.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/file_upload_completed.hpp"
|
#include "events/types/file_upload_completed.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "providers/i_provider.hpp"
|
#include "providers/i_provider.hpp"
|
||||||
@ -60,7 +60,7 @@ void upload::upload_thread() {
|
|||||||
utils::get_last_error_code(), "failed to reset modified time");
|
utils::get_last_error_code(), "failed to reset modified time");
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<file_upload_completed>(
|
event_system::instance().raise<file_upload_completed>(
|
||||||
get_api_path(), cancelled_, get_api_error(), function_name,
|
get_api_path(), cancelled_, get_api_error(), function_name,
|
||||||
get_source_path());
|
get_source_path());
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "platform/unix_platform.hpp"
|
#include "platform/unix_platform.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/filesystem_item_added.hpp"
|
#include "events/types/filesystem_item_added.hpp"
|
||||||
#include "providers/i_provider.hpp"
|
#include "providers/i_provider.hpp"
|
||||||
#include "types/startup_exception.hpp"
|
#include "types/startup_exception.hpp"
|
||||||
@ -237,7 +237,7 @@ auto provider_meta_handler(i_provider &provider, bool directory,
|
|||||||
file.modified_date);
|
file.modified_date);
|
||||||
auto res = provider.set_item_meta(file.api_path, meta);
|
auto res = provider.set_item_meta(file.api_path, meta);
|
||||||
if (res == api_error::success) {
|
if (res == api_error::success) {
|
||||||
event_system2::instance().raise<filesystem_item_added>(
|
event_system::instance().raise<filesystem_item_added>(
|
||||||
file.api_parent, file.api_path, directory, function_name);
|
file.api_parent, file.api_path, directory, function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "platform/win32_platform.hpp"
|
#include "platform/win32_platform.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/filesystem_item_added.hpp"
|
#include "events/types/filesystem_item_added.hpp"
|
||||||
#include "providers/i_provider.hpp"
|
#include "providers/i_provider.hpp"
|
||||||
#include "utils/error_utils.hpp"
|
#include "utils/error_utils.hpp"
|
||||||
@ -206,7 +206,7 @@ auto provider_meta_handler(i_provider &provider, bool directory,
|
|||||||
file.source_path, 0u, file.modified_date);
|
file.source_path, 0u, file.modified_date);
|
||||||
auto res = provider.set_item_meta(file.api_path, meta);
|
auto res = provider.set_item_meta(file.api_path, meta);
|
||||||
if (res == api_error::success) {
|
if (res == api_error::success) {
|
||||||
event_system2::instance().raise<filesystem_item_added>(
|
event_system::instance().raise<filesystem_item_added>(
|
||||||
file.api_parent, file.api_path, directory, function_name);
|
file.api_parent, file.api_path, directory, function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "db/meta_db.hpp"
|
#include "db/meta_db.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/directory_remove_failed.hpp"
|
#include "events/types/directory_remove_failed.hpp"
|
||||||
#include "events/types/directory_removed.hpp"
|
#include "events/types/directory_removed.hpp"
|
||||||
#include "events/types/directory_removed_externally.hpp"
|
#include "events/types/directory_removed_externally.hpp"
|
||||||
@ -468,7 +468,7 @@ void base_provider::process_removed_directories(
|
|||||||
}
|
}
|
||||||
|
|
||||||
db3_->remove_api_path(item.api_path);
|
db3_->remove_api_path(item.api_path);
|
||||||
event_system2::instance().raise<directory_removed_externally>(
|
event_system::instance().raise<directory_removed_externally>(
|
||||||
item.api_path, function_name, item.source_path);
|
item.api_path, function_name, item.source_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,10 +509,10 @@ void base_provider::process_removed_files(std::deque<removed_item> removed_list,
|
|||||||
orphaned_directory, {utils::path::strip_to_file_name(item.source_path) +
|
orphaned_directory, {utils::path::strip_to_file_name(item.source_path) +
|
||||||
'_' + parts[parts.size() - 1U]});
|
'_' + parts[parts.size() - 1U]});
|
||||||
|
|
||||||
event_system2::instance().raise<orphaned_file_detected>(function_name,
|
event_system::instance().raise<orphaned_file_detected>(function_name,
|
||||||
item.source_path);
|
item.source_path);
|
||||||
if (not utils::file::reset_modified_time(item.source_path)) {
|
if (not utils::file::reset_modified_time(item.source_path)) {
|
||||||
event_system2::instance().raise<orphaned_file_processing_failed>(
|
event_system::instance().raise<orphaned_file_processing_failed>(
|
||||||
orphaned_file,
|
orphaned_file,
|
||||||
"reset modified failed|" +
|
"reset modified failed|" +
|
||||||
std::to_string(utils::get_last_error_code()),
|
std::to_string(utils::get_last_error_code()),
|
||||||
@ -522,7 +522,7 @@ void base_provider::process_removed_files(std::deque<removed_item> removed_list,
|
|||||||
|
|
||||||
if (not utils::file::file(item.source_path).copy_to(orphaned_file, true)) {
|
if (not utils::file::file(item.source_path).copy_to(orphaned_file, true)) {
|
||||||
[[maybe_unused]] auto removed = utils::file::file{orphaned_file}.remove();
|
[[maybe_unused]] auto removed = utils::file::file{orphaned_file}.remove();
|
||||||
event_system2::instance().raise<orphaned_file_processing_failed>(
|
event_system::instance().raise<orphaned_file_processing_failed>(
|
||||||
orphaned_file,
|
orphaned_file,
|
||||||
"copy failed|" + std::to_string(utils::get_last_error_code()),
|
"copy failed|" + std::to_string(utils::get_last_error_code()),
|
||||||
function_name, item.source_path);
|
function_name, item.source_path);
|
||||||
@ -530,13 +530,13 @@ void base_provider::process_removed_files(std::deque<removed_item> removed_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (not fm_->evict_file(item.api_path)) {
|
if (not fm_->evict_file(item.api_path)) {
|
||||||
event_system2::instance().raise<orphaned_file_processing_failed>(
|
event_system::instance().raise<orphaned_file_processing_failed>(
|
||||||
orphaned_file, "eviction failed", function_name, item.source_path);
|
orphaned_file, "eviction failed", function_name, item.source_path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
db3_->remove_api_path(item.api_path);
|
db3_->remove_api_path(item.api_path);
|
||||||
event_system2::instance().raise<file_removed_externally>(item.api_path,
|
event_system::instance().raise<file_removed_externally>(item.api_path,
|
||||||
item.source_path);
|
item.source_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,9 +627,9 @@ auto base_provider::remove_file(const std::string &api_path) -> api_error {
|
|||||||
|
|
||||||
const auto notify_end = [&api_path](api_error error) -> api_error {
|
const auto notify_end = [&api_path](api_error error) -> api_error {
|
||||||
if (error == api_error::success) {
|
if (error == api_error::success) {
|
||||||
event_system2::instance().raise<file_removed>(api_path, function_name);
|
event_system::instance().raise<file_removed>(api_path, function_name);
|
||||||
} else {
|
} else {
|
||||||
event_system2::instance().raise<file_remove_failed>(api_path, error,
|
event_system::instance().raise<file_remove_failed>(api_path, error,
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,7 +658,7 @@ auto base_provider::remove_file(const std::string &api_path) -> api_error {
|
|||||||
return notify_end(res);
|
return notify_end(res);
|
||||||
}
|
}
|
||||||
if (not exists) {
|
if (not exists) {
|
||||||
event_system2::instance().raise<file_remove_failed>(
|
event_system::instance().raise<file_remove_failed>(
|
||||||
api_path, api_error::item_not_found, function_name);
|
api_path, api_error::item_not_found, function_name);
|
||||||
return remove_file_meta();
|
return remove_file_meta();
|
||||||
}
|
}
|
||||||
@ -676,10 +676,10 @@ auto base_provider::remove_directory(const std::string &api_path) -> api_error {
|
|||||||
|
|
||||||
const auto notify_end = [&api_path](api_error error) -> api_error {
|
const auto notify_end = [&api_path](api_error error) -> api_error {
|
||||||
if (error == api_error::success) {
|
if (error == api_error::success) {
|
||||||
event_system2::instance().raise<directory_removed>(api_path,
|
event_system::instance().raise<directory_removed>(api_path,
|
||||||
function_name);
|
function_name);
|
||||||
} else {
|
} else {
|
||||||
event_system2::instance().raise<directory_remove_failed>(api_path, error,
|
event_system::instance().raise<directory_remove_failed>(api_path, error,
|
||||||
function_name);
|
function_name);
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
@ -750,13 +750,13 @@ void base_provider::remove_unmatched_source_files(stop_type &stop_requested) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<orphaned_source_file_detected>(
|
event_system::instance().raise<orphaned_source_file_detected>(
|
||||||
function_name, source_file->get_path());
|
function_name, source_file->get_path());
|
||||||
if (not source_file->remove()) {
|
if (not source_file->remove()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<orphaned_source_file_removed>(
|
event_system::instance().raise<orphaned_source_file_removed>(
|
||||||
function_name, source_file->get_path());
|
function_name, source_file->get_path());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -807,7 +807,7 @@ auto base_provider::start(api_item_added_callback api_item_added,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<provider_offline>(
|
event_system::instance().raise<provider_offline>(
|
||||||
function_name, cfg.get_host_config().host_name_or_ip,
|
function_name, cfg.get_host_config().host_name_or_ip,
|
||||||
cfg.get_host_config().api_port);
|
cfg.get_host_config().api_port);
|
||||||
std::this_thread::sleep_for(1s);
|
std::this_thread::sleep_for(1s);
|
||||||
@ -841,13 +841,13 @@ auto base_provider::upload_file(const std::string &api_path,
|
|||||||
|
|
||||||
const auto notify_end = [&api_path,
|
const auto notify_end = [&api_path,
|
||||||
&source_path](api_error error) -> api_error {
|
&source_path](api_error error) -> api_error {
|
||||||
event_system2::instance().raise<provider_upload_end>(
|
event_system::instance().raise<provider_upload_end>(
|
||||||
api_path, error, function_name, source_path);
|
api_path, error, function_name, source_path);
|
||||||
return error;
|
return error;
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
event_system2::instance().raise<provider_upload_begin>(
|
event_system::instance().raise<provider_upload_begin>(
|
||||||
api_path, function_name, source_path);
|
api_path, function_name, source_path);
|
||||||
|
|
||||||
return notify_end(upload_file_impl(api_path, source_path, stop_requested));
|
return notify_end(upload_file_impl(api_path, source_path, stop_requested));
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "providers/encrypt/encrypt_provider.hpp"
|
#include "providers/encrypt/encrypt_provider.hpp"
|
||||||
|
|
||||||
#include "db/file_db.hpp"
|
#include "db/file_db.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/directory_removed_externally.hpp"
|
#include "events/types/directory_removed_externally.hpp"
|
||||||
#include "events/types/file_removed_externally.hpp"
|
#include "events/types/file_removed_externally.hpp"
|
||||||
#include "events/types/filesystem_item_added.hpp"
|
#include "events/types/filesystem_item_added.hpp"
|
||||||
@ -648,7 +648,7 @@ auto encrypt_provider::process_directory_entry(
|
|||||||
api_error_to_string(result)));
|
api_error_to_string(result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<filesystem_item_added>(
|
event_system::instance().raise<filesystem_item_added>(
|
||||||
utils::path::get_parent_api_path(current_api_path),
|
utils::path::get_parent_api_path(current_api_path),
|
||||||
current_api_path, true, function_name);
|
current_api_path, true, function_name);
|
||||||
} else {
|
} else {
|
||||||
@ -726,7 +726,7 @@ auto encrypt_provider::process_directory_entry(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<filesystem_item_added>(
|
event_system::instance().raise<filesystem_item_added>(
|
||||||
api_parent, api_path, false, function_name);
|
api_parent, api_path, false, function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -855,12 +855,12 @@ void encrypt_provider::remove_deleted_files(stop_type &stop_requested) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.directory) {
|
if (item.directory) {
|
||||||
event_system2::instance().raise<directory_removed_externally>(
|
event_system::instance().raise<directory_removed_externally>(
|
||||||
item.api_path, function_name, item.source_path);
|
item.api_path, function_name, item.source_path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<file_removed_externally>(
|
event_system::instance().raise<file_removed_externally>(
|
||||||
item.api_path, item.source_path);
|
item.api_path, item.source_path);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -875,7 +875,7 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_begin>("encrypt_provider");
|
event_system::instance().raise<service_start_begin>("encrypt_provider");
|
||||||
db_ = create_file_db(config_);
|
db_ = create_file_db(config_);
|
||||||
|
|
||||||
std::string source_path;
|
std::string source_path;
|
||||||
@ -912,14 +912,14 @@ auto encrypt_provider::start(api_item_added_callback /*api_item_added*/,
|
|||||||
[this](auto &&stop_requested) { remove_deleted_files(stop_requested); },
|
[this](auto &&stop_requested) { remove_deleted_files(stop_requested); },
|
||||||
});
|
});
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_end>("encrypt_provider");
|
event_system::instance().raise<service_start_end>("encrypt_provider");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void encrypt_provider::stop() {
|
void encrypt_provider::stop() {
|
||||||
event_system2::instance().raise<service_stop_begin>("encrypt_provider");
|
event_system::instance().raise<service_stop_begin>("encrypt_provider");
|
||||||
polling::instance().remove_callback("check_deleted");
|
polling::instance().remove_callback("check_deleted");
|
||||||
db_.reset();
|
db_.reset();
|
||||||
event_system2::instance().raise<service_stop_end>("encrypt_provider");
|
event_system::instance().raise<service_stop_end>("encrypt_provider");
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "comm/i_http_comm.hpp"
|
#include "comm/i_http_comm.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -1047,18 +1047,18 @@ auto s3_provider::set_meta_key(const std::string &api_path, api_meta_map &meta)
|
|||||||
|
|
||||||
auto s3_provider::start(api_item_added_callback api_item_added,
|
auto s3_provider::start(api_item_added_callback api_item_added,
|
||||||
i_file_manager *mgr) -> bool {
|
i_file_manager *mgr) -> bool {
|
||||||
event_system2::instance().raise<service_start_begin>("s3_provider");
|
event_system::instance().raise<service_start_begin>("s3_provider");
|
||||||
s3_config_ = get_config().get_s3_config();
|
s3_config_ = get_config().get_s3_config();
|
||||||
get_comm().enable_s3_path_style(s3_config_.use_path_style);
|
get_comm().enable_s3_path_style(s3_config_.use_path_style);
|
||||||
auto ret = base_provider::start(api_item_added, mgr);
|
auto ret = base_provider::start(api_item_added, mgr);
|
||||||
event_system2::instance().raise<service_start_end>("s3_provider");
|
event_system::instance().raise<service_start_end>("s3_provider");
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
void s3_provider::stop() {
|
void s3_provider::stop() {
|
||||||
event_system2::instance().raise<service_stop_begin>("s3_provider");
|
event_system::instance().raise<service_stop_begin>("s3_provider");
|
||||||
base_provider::stop();
|
base_provider::stop();
|
||||||
event_system2::instance().raise<service_stop_end>("s3_provider");
|
event_system::instance().raise<service_stop_end>("s3_provider");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto s3_provider::upload_file_impl(const std::string &api_path,
|
auto s3_provider::upload_file_impl(const std::string &api_path,
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "comm/i_http_comm.hpp"
|
#include "comm/i_http_comm.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -744,17 +744,17 @@ auto sia_provider::rename_file(const std::string &from_api_path,
|
|||||||
|
|
||||||
auto sia_provider::start(api_item_added_callback api_item_added,
|
auto sia_provider::start(api_item_added_callback api_item_added,
|
||||||
i_file_manager *mgr) -> bool {
|
i_file_manager *mgr) -> bool {
|
||||||
event_system2::instance().raise<service_start_begin>("sia_provider");
|
event_system::instance().raise<service_start_begin>("sia_provider");
|
||||||
sia_config_ = get_config().get_sia_config();
|
sia_config_ = get_config().get_sia_config();
|
||||||
auto ret = base_provider::start(api_item_added, mgr);
|
auto ret = base_provider::start(api_item_added, mgr);
|
||||||
event_system2::instance().raise<service_start_end>("sia_provider");
|
event_system::instance().raise<service_start_end>("sia_provider");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sia_provider::stop() {
|
void sia_provider::stop() {
|
||||||
event_system2::instance().raise<service_stop_begin>("sia_provider");
|
event_system::instance().raise<service_stop_begin>("sia_provider");
|
||||||
base_provider::stop();
|
base_provider::stop();
|
||||||
event_system2::instance().raise<service_stop_end>("sia_provider");
|
event_system::instance().raise<service_stop_end>("sia_provider");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sia_provider::upload_file_impl(const std::string &api_path,
|
auto sia_provider::upload_file_impl(const std::string &api_path,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "rpc/server/full_server.hpp"
|
#include "rpc/server/full_server.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/file_pinned.hpp"
|
#include "events/types/file_pinned.hpp"
|
||||||
#include "events/types/file_unpinned.hpp"
|
#include "events/types/file_unpinned.hpp"
|
||||||
#include "file_manager/cache_size_mgr.hpp"
|
#include "file_manager/cache_size_mgr.hpp"
|
||||||
@ -136,7 +136,7 @@ void full_server::handle_pin_file(const httplib::Request &req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
event_system2::instance().raise<file_pinned>(api_path, function_name);
|
event_system::instance().raise<file_pinned>(api_path, function_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status = exists ? http_error_codes::ok : http_error_codes::not_found;
|
res.status = exists ? http_error_codes::ok : http_error_codes::not_found;
|
||||||
@ -164,7 +164,7 @@ void full_server::handle_unpin_file(const httplib::Request &req,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
event_system2::instance().raise<file_unpinned>(api_path);
|
event_system::instance().raise<file_unpinned>(api_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status = exists ? http_error_codes::ok : http_error_codes::not_found;
|
res.status = exists ? http_error_codes::ok : http_error_codes::not_found;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "rpc/server/server.hpp"
|
#include "rpc/server/server.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -110,7 +110,7 @@ void server::handle_set_config_value_by_name(const httplib::Request &req,
|
|||||||
|
|
||||||
void server::handle_unmount(const httplib::Request & /*req*/,
|
void server::handle_unmount(const httplib::Request & /*req*/,
|
||||||
httplib::Response &res) {
|
httplib::Response &res) {
|
||||||
event_system2::instance().raise<unmount_requested>();
|
event_system::instance().raise<unmount_requested>();
|
||||||
res.status = http_error_codes::ok;
|
res.status = http_error_codes::ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ void server::start() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_begin>("server");
|
event_system::instance().raise<service_start_begin>("server");
|
||||||
|
|
||||||
server_ = std::make_unique<httplib::Server>();
|
server_ = std::make_unique<httplib::Server>();
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ void server::start() {
|
|||||||
|
|
||||||
server_thread_ = std::make_unique<std::thread>(
|
server_thread_ = std::make_unique<std::thread>(
|
||||||
[this]() { server_->listen("127.0.0.1", config_.get_api_port()); });
|
[this]() { server_->listen("127.0.0.1", config_.get_api_port()); });
|
||||||
event_system2::instance().raise<service_start_end>("server");
|
event_system::instance().raise<service_start_end>("server");
|
||||||
}
|
}
|
||||||
|
|
||||||
void server::stop() {
|
void server::stop() {
|
||||||
@ -194,7 +194,7 @@ void server::stop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_begin>("server");
|
event_system::instance().raise<service_stop_begin>("server");
|
||||||
|
|
||||||
server_->stop();
|
server_->stop();
|
||||||
|
|
||||||
@ -209,6 +209,6 @@ void server::stop() {
|
|||||||
server_.reset();
|
server_.reset();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_end>("server");
|
event_system::instance().raise<service_stop_end>("server");
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "utils/error_utils.hpp"
|
#include "utils/error_utils.hpp"
|
||||||
|
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/repertory_exception.hpp"
|
#include "events/types/repertory_exception.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/error.hpp"
|
#include "utils/error.hpp"
|
||||||
@ -53,19 +53,19 @@ std::unique_ptr<repertory_exception_handler> handler{([]() -> auto * {
|
|||||||
|
|
||||||
namespace repertory::utils::error {
|
namespace repertory::utils::error {
|
||||||
void raise_error(std::string_view function, std::string_view msg) {
|
void raise_error(std::string_view function, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg));
|
function, static_cast<std::string>(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
void raise_error(std::string_view function, const api_error &err,
|
void raise_error(std::string_view function, const api_error &err,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|err|" + api_error_to_string(err));
|
static_cast<std::string>(msg) + "|err|" + api_error_to_string(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
void raise_error(std::string_view function, const std::exception &exception) {
|
void raise_error(std::string_view function, const std::exception &exception) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
"err|" + std::string(exception.what() == nullptr ? "unknown error"
|
"err|" + std::string(exception.what() == nullptr ? "unknown error"
|
||||||
: exception.what()));
|
: exception.what()));
|
||||||
@ -73,7 +73,7 @@ void raise_error(std::string_view function, const std::exception &exception) {
|
|||||||
|
|
||||||
void raise_error(std::string_view function, const std::exception &exception,
|
void raise_error(std::string_view function, const std::exception &exception,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|err|" +
|
static_cast<std::string>(msg) + "|err|" +
|
||||||
(exception.what() == nullptr ? "unknown error" : exception.what()));
|
(exception.what() == nullptr ? "unknown error" : exception.what()));
|
||||||
@ -81,19 +81,19 @@ void raise_error(std::string_view function, const std::exception &exception,
|
|||||||
|
|
||||||
void raise_error(std::string_view function, const json &err,
|
void raise_error(std::string_view function, const json &err,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|err|" + err.dump(2));
|
function, static_cast<std::string>(msg) + "|err|" + err.dump(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void raise_error(std::string_view function, std::int64_t err,
|
void raise_error(std::string_view function, std::int64_t err,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|err|" + std::to_string(err));
|
function, static_cast<std::string>(msg) + "|err|" + std::to_string(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
void raise_error(std::string_view function, const api_error &err,
|
void raise_error(std::string_view function, const api_error &err,
|
||||||
std::string_view file_path, std::string_view msg) {
|
std::string_view file_path, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|sp|" +
|
function, static_cast<std::string>(msg) + "|sp|" +
|
||||||
static_cast<std::string>(file_path) + "|err|" +
|
static_cast<std::string>(file_path) + "|err|" +
|
||||||
api_error_to_string(err));
|
api_error_to_string(err));
|
||||||
@ -101,7 +101,7 @@ void raise_error(std::string_view function, const api_error &err,
|
|||||||
|
|
||||||
void raise_error(std::string_view function, std::int64_t err,
|
void raise_error(std::string_view function, std::int64_t err,
|
||||||
std::string_view file_path, std::string_view msg) {
|
std::string_view file_path, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|sp|" +
|
function, static_cast<std::string>(msg) + "|sp|" +
|
||||||
static_cast<std::string>(file_path) + "|err|" +
|
static_cast<std::string>(file_path) + "|err|" +
|
||||||
std::to_string(err));
|
std::to_string(err));
|
||||||
@ -109,7 +109,7 @@ void raise_error(std::string_view function, std::int64_t err,
|
|||||||
|
|
||||||
void raise_error(std::string_view function, const std::exception &exception,
|
void raise_error(std::string_view function, const std::exception &exception,
|
||||||
std::string_view file_path, std::string_view msg) {
|
std::string_view file_path, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|sp|" +
|
static_cast<std::string>(msg) + "|sp|" +
|
||||||
static_cast<std::string>(file_path) + "|err|" +
|
static_cast<std::string>(file_path) + "|err|" +
|
||||||
@ -118,7 +118,7 @@ void raise_error(std::string_view function, const std::exception &exception,
|
|||||||
|
|
||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
const api_error &err, std::string_view msg) {
|
const api_error &err, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|ap|" +
|
function, static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|err|" +
|
static_cast<std::string>(api_path) + "|err|" +
|
||||||
api_error_to_string(err));
|
api_error_to_string(err));
|
||||||
@ -126,7 +126,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
|
|
||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
std::int64_t err, std::string_view msg) {
|
std::int64_t err, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|ap|" +
|
function, static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|err|" +
|
static_cast<std::string>(api_path) + "|err|" +
|
||||||
std::to_string(err));
|
std::to_string(err));
|
||||||
@ -134,7 +134,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
|
|
||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
const std::exception &exception) {
|
const std::exception &exception) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
"ap|" + static_cast<std::string>(api_path) + "|err|" +
|
"ap|" + static_cast<std::string>(api_path) + "|err|" +
|
||||||
(exception.what() == nullptr ? "unknown error" : exception.what()));
|
(exception.what() == nullptr ? "unknown error" : exception.what()));
|
||||||
@ -143,7 +143,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
const std::exception &exception,
|
const std::exception &exception,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|ap|" +
|
static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|err|" +
|
static_cast<std::string>(api_path) + "|err|" +
|
||||||
@ -153,7 +153,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
std::string_view source_path, const api_error &err,
|
std::string_view source_path, const api_error &err,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|ap|" +
|
function, static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|sp|" +
|
static_cast<std::string>(api_path) + "|sp|" +
|
||||||
static_cast<std::string>(source_path) + "|err|" +
|
static_cast<std::string>(source_path) + "|err|" +
|
||||||
@ -163,7 +163,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
std::string_view source_path, std::int64_t err,
|
std::string_view source_path, std::int64_t err,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|ap|" +
|
function, static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|sp|" +
|
static_cast<std::string>(api_path) + "|sp|" +
|
||||||
static_cast<std::string>(source_path) + "|err|" +
|
static_cast<std::string>(source_path) + "|err|" +
|
||||||
@ -172,7 +172,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
|
|
||||||
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
void raise_api_path_error(std::string_view function, std::string_view api_path,
|
||||||
const json &err, std::string_view msg) {
|
const json &err, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|ap|" +
|
function, static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|err|" + err.dump(2));
|
static_cast<std::string>(api_path) + "|err|" + err.dump(2));
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
std::string_view source_path,
|
std::string_view source_path,
|
||||||
const std::exception &exception,
|
const std::exception &exception,
|
||||||
std::string_view msg) {
|
std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|ap|" +
|
static_cast<std::string>(msg) + "|ap|" +
|
||||||
static_cast<std::string>(api_path) + "|sp|" +
|
static_cast<std::string>(api_path) + "|sp|" +
|
||||||
@ -191,7 +191,7 @@ void raise_api_path_error(std::string_view function, std::string_view api_path,
|
|||||||
|
|
||||||
void raise_url_error(std::string_view function, std::string_view url,
|
void raise_url_error(std::string_view function, std::string_view url,
|
||||||
CURLcode err, std::string_view msg) {
|
CURLcode err, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function, static_cast<std::string>(msg) + "|url|" +
|
function, static_cast<std::string>(msg) + "|url|" +
|
||||||
static_cast<std::string>(url) + "|err|" +
|
static_cast<std::string>(url) + "|err|" +
|
||||||
curl_easy_strerror(err));
|
curl_easy_strerror(err));
|
||||||
@ -200,7 +200,7 @@ void raise_url_error(std::string_view function, std::string_view url,
|
|||||||
void raise_url_error(std::string_view function, std::string_view url,
|
void raise_url_error(std::string_view function, std::string_view url,
|
||||||
std::string_view source_path,
|
std::string_view source_path,
|
||||||
const std::exception &exception) {
|
const std::exception &exception) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
"url|" + static_cast<std::string>(url) + "|sp|" +
|
"url|" + static_cast<std::string>(url) + "|sp|" +
|
||||||
static_cast<std::string>(source_path) + "|err|" +
|
static_cast<std::string>(source_path) + "|err|" +
|
||||||
@ -210,7 +210,7 @@ void raise_url_error(std::string_view function, std::string_view url,
|
|||||||
void raise_url_error(std::string_view function, std::string_view url,
|
void raise_url_error(std::string_view function, std::string_view url,
|
||||||
std::string_view source_path,
|
std::string_view source_path,
|
||||||
const std::exception &exception, std::string_view msg) {
|
const std::exception &exception, std::string_view msg) {
|
||||||
event_system2::instance().raise<repertory_exception>(
|
event_system::instance().raise<repertory_exception>(
|
||||||
function,
|
function,
|
||||||
static_cast<std::string>(msg) + "|url|" + static_cast<std::string>(url) +
|
static_cast<std::string>(msg) + "|url|" + static_cast<std::string>(url) +
|
||||||
"|sp|" + static_cast<std::string>(source_path) + "|err|" +
|
"|sp|" + static_cast<std::string>(source_path) + "|err|" +
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "utils/polling.hpp"
|
#include "utils/polling.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/polling_item_begin.hpp"
|
#include "events/types/polling_item_begin.hpp"
|
||||||
#include "events/types/polling_item_end.hpp"
|
#include "events/types/polling_item_end.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
@ -51,13 +51,13 @@ void polling::frequency_thread(
|
|||||||
[this, &freq, item](auto &&task_stopped) {
|
[this, &freq, item](auto &&task_stopped) {
|
||||||
if (config_->get_event_level() == event_level::trace ||
|
if (config_->get_event_level() == event_level::trace ||
|
||||||
freq != frequency::second) {
|
freq != frequency::second) {
|
||||||
event_system2::instance().raise<polling_item_begin>(
|
event_system::instance().raise<polling_item_begin>(
|
||||||
function_name, item.first);
|
function_name, item.first);
|
||||||
}
|
}
|
||||||
item.second.action(task_stopped);
|
item.second.action(task_stopped);
|
||||||
if (config_->get_event_level() == event_level::trace ||
|
if (config_->get_event_level() == event_level::trace ||
|
||||||
freq != frequency::second) {
|
freq != frequency::second) {
|
||||||
event_system2::instance().raise<polling_item_end>(
|
event_system::instance().raise<polling_item_end>(
|
||||||
function_name, item.first);
|
function_name, item.first);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -102,7 +102,7 @@ void polling::start(app_config *config) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_start_begin>("polling");
|
event_system::instance().raise<service_start_begin>("polling");
|
||||||
config_ = config;
|
config_ = config;
|
||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ void polling::start(app_config *config) {
|
|||||||
this->frequency_thread([]() -> std::uint32_t { return 1U; },
|
this->frequency_thread([]() -> std::uint32_t { return 1U; },
|
||||||
frequency::second);
|
frequency::second);
|
||||||
});
|
});
|
||||||
event_system2::instance().raise<service_start_end>("polling");
|
event_system::instance().raise<service_start_end>("polling");
|
||||||
}
|
}
|
||||||
|
|
||||||
void polling::stop() {
|
void polling::stop() {
|
||||||
@ -150,7 +150,7 @@ void polling::stop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_begin>("polling");
|
event_system::instance().raise<service_stop_begin>("polling");
|
||||||
|
|
||||||
stop_requested_ = true;
|
stop_requested_ = true;
|
||||||
|
|
||||||
@ -169,6 +169,6 @@ void polling::stop() {
|
|||||||
thread.reset();
|
thread.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_end>("polling");
|
event_system::instance().raise<service_stop_end>("polling");
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "utils/single_thread_service_base.hpp"
|
#include "utils/single_thread_service_base.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/types/service_start_begin.hpp"
|
#include "events/types/service_start_begin.hpp"
|
||||||
#include "events/types/service_start_end.hpp"
|
#include "events/types/service_start_end.hpp"
|
||||||
#include "events/types/service_stop_begin.hpp"
|
#include "events/types/service_stop_begin.hpp"
|
||||||
@ -48,8 +48,8 @@ void single_thread_service_base::start() {
|
|||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
on_start();
|
on_start();
|
||||||
thread_ = std::make_unique<std::thread>([this]() {
|
thread_ = std::make_unique<std::thread>([this]() {
|
||||||
event_system2::instance().raise<service_start_begin>(service_name_);
|
event_system::instance().raise<service_start_begin>(service_name_);
|
||||||
event_system2::instance().raise<service_start_end>(service_name_);
|
event_system::instance().raise<service_start_end>(service_name_);
|
||||||
while (not get_stop_requested()) {
|
while (not get_stop_requested()) {
|
||||||
service_function();
|
service_function();
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ void single_thread_service_base::stop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_begin>(service_name_);
|
event_system::instance().raise<service_stop_begin>(service_name_);
|
||||||
|
|
||||||
stop_requested_ = true;
|
stop_requested_ = true;
|
||||||
|
|
||||||
@ -77,6 +77,6 @@ void single_thread_service_base::stop() {
|
|||||||
|
|
||||||
on_stop();
|
on_stop();
|
||||||
|
|
||||||
event_system2::instance().raise<service_stop_end>(service_name_);
|
event_system::instance().raise<service_stop_end>(service_name_);
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "db/impl/rdb_file_db.hpp"
|
#include "db/impl/rdb_file_db.hpp"
|
||||||
#include "db/impl/sqlite_file_db.hpp"
|
#include "db/impl/sqlite_file_db.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
template <typename db_t> class file_db_test : public ::testing::Test {
|
template <typename db_t> class file_db_test : public ::testing::Test {
|
||||||
@ -41,7 +41,7 @@ protected:
|
|||||||
static void SetUpTestCase() {
|
static void SetUpTestCase() {
|
||||||
static std::uint64_t idx{};
|
static std::uint64_t idx{};
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ protected:
|
|||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
file_db.reset();
|
file_db.reset();
|
||||||
config.reset();
|
config.reset();
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "db/impl/rdb_file_mgr_db.hpp"
|
#include "db/impl/rdb_file_mgr_db.hpp"
|
||||||
#include "db/impl/sqlite_file_mgr_db.hpp"
|
#include "db/impl/sqlite_file_mgr_db.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
template <typename db_t> class file_mgr_db_test : public ::testing::Test {
|
template <typename db_t> class file_mgr_db_test : public ::testing::Test {
|
||||||
@ -41,7 +41,7 @@ protected:
|
|||||||
static void SetUpTestCase() {
|
static void SetUpTestCase() {
|
||||||
static std::uint64_t idx{};
|
static std::uint64_t idx{};
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ protected:
|
|||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
file_mgr_db.reset();
|
file_mgr_db.reset();
|
||||||
config.reset();
|
config.reset();
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "db/impl/rdb_meta_db.hpp"
|
#include "db/impl/rdb_meta_db.hpp"
|
||||||
#include "db/impl/sqlite_meta_db.hpp"
|
#include "db/impl/sqlite_meta_db.hpp"
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
template <typename db_t> class meta_db_test : public ::testing::Test {
|
template <typename db_t> class meta_db_test : public ::testing::Test {
|
||||||
@ -41,7 +41,7 @@ protected:
|
|||||||
static void SetUpTestCase() {
|
static void SetUpTestCase() {
|
||||||
static std::uint64_t idx{};
|
static std::uint64_t idx{};
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ protected:
|
|||||||
static void TearDownTestCase() {
|
static void TearDownTestCase() {
|
||||||
meta_db.reset();
|
meta_db.reset();
|
||||||
config.reset();
|
config.reset();
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ REPERTORY_IGNORE_WARNINGS_ENABLE()
|
|||||||
REPERTORY_IGNORE_WARNINGS_DISABLE()
|
REPERTORY_IGNORE_WARNINGS_DISABLE()
|
||||||
|
|
||||||
#include "events/consumers/console_consumer.hpp"
|
#include "events/consumers/console_consumer.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "events/i_event.hpp"
|
#include "events/i_event.hpp"
|
||||||
|
|
||||||
#endif // REPERTORY_TEST_INCLUDE_TEST_COMMON_HPP_
|
#endif // REPERTORY_TEST_INCLUDE_TEST_COMMON_HPP_
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "test_common.hpp"
|
#include "test_common.hpp"
|
||||||
|
|
||||||
#include "app_config.hpp"
|
#include "app_config.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "utils/common.hpp"
|
#include "utils/common.hpp"
|
||||||
#include "utils/file_utils.hpp"
|
#include "utils/file_utils.hpp"
|
||||||
#include "utils/path.hpp"
|
#include "utils/path.hpp"
|
||||||
@ -51,11 +51,11 @@ public:
|
|||||||
"sia",
|
"sia",
|
||||||
std::to_string(++idx),
|
std::to_string(++idx),
|
||||||
});
|
});
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
file_manager_dir = repertory::utils::path::combine(
|
file_manager_dir = repertory::utils::path::combine(
|
||||||
repertory::test::get_test_output_dir(),
|
repertory::test::get_test_output_dir(),
|
||||||
@ -80,7 +80,7 @@ protected:
|
|||||||
cache_size_mgr::instance().initialize(cfg.get());
|
cache_size_mgr::instance().initialize(cfg.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override { event_system2::instance().stop(); }
|
void TearDown() override { event_system::instance().stop(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
std::atomic<std::size_t> file_manager_test::inst{0U};
|
std::atomic<std::size_t> file_manager_test::inst{0U};
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
auto open_file_dir = repertory::utils::path::combine(
|
auto open_file_dir = repertory::utils::path::combine(
|
||||||
repertory::test::get_test_output_dir(),
|
repertory::test::get_test_output_dir(),
|
||||||
@ -60,7 +60,7 @@ protected:
|
|||||||
cache_size_mgr::instance().initialize(cfg.get());
|
cache_size_mgr::instance().initialize(cfg.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override { event_system2::instance().stop(); }
|
void TearDown() override { event_system::instance().stop(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
std::atomic<std::size_t> open_file_test::inst{0U};
|
std::atomic<std::size_t> open_file_test::inst{0U};
|
||||||
@ -593,7 +593,7 @@ TEST_F(open_file_test, resize_file_by_full_chunk) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(open_file_test, can_add_handle) {
|
TEST_F(open_file_test, can_add_handle) {
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
console_consumer c;
|
console_consumer c;
|
||||||
const auto source_path =
|
const auto source_path =
|
||||||
test::generate_test_file_name("file_manager_open_file_test");
|
test::generate_test_file_name("file_manager_open_file_test");
|
||||||
@ -646,13 +646,13 @@ TEST_F(open_file_test, can_add_handle) {
|
|||||||
|
|
||||||
capture.wait_for_empty();
|
capture.wait_for_empty();
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(open_file_test, can_remove_handle) {
|
TEST_F(open_file_test, can_remove_handle) {
|
||||||
console_consumer c;
|
console_consumer c;
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
const auto source_path =
|
const auto source_path =
|
||||||
test::generate_test_file_name("file_manager_open_file_test");
|
test::generate_test_file_name("file_manager_open_file_test");
|
||||||
@ -706,7 +706,7 @@ TEST_F(open_file_test, can_remove_handle) {
|
|||||||
|
|
||||||
capture.wait_for_empty();
|
capture.wait_for_empty();
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(open_file_test,
|
TEST_F(open_file_test,
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "test_common.hpp"
|
#include "test_common.hpp"
|
||||||
|
|
||||||
#include "comm/curl/curl_comm.hpp"
|
#include "comm/curl/curl_comm.hpp"
|
||||||
#include "events/event_system2.hpp"
|
#include "events/event_system.hpp"
|
||||||
#include "file_manager/file_manager.hpp"
|
#include "file_manager/file_manager.hpp"
|
||||||
#include "platform/platform.hpp"
|
#include "platform/platform.hpp"
|
||||||
#include "providers/encrypt/encrypt_provider.hpp"
|
#include "providers/encrypt/encrypt_provider.hpp"
|
||||||
@ -634,7 +634,7 @@ TEST(providers, encrypt_provider) {
|
|||||||
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
{
|
{
|
||||||
app_config cfg(provider_type::encrypt, config_path);
|
app_config cfg(provider_type::encrypt, config_path);
|
||||||
@ -670,7 +670,7 @@ TEST(providers, encrypt_provider) {
|
|||||||
mgr.stop();
|
mgr.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(providers, s3_provider) {
|
TEST(providers, s3_provider) {
|
||||||
@ -678,7 +678,7 @@ TEST(providers, s3_provider) {
|
|||||||
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
{
|
{
|
||||||
app_config cfg(provider_type::s3, config_path);
|
app_config cfg(provider_type::s3, config_path);
|
||||||
@ -710,7 +710,7 @@ TEST(providers, s3_provider) {
|
|||||||
mgr.stop();
|
mgr.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(providers, sia_provider) {
|
TEST(providers, sia_provider) {
|
||||||
@ -718,7 +718,7 @@ TEST(providers, sia_provider) {
|
|||||||
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
|
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
|
||||||
|
|
||||||
console_consumer consumer{};
|
console_consumer consumer{};
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
{
|
{
|
||||||
app_config cfg(provider_type::sia, config_path);
|
app_config cfg(provider_type::sia, config_path);
|
||||||
@ -750,7 +750,7 @@ TEST(providers, sia_provider) {
|
|||||||
mgr.stop();
|
mgr.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TearDown() override {
|
void TearDown() override {
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ static constexpr const std::size_t test_chunk_size{1024U};
|
|||||||
TEST(upload, can_upload_a_valid_file) {
|
TEST(upload, can_upload_a_valid_file) {
|
||||||
console_consumer con;
|
console_consumer con;
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
const auto source_path = test::generate_test_file_name("upload_test");
|
const auto source_path = test::generate_test_file_name("upload_test");
|
||||||
|
|
||||||
@ -68,13 +68,13 @@ TEST(upload, can_upload_a_valid_file) {
|
|||||||
EXPECT_EQ(api_error::success, upload.get_api_error());
|
EXPECT_EQ(api_error::success, upload.get_api_error());
|
||||||
EXPECT_FALSE(upload.is_cancelled());
|
EXPECT_FALSE(upload.is_cancelled());
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(upload, can_cancel_upload) {
|
TEST(upload, can_cancel_upload) {
|
||||||
console_consumer con;
|
console_consumer con;
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
const auto source_path = test::generate_test_file_name("upload_test");
|
const auto source_path = test::generate_test_file_name("upload_test");
|
||||||
|
|
||||||
@ -132,13 +132,13 @@ TEST(upload, can_cancel_upload) {
|
|||||||
EXPECT_EQ(api_error::comm_error, upload.get_api_error());
|
EXPECT_EQ(api_error::comm_error, upload.get_api_error());
|
||||||
EXPECT_TRUE(upload.is_cancelled());
|
EXPECT_TRUE(upload.is_cancelled());
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(upload, can_stop_upload) {
|
TEST(upload, can_stop_upload) {
|
||||||
console_consumer con;
|
console_consumer con;
|
||||||
|
|
||||||
event_system2::instance().start();
|
event_system::instance().start();
|
||||||
|
|
||||||
const auto source_path = test::generate_test_file_name("upload_test");
|
const auto source_path = test::generate_test_file_name("upload_test");
|
||||||
|
|
||||||
@ -176,6 +176,6 @@ TEST(upload, can_stop_upload) {
|
|||||||
|
|
||||||
evt_cap.wait_for_empty();
|
evt_cap.wait_for_empty();
|
||||||
|
|
||||||
event_system2::instance().stop();
|
event_system::instance().stop();
|
||||||
}
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
Reference in New Issue
Block a user