Browse code

Add a GetAll function that returns only managed plugins supported by V2

The current GetAll handles both V2 and legacy plugins. Also due to the
nature of V1 plugins, it also loads them. This causes problems when
loading is not required. Hence adding an independent API that will
return only the plugins that are loaded using v2 mangaed plugins.

Signed-off-by: Madhu Venugopal <madhu@docker.com>

Madhu Venugopal authored on 2016/12/23 03:26:04
Showing 2 changed files
... ...
@@ -30,5 +30,6 @@ type CountedPlugin interface {
30 30
 type PluginGetter interface {
31 31
 	Get(name, capability string, mode int) (CompatPlugin, error)
32 32
 	GetAllByCap(capability string) ([]CompatPlugin, error)
33
+	GetAllManagedPluginsByCap(capability string) []CompatPlugin
33 34
 	Handle(capability string, callback func(string, *plugins.Client))
34 35
 }
... ...
@@ -157,6 +157,11 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug
157 157
 	return nil, err
158 158
 }
159 159
 
160
+// GetAllManagedPluginsByCap returns a list of managed plugins matching the given capability.
161
+func (ps *Store) GetAllManagedPluginsByCap(capability string) []plugingetter.CompatPlugin {
162
+	return ps.getAllByCap(capability)
163
+}
164
+
160 165
 // GetAllByCap returns a list of enabled plugins matching the given capability.
161 166
 func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
162 167
 	result := make([]plugingetter.CompatPlugin, 0, 1)