refactor event system

This commit is contained in:
Scott E. Graves 2025-01-23 14:58:24 -06:00
parent e8ef11cef4
commit 7309ca477a
14 changed files with 0 additions and 40 deletions

View File

@ -580,7 +580,6 @@ void *fuse_drive::init_impl(struct fuse_conn_info *conn) {
logging_consumer_ = std::make_unique<logging_consumer>(
config_.get_event_level(), config_.get_log_directory());
event_system::instance().start();
event_system2::instance().start();
was_mounted_ = true;
@ -668,7 +667,6 @@ void fuse_drive::notify_fuse_main_exit(int &ret) {
if (was_mounted_) {
event_system2::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret));
event_system::instance().stop();
event_system2::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();

View File

@ -246,7 +246,6 @@ auto remote_fuse_drive::init_impl(struct fuse_conn_info *conn) -> void * {
}
logging_consumer_ = std::make_shared<logging_consumer>(
config_.get_event_level(), config_.get_log_directory());
event_system::instance().start();
event_system2::instance().start();
if (not lock_data_.set_mount_state(true, get_mount_location(), getpid())) {
@ -282,7 +281,6 @@ void remote_fuse_drive::notify_fuse_main_exit(int &ret) {
if (was_mounted_) {
event_system2::instance().raise<drive_mount_result>(
function_name, get_mount_location(), std::to_string(ret));
event_system::instance().stop();
event_system2::instance().stop();
logging_consumer_.reset();
console_consumer_.reset();

View File

@ -257,14 +257,12 @@ auto remote_winfsp_drive::mount(const std::vector<std::string> &drive_args)
if (enable_console) {
c = std::make_unique<console_consumer>(config_.get_event_level());
}
event_system::instance().start();
event_system2::instance().start();
auto ret = winfsp_service(lock_, *this, parsed_drive_args, config_).Run();
event_system2::instance().raise<drive_mount_result>(function_name, "",
std::to_string(ret));
event_system::instance().stop();
event_system2::instance().stop();
c.reset();
return static_cast<int>(ret);

View File

@ -627,7 +627,6 @@ auto winfsp_drive::mount(const std::vector<std::string> &drive_args) -> int {
cons = std::make_unique<console_consumer>(config_.get_event_level());
}
event_system::instance().start();
event_system2::instance().start();
auto svc = winfsp_service(lock_, *this, parsed_drive_args, config_);
@ -635,7 +634,6 @@ auto winfsp_drive::mount(const std::vector<std::string> &drive_args) -> int {
event_system2::instance().raise<drive_mount_result>(function_name, "",
std::to_string(ret));
event_system::instance().stop();
event_system2::instance().stop();
cons.reset();

View File

@ -41,7 +41,6 @@ protected:
static void SetUpTestCase() {
static std::uint64_t idx{};
event_system::instance().start();
event_system2::instance().start();
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
@ -56,7 +55,6 @@ protected:
static void TearDownTestCase() {
file_db.reset();
config.reset();
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -41,7 +41,6 @@ protected:
static void SetUpTestCase() {
static std::uint64_t idx{};
event_system::instance().start();
event_system2::instance().start();
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
@ -56,7 +55,6 @@ protected:
static void TearDownTestCase() {
file_mgr_db.reset();
config.reset();
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -41,7 +41,6 @@ protected:
static void SetUpTestCase() {
static std::uint64_t idx{};
event_system::instance().start();
event_system2::instance().start();
auto cfg_directory = utils::path::combine(test::get_test_output_dir(),
@ -56,7 +55,6 @@ protected:
static void TearDownTestCase() {
meta_db.reset();
config.reset();
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -51,12 +51,10 @@ public:
"sia",
std::to_string(++idx),
});
event_system::instance().start();
event_system2::instance().start();
}
void TearDown() override {
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -36,12 +36,10 @@ public:
protected:
void SetUp() override {
event_system::instance().start();
event_system2::instance().start();
}
void TearDown() override {
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -63,7 +63,6 @@ public:
protected:
void SetUp() override {
event_system::instance().start();
event_system2::instance().start();
file_manager_dir = repertory::utils::path::combine(
@ -77,7 +76,6 @@ protected:
}
void TearDown() override {
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -45,7 +45,6 @@ public:
protected:
void SetUp() override {
event_system::instance().start();
event_system2::instance().start();
auto open_file_dir = repertory::utils::path::combine(
@ -58,7 +57,6 @@ protected:
}
void TearDown() override {
event_system::instance().stop();
event_system2::instance().stop();
}
};
@ -593,7 +591,6 @@ TEST_F(open_file_test, resize_file_by_full_chunk) {
}
TEST_F(open_file_test, can_add_handle) {
event_system::instance().start();
event_system2::instance().start();
console_consumer c;
const auto source_path =
@ -648,14 +645,12 @@ TEST_F(open_file_test, can_add_handle) {
capture.wait_for_empty();
event_system::instance().stop();
event_system2::instance().stop();
}
TEST_F(open_file_test, can_remove_handle) {
console_consumer c;
event_system::instance().start();
event_system2::instance().start();
const auto source_path =
@ -713,7 +708,6 @@ TEST_F(open_file_test, can_remove_handle) {
capture.wait_for_empty();
event_system::instance().stop();
event_system2::instance().stop();
}

View File

@ -634,7 +634,6 @@ TEST(providers, encrypt_provider) {
utils::path::combine(test::get_test_output_dir(), {"encrypt_provider"});
console_consumer consumer{};
event_system::instance().start();
event_system2::instance().start();
{
@ -671,7 +670,6 @@ TEST(providers, encrypt_provider) {
mgr.stop();
}
event_system::instance().stop();
event_system2::instance().stop();
}
@ -680,7 +678,6 @@ TEST(providers, s3_provider) {
utils::path::combine(test::get_test_output_dir(), {"s3_provider"});
console_consumer consumer{};
event_system::instance().start();
event_system2::instance().start();
{
@ -713,7 +710,6 @@ TEST(providers, s3_provider) {
mgr.stop();
}
event_system::instance().stop();
event_system2::instance().stop();
}
@ -722,7 +718,6 @@ TEST(providers, sia_provider) {
utils::path::combine(test::get_test_output_dir(), {"sia_provider"});
console_consumer consumer{};
event_system::instance().start();
event_system2::instance().start();
{
@ -755,7 +750,6 @@ TEST(providers, sia_provider) {
mgr.stop();
}
event_system::instance().stop();
event_system2::instance().stop();
}
} // namespace repertory

View File

@ -46,12 +46,10 @@ public:
protected:
void SetUp() override {
event_system::instance().start();
event_system2::instance().start();
}
void TearDown() override {
event_system::instance().stop();
event_system2::instance().stop();
}
};

View File

@ -31,7 +31,6 @@ static constexpr const std::size_t test_chunk_size{1024U};
TEST(upload, can_upload_a_valid_file) {
console_consumer con;
event_system::instance().start();
event_system2::instance().start();
const auto source_path = test::generate_test_file_name("upload_test");
@ -69,14 +68,12 @@ TEST(upload, can_upload_a_valid_file) {
EXPECT_EQ(api_error::success, upload.get_api_error());
EXPECT_FALSE(upload.is_cancelled());
event_system::instance().stop();
event_system2::instance().stop();
}
TEST(upload, can_cancel_upload) {
console_consumer con;
event_system::instance().start();
event_system2::instance().start();
const auto source_path = test::generate_test_file_name("upload_test");
@ -137,14 +134,12 @@ TEST(upload, can_cancel_upload) {
EXPECT_EQ(api_error::comm_error, upload.get_api_error());
EXPECT_TRUE(upload.is_cancelled());
event_system::instance().stop();
event_system2::instance().stop();
}
TEST(upload, can_stop_upload) {
console_consumer con;
event_system::instance().start();
event_system2::instance().start();
const auto source_path = test::generate_test_file_name("upload_test");
@ -184,7 +179,6 @@ TEST(upload, can_stop_upload) {
evt_cap.wait_for_empty();
event_system::instance().stop();
event_system2::instance().stop();
}
} // namespace repertory