Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

geyser: add is_reload argument to on_load #33674

Merged
merged 4 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geyser-plugin-interface/src/geyser_plugin_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

Expand Down
10 changes: 5 additions & 5 deletions geyser-plugin-manager/src/geyser_plugin_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down