plugingetter is indepedent of docker/docker packages, so it can be
moved to pkg. This is also necessary for authorization plugins (part of
pkg) to use pluginv2. The original path at plugin/getter will be
eventually removed, when external repos (eg. libnetwork) update their
import paths.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,26 @@ |
| 0 |
+package plugingetter |
|
| 1 |
+ |
|
| 2 |
+import "github.com/docker/docker/pkg/plugins" |
|
| 3 |
+ |
|
| 4 |
+const ( |
|
| 5 |
+ // LOOKUP doesn't update RefCount |
|
| 6 |
+ LOOKUP = 0 |
|
| 7 |
+ // CREATE increments RefCount |
|
| 8 |
+ CREATE = 1 |
|
| 9 |
+ // REMOVE decrements RefCount |
|
| 10 |
+ REMOVE = -1 |
|
| 11 |
+) |
|
| 12 |
+ |
|
| 13 |
+// CompatPlugin is a abstraction to handle both v2(new) and v1(legacy) plugins. |
|
| 14 |
+type CompatPlugin interface {
|
|
| 15 |
+ Client() *plugins.Client |
|
| 16 |
+ Name() string |
|
| 17 |
+ IsV1() bool |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 20 |
+// PluginGetter is the interface implemented by Store |
|
| 21 |
+type PluginGetter interface {
|
|
| 22 |
+ Get(name, capability string, mode int) (CompatPlugin, error) |
|
| 23 |
+ GetAllByCap(capability string) ([]CompatPlugin, error) |
|
| 24 |
+ Handle(capability string, callback func(string, *plugins.Client)) |
|
| 25 |
+} |