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
 }
... ...
@@ -206,6 +206,11 @@ func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlug
206 206
 	return nil, err
207 207
 }
208 208
 
209
+// GetAllManagedPluginsByCap returns a list of managed plugins matching the given capability.
210
+func (ps *Store) GetAllManagedPluginsByCap(capability string) []plugingetter.CompatPlugin {
211
+	return ps.getAllByCap(capability)
212
+}
213
+
209 214
 // GetAllByCap returns a list of enabled plugins matching the given capability.
210 215
 func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
211 216
 	result := make([]plugingetter.CompatPlugin, 0, 1)