Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Provide Init() once func behavior needed by plugins requiring initialization #79

Open
IzabellaRaulin opened this issue Apr 12, 2017 · 0 comments

Comments

@IzabellaRaulin
Copy link
Contributor

IzabellaRaulin commented Apr 12, 2017

Some plugins require initialization based on params passed in configuration, so they usually have func init() which should be executed only once.

It would be nice to have a support from plugin-lib side to provide Once func behavior ready to use.

The idea is to provide Init(cfg plugin.ConfigType) for plugins to make easier implementation of some kind of initialization for plugins which require that.

Init() should be optional;
a) to keep compatibility with existing plugins - they should still work even they do not call Init()
b) some plugins do not require initialization, so there is no sense to call Init for them.

As a result, plugin developer might use ready-to-use Init() available in snap-plugin-lib-go instead of implement own function and provide mechanism to assure that its execution happens only once.

snap-plugin-lib-go seems to be the best candidate to provide such enhancement as the first one of existing snap-plugin-libs because most of available plugins are written in Go.

Adding this enhancement to the rest of libs (snap-plugin-lip-cpp and snap-plugin-lib-py) can be done later as the next steps depending on request or interest of having that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants