From 5a0828330ded7fc4d8e41227f48678d783b808d0 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Tue, 14 Nov 2023 22:34:19 -0500 Subject: [PATCH] geyser: add `is_reload` argument to `on_load` (#33674) geyser: add `is_reload` argument to `on_load` --- geyser-plugin-interface/src/geyser_plugin_interface.rs | 2 +- geyser-plugin-manager/src/geyser_plugin_manager.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/geyser-plugin-interface/src/geyser_plugin_interface.rs b/geyser-plugin-interface/src/geyser_plugin_interface.rs index 8cfea4c76..43c31f749 100644 --- a/geyser-plugin-interface/src/geyser_plugin_interface.rs +++ b/geyser-plugin-interface/src/geyser_plugin_interface.rs @@ -329,7 +329,7 @@ pub trait GeyserPlugin: Any + Send + Sync + std::fmt::Debug { /// of the config file. The config must be in JSON format and /// include a field "libpath" indicating the full path /// name of the shared library implementing this interface. - fn on_load(&mut self, _config_file: &str) -> Result<()> { + fn on_load(&mut self, _config_file: &str, _is_reload: bool) -> Result<()> { Ok(()) } diff --git a/geyser-plugin-manager/src/geyser_plugin_manager.rs b/geyser-plugin-manager/src/geyser_plugin_manager.rs index 207291467..f43fc5e79 100644 --- a/geyser-plugin-manager/src/geyser_plugin_manager.rs +++ b/geyser-plugin-manager/src/geyser_plugin_manager.rs @@ -109,7 +109,7 @@ impl GeyserPluginManager { // Call on_load and push plugin new_plugin - .on_load(new_config_file) + .on_load(new_config_file, false) .map_err(|on_load_err| jsonrpc_core::Error { code: ErrorCode::InvalidRequest, message: format!( @@ -194,7 +194,7 @@ impl GeyserPluginManager { } // Attempt to on_load with new plugin - match new_plugin.on_load(new_parsed_config_file) { + match new_plugin.on_load(new_parsed_config_file, true) { // On success, push plugin and library Ok(()) => { self.plugins.push(new_plugin); @@ -430,7 +430,7 @@ mod tests { // Mock having loaded plugin (TestPlugin) let (mut plugin, lib, config) = dummy_plugin_and_library(TestPlugin, DUMMY_CONFIG); - plugin.on_load(config).unwrap(); + plugin.on_load(config, false).unwrap(); plugin_manager_lock.plugins.push(plugin); plugin_manager_lock.libs.push(lib); // plugin_manager_lock.libs.push(lib); @@ -465,12 +465,12 @@ mod tests { // Load two plugins // First let (mut plugin, lib, config) = dummy_plugin_and_library(TestPlugin, TESTPLUGIN_CONFIG); - plugin.on_load(config).unwrap(); + plugin.on_load(config, false).unwrap(); plugin_manager_lock.plugins.push(plugin); plugin_manager_lock.libs.push(lib); // Second let (mut plugin, lib, config) = dummy_plugin_and_library(TestPlugin2, TESTPLUGIN2_CONFIG); - plugin.on_load(config).unwrap(); + plugin.on_load(config, false).unwrap(); plugin_manager_lock.plugins.push(plugin); plugin_manager_lock.libs.push(lib);