Signed-off-by: Anusha Ragunathan <anusha@docker.com>
| ... | ... |
@@ -40,6 +40,7 @@ import ( |
| 40 | 40 |
"github.com/docker/docker/pkg/fileutils" |
| 41 | 41 |
"github.com/docker/docker/pkg/graphdb" |
| 42 | 42 |
"github.com/docker/docker/pkg/idtools" |
| 43 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 43 | 44 |
"github.com/docker/docker/pkg/progress" |
| 44 | 45 |
"github.com/docker/docker/pkg/registrar" |
| 45 | 46 |
"github.com/docker/docker/pkg/signal" |
| ... | ... |
@@ -47,7 +48,6 @@ import ( |
| 47 | 47 |
"github.com/docker/docker/pkg/sysinfo" |
| 48 | 48 |
"github.com/docker/docker/pkg/system" |
| 49 | 49 |
"github.com/docker/docker/pkg/truncindex" |
| 50 |
- plugingetter "github.com/docker/docker/plugin/getter" |
|
| 51 | 50 |
pluginstore "github.com/docker/docker/plugin/store" |
| 52 | 51 |
"github.com/docker/docker/reference" |
| 53 | 52 |
"github.com/docker/docker/registry" |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
|
| 13 | 13 |
"github.com/docker/docker/pkg/archive" |
| 14 | 14 |
"github.com/docker/docker/pkg/idtools" |
| 15 |
- "github.com/docker/docker/plugin/getter" |
|
| 15 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 16 | 16 |
) |
| 17 | 17 |
|
| 18 | 18 |
// FsMagic unsigned id of the filesystem in use. |
| ... | ... |
@@ -135,11 +135,11 @@ func Register(name string, initFunc InitFunc) error {
|
| 135 | 135 |
} |
| 136 | 136 |
|
| 137 | 137 |
// GetDriver initializes and returns the registered driver |
| 138 |
-func GetDriver(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap, plugingetter getter.PluginGetter) (Driver, error) {
|
|
| 138 |
+func GetDriver(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap, pg plugingetter.PluginGetter) (Driver, error) {
|
|
| 139 | 139 |
if initFunc, exists := drivers[name]; exists {
|
| 140 | 140 |
return initFunc(filepath.Join(home, name), options, uidMaps, gidMaps) |
| 141 | 141 |
} |
| 142 |
- if pluginDriver, err := lookupPlugin(name, home, options, plugingetter); err == nil {
|
|
| 142 |
+ if pluginDriver, err := lookupPlugin(name, home, options, pg); err == nil {
|
|
| 143 | 143 |
return pluginDriver, nil |
| 144 | 144 |
} |
| 145 | 145 |
logrus.Errorf("Failed to GetDriver graph %s %s", name, home)
|
| ... | ... |
@@ -156,10 +156,10 @@ func getBuiltinDriver(name, home string, options []string, uidMaps, gidMaps []id |
| 156 | 156 |
} |
| 157 | 157 |
|
| 158 | 158 |
// New creates the driver and initializes it at the specified root. |
| 159 |
-func New(root string, name string, options []string, uidMaps, gidMaps []idtools.IDMap, plugingetter getter.PluginGetter) (Driver, error) {
|
|
| 159 |
+func New(root string, name string, options []string, uidMaps, gidMaps []idtools.IDMap, pg plugingetter.PluginGetter) (Driver, error) {
|
|
| 160 | 160 |
if name != "" {
|
| 161 | 161 |
logrus.Debugf("[graphdriver] trying provided driver: %s", name) // so the logs show specified driver
|
| 162 |
- return GetDriver(name, root, options, uidMaps, gidMaps, plugingetter) |
|
| 162 |
+ return GetDriver(name, root, options, uidMaps, gidMaps, pg) |
|
| 163 | 163 |
} |
| 164 | 164 |
|
| 165 | 165 |
// Guess for prior driver |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"fmt" |
| 7 | 7 |
"io" |
| 8 | 8 |
|
| 9 |
- "github.com/docker/docker/plugin/getter" |
|
| 9 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
type pluginClient interface {
|
| ... | ... |
@@ -18,8 +18,8 @@ type pluginClient interface {
|
| 18 | 18 |
SendFile(string, io.Reader, interface{}) error
|
| 19 | 19 |
} |
| 20 | 20 |
|
| 21 |
-func lookupPlugin(name, home string, opts []string, pluginGetter getter.PluginGetter) (Driver, error) {
|
|
| 22 |
- pl, err := pluginGetter.Get(name, "GraphDriver", getter.LOOKUP) |
|
| 21 |
+func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter) (Driver, error) {
|
|
| 22 |
+ pl, err := pg.Get(name, "GraphDriver", plugingetter.LOOKUP) |
|
| 23 | 23 |
if err != nil {
|
| 24 | 24 |
return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
|
| 25 | 25 |
} |
| ... | ... |
@@ -2,8 +2,8 @@ |
| 2 | 2 |
|
| 3 | 3 |
package graphdriver |
| 4 | 4 |
|
| 5 |
-import "github.com/docker/docker/plugin/getter" |
|
| 5 |
+import "github.com/docker/docker/pkg/plugingetter" |
|
| 6 | 6 |
|
| 7 |
-func lookupPlugin(name, home string, opts []string, plugingetter getter.PluginGetter) (Driver, error) {
|
|
| 7 |
+func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter) (Driver, error) {
|
|
| 8 | 8 |
return nil, ErrNotSupported |
| 9 | 9 |
} |
| ... | ... |
@@ -13,8 +13,8 @@ import ( |
| 13 | 13 |
"github.com/docker/docker/daemon/graphdriver" |
| 14 | 14 |
"github.com/docker/docker/pkg/archive" |
| 15 | 15 |
"github.com/docker/docker/pkg/idtools" |
| 16 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 16 | 17 |
"github.com/docker/docker/pkg/stringid" |
| 17 |
- "github.com/docker/docker/plugin/getter" |
|
| 18 | 18 |
"github.com/vbatts/tar-split/tar/asm" |
| 19 | 19 |
"github.com/vbatts/tar-split/tar/storage" |
| 20 | 20 |
) |
| ... | ... |
@@ -45,7 +45,7 @@ type StoreOptions struct {
|
| 45 | 45 |
GraphDriverOptions []string |
| 46 | 46 |
UIDMaps []idtools.IDMap |
| 47 | 47 |
GIDMaps []idtools.IDMap |
| 48 |
- PluginGetter getter.PluginGetter |
|
| 48 |
+ PluginGetter plugingetter.PluginGetter |
|
| 49 | 49 |
} |
| 50 | 50 |
|
| 51 | 51 |
// NewStoreFromOptions creates a new Store instance |
| 52 | 52 |
deleted file mode 100644 |
| ... | ... |
@@ -1,26 +0,0 @@ |
| 1 |
-package getter |
|
| 2 |
- |
|
| 3 |
-import "github.com/docker/docker/pkg/plugins" |
|
| 4 |
- |
|
| 5 |
-const ( |
|
| 6 |
- // LOOKUP doesn't update RefCount |
|
| 7 |
- LOOKUP = 0 |
|
| 8 |
- // CREATE increments RefCount |
|
| 9 |
- CREATE = 1 |
|
| 10 |
- // REMOVE decrements RefCount |
|
| 11 |
- REMOVE = -1 |
|
| 12 |
-) |
|
| 13 |
- |
|
| 14 |
-// CompatPlugin is a abstraction to handle both v2(new) and v1(legacy) plugins. |
|
| 15 |
-type CompatPlugin interface {
|
|
| 16 |
- Client() *plugins.Client |
|
| 17 |
- Name() string |
|
| 18 |
- IsV1() bool |
|
| 19 |
-} |
|
| 20 |
- |
|
| 21 |
-// PluginGetter is the interface implemented by Store |
|
| 22 |
-type PluginGetter interface {
|
|
| 23 |
- Get(name, capability string, mode int) (CompatPlugin, error) |
|
| 24 |
- GetAllByCap(capability string) ([]CompatPlugin, error) |
|
| 25 |
- Handle(capability string, callback func(string, *plugins.Client)) |
|
| 26 |
-} |
| ... | ... |
@@ -3,17 +3,17 @@ |
| 3 | 3 |
package store |
| 4 | 4 |
|
| 5 | 5 |
import ( |
| 6 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 6 | 7 |
"github.com/docker/docker/pkg/plugins" |
| 7 |
- "github.com/docker/docker/plugin/getter" |
|
| 8 | 8 |
) |
| 9 | 9 |
|
| 10 | 10 |
// GetAllByCap returns a list of plugins matching the given capability. |
| 11 |
-func (ps Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
|
|
| 11 |
+func (ps Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
|
|
| 12 | 12 |
pl, err := plugins.GetAll(capability) |
| 13 | 13 |
if err != nil {
|
| 14 | 14 |
return nil, err |
| 15 | 15 |
} |
| 16 |
- result := make([]getter.CompatPlugin, len(pl)) |
|
| 16 |
+ result := make([]plugingetter.CompatPlugin, len(pl)) |
|
| 17 | 17 |
for i, p := range pl {
|
| 18 | 18 |
result[i] = p |
| 19 | 19 |
} |
| ... | ... |
@@ -21,7 +21,7 @@ func (ps Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 | 23 |
// Get returns a plugin matching the given name and capability. |
| 24 |
-func (ps Store) Get(name, capability string, _ int) (getter.CompatPlugin, error) {
|
|
| 24 |
+func (ps Store) Get(name, capability string, _ int) (plugingetter.CompatPlugin, error) {
|
|
| 25 | 25 |
return plugins.Get(name, capability) |
| 26 | 26 |
} |
| 27 | 27 |
|
| ... | ... |
@@ -9,8 +9,8 @@ import ( |
| 9 | 9 |
|
| 10 | 10 |
"github.com/Sirupsen/logrus" |
| 11 | 11 |
"github.com/docker/docker/pkg/ioutils" |
| 12 |
+ "github.com/docker/docker/pkg/plugingetter" |
|
| 12 | 13 |
"github.com/docker/docker/pkg/plugins" |
| 13 |
- "github.com/docker/docker/plugin/getter" |
|
| 14 | 14 |
"github.com/docker/docker/plugin/v2" |
| 15 | 15 |
"github.com/docker/docker/reference" |
| 16 | 16 |
) |
| ... | ... |
@@ -80,11 +80,11 @@ func (ps *Store) getByCap(name string, capability string) (*v2.Plugin, error) {
|
| 80 | 80 |
return p.FilterByCap(capability) |
| 81 | 81 |
} |
| 82 | 82 |
|
| 83 |
-func (ps *Store) getAllByCap(capability string) []getter.CompatPlugin {
|
|
| 83 |
+func (ps *Store) getAllByCap(capability string) []plugingetter.CompatPlugin {
|
|
| 84 | 84 |
ps.RLock() |
| 85 | 85 |
defer ps.RUnlock() |
| 86 | 86 |
|
| 87 |
- result := make([]getter.CompatPlugin, 0, 1) |
|
| 87 |
+ result := make([]plugingetter.CompatPlugin, 0, 1) |
|
| 88 | 88 |
for _, p := range ps.plugins {
|
| 89 | 89 |
if _, err := p.FilterByCap(capability); err == nil {
|
| 90 | 90 |
result = append(result, p) |
| ... | ... |
@@ -132,7 +132,7 @@ func (ps *Store) updatePluginDB() error {
|
| 132 | 132 |
} |
| 133 | 133 |
|
| 134 | 134 |
// Get returns a plugin matching the given name and capability. |
| 135 |
-func (ps *Store) Get(name, capability string, mode int) (getter.CompatPlugin, error) {
|
|
| 135 |
+func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error) {
|
|
| 136 | 136 |
var ( |
| 137 | 137 |
p *v2.Plugin |
| 138 | 138 |
err error |
| ... | ... |
@@ -176,8 +176,8 @@ func (ps *Store) Get(name, capability string, mode int) (getter.CompatPlugin, er |
| 176 | 176 |
} |
| 177 | 177 |
|
| 178 | 178 |
// GetAllByCap returns a list of plugins matching the given capability. |
| 179 |
-func (ps *Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
|
|
| 180 |
- result := make([]getter.CompatPlugin, 0, 1) |
|
| 179 |
+func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
|
|
| 180 |
+ result := make([]plugingetter.CompatPlugin, 0, 1) |
|
| 181 | 181 |
|
| 182 | 182 |
/* Daemon start always calls plugin.Init thereby initializing a store. |
| 183 | 183 |
* So store on experimental builds can never be nil, even while |