You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: