-
Notifications
You must be signed in to change notification settings - Fork 178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(1059): adding explicit plugin id in PluginStatus and PluginManager #1060
Conversation
Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
FYI: I see too many unwraps in the |
Signed-off-by: gabrik <[email protected]>
…e it Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
…rations Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
Note: Lint is failing on a file that has not been touched by the PR. |
Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
Signed-off-by: gabrik <[email protected]>
The PR looks good to me. |
I'm opening the sister PRs and tagging people for review, the ones not to be merged are going to be closed. |
Once the sisters are approved then I'm going to merge everything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will work ok, but later some refactoring is needed I think, as the name
became mostly unnecessary.
The parameters of methods should be renamed (name
-> id
)
commons/zenoh-config/src/lib.rs
Outdated
@@ -1021,6 +1021,7 @@ fn load_external_plugin_config(title: &str, value: &mut Value) -> ZResult<()> { | |||
#[derive(Debug, Clone)] | |||
pub struct PluginLoad { | |||
pub name: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, name
and paths
have the same purpose: it's a information for loader where to look for corresponding plugin DLL. Probably the name
should near the paths
and be optional also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the way it is done now it is already Optional
in the configuration as the user needs to specify __plugin__
to specify the name, if not specified the id
is used also as name
.
Thus current configurations of zenoh will continue to work.
@@ -60,6 +62,11 @@ impl<StartArgs: PluginStartArgs, Instance: PluginInstance> PluginStatus | |||
fn name(&self) -> &str { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that after this update we need this name
getter at all. If plugin is dynamic, the path()
getter gives us full information where this plugin came from. If it's static, name and id is the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The former is true, while not the latter, the user can statically link the plugin once, but instantiate it multiple times with different IDs, thus the name will be the same but the IDs will be different
Signed-off-by: Gabriele Baldoni <[email protected]>
This PR adds the
id()
method to thePluginStatus
trait and allows passing it as a parameter in thePluginManager
when dynamic loading or statically linking a plugin.It exposes plugins in the admin space via their ID (see below what the ID is), and allows multiple instances of the same plugin with different configurations, essential for backends, and useful for other plugins.
Changes to configuration:
Sister PRs:
Sister PRs for testing, do not need a merge.
Closes #1059