Skip to content
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

Improve plugin loader #1424

Closed
wants to merge 3 commits into from
Closed

Conversation

nathanielhourt
Copy link
Contributor

@nathanielhourt nathanielhourt commented Nov 9, 2018

This PR adds the ability for client code of the application class to request plugins be loaded automatically when it registers them. I don't know if upstream bitshares will want this or not, but here's a PR just in case!

While this PR is mostly a clean-up/correctness fix (the old conflict detection between the account_history and elasticsearch plugins was clumsy and would false-positive if either plugin showed up twice in the list), it does add the rather obvious functionality that the witness_node should auto-load the witness_plugin even if the config doesn't explicitly mention it.

Please note that this PR does remove the hard-coded list of "wanted" plugins, as this shortcut is annoying to third party code, like that of Follow My Vote, which may not want to be cluttered up by having those plugins linked in. This may cause mild turbulence to existing environments which depend on this shortcut. #sorrynotsorry =) This turbulence can be avoided by calling register_plugin(true) for the desired auto-load plugins, however, doing so will prevent disabling these plugins from the config.

As far as I can tell, there was no way previously for an application
to register a plugin and ensure that plugin got loaded -- it would
be necessary to manually edit the config and specify the plugin be
loaded.

This is suboptimal; if third party code wishes to track third party
extensions on the blockchain, the correct way to do this is with a
plugin, and this third party build should be able to load these
required plugins regardless of whether the config lists them or not.

This commit adds a boolean parameter to application::register_plugin
which defaults to false for backwards compatibility; however, if
set to true, the plugin will automatically be enabled when the app
initializes.
That code was nasty and... kinda wrong. So fix it up all shiny-like.

But I also removed the super annoying default "wanted" plugins list,
which only causes problems for third parties like me, and in general is
just poor form. In my opinion, 5220425
provides a much cleaner way to do this, in a way that is friendly rather
than hostile to third parties.

Would Be Nice: A generalized plugin conflict system added at the
abstract_plugin level, so, for example, the elasticsearch plugin can
conflict account_history and we deal with this in a general fashion
rather than having this dirty special case check here.
@oxarbitrage
Copy link
Member

Need to send pull requests to develop branch. This will be merged to master in the next release.

I think we will want it, or at least consider it, thank you for sending.

I am unsure about the witness_plugin should be auto loaded, API nodes, Elasticsearch nodes, etc do not require it.

@nathanielhourt
Copy link
Contributor Author

Replacing...

@oxarbitrage
Copy link
Member

thanks, you saved me some work there :)

@nathanielhourt nathanielhourt deleted the patch-1 branch November 12, 2018 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants