Ver código fonte

Update plugingetter import path in docker/docker.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Anusha Ragunathan 8 anos atrás
pai
commit
a98be0344b

+ 1 - 1
daemon/daemon.go

@@ -40,6 +40,7 @@ import (
 	"github.com/docker/docker/pkg/fileutils"
 	"github.com/docker/docker/pkg/fileutils"
 	"github.com/docker/docker/pkg/graphdb"
 	"github.com/docker/docker/pkg/graphdb"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/idtools"
+	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/progress"
 	"github.com/docker/docker/pkg/progress"
 	"github.com/docker/docker/pkg/registrar"
 	"github.com/docker/docker/pkg/registrar"
 	"github.com/docker/docker/pkg/signal"
 	"github.com/docker/docker/pkg/signal"
@@ -47,7 +48,6 @@ import (
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/docker/docker/pkg/sysinfo"
 	"github.com/docker/docker/pkg/system"
 	"github.com/docker/docker/pkg/system"
 	"github.com/docker/docker/pkg/truncindex"
 	"github.com/docker/docker/pkg/truncindex"
-	plugingetter "github.com/docker/docker/plugin/getter"
 	pluginstore "github.com/docker/docker/plugin/store"
 	pluginstore "github.com/docker/docker/plugin/store"
 	"github.com/docker/docker/reference"
 	"github.com/docker/docker/reference"
 	"github.com/docker/docker/registry"
 	"github.com/docker/docker/registry"

+ 5 - 5
daemon/graphdriver/driver.go

@@ -12,7 +12,7 @@ import (
 
 
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/idtools"
-	"github.com/docker/docker/plugin/getter"
+	"github.com/docker/docker/pkg/plugingetter"
 )
 )
 
 
 // FsMagic unsigned id of the filesystem in use.
 // FsMagic unsigned id of the filesystem in use.
@@ -135,11 +135,11 @@ func Register(name string, initFunc InitFunc) error {
 }
 }
 
 
 // GetDriver initializes and returns the registered driver
 // GetDriver initializes and returns the registered driver
-func GetDriver(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap, plugingetter getter.PluginGetter) (Driver, error) {
+func GetDriver(name, home string, options []string, uidMaps, gidMaps []idtools.IDMap, pg plugingetter.PluginGetter) (Driver, error) {
 	if initFunc, exists := drivers[name]; exists {
 	if initFunc, exists := drivers[name]; exists {
 		return initFunc(filepath.Join(home, name), options, uidMaps, gidMaps)
 		return initFunc(filepath.Join(home, name), options, uidMaps, gidMaps)
 	}
 	}
-	if pluginDriver, err := lookupPlugin(name, home, options, plugingetter); err == nil {
+	if pluginDriver, err := lookupPlugin(name, home, options, pg); err == nil {
 		return pluginDriver, nil
 		return pluginDriver, nil
 	}
 	}
 	logrus.Errorf("Failed to GetDriver graph %s %s", name, home)
 	logrus.Errorf("Failed to GetDriver graph %s %s", name, home)
@@ -156,10 +156,10 @@ func getBuiltinDriver(name, home string, options []string, uidMaps, gidMaps []id
 }
 }
 
 
 // New creates the driver and initializes it at the specified root.
 // New creates the driver and initializes it at the specified root.
-func New(root string, name string, options []string, uidMaps, gidMaps []idtools.IDMap, plugingetter getter.PluginGetter) (Driver, error) {
+func New(root string, name string, options []string, uidMaps, gidMaps []idtools.IDMap, pg plugingetter.PluginGetter) (Driver, error) {
 	if name != "" {
 	if name != "" {
 		logrus.Debugf("[graphdriver] trying provided driver: %s", name) // so the logs show specified driver
 		logrus.Debugf("[graphdriver] trying provided driver: %s", name) // so the logs show specified driver
-		return GetDriver(name, root, options, uidMaps, gidMaps, plugingetter)
+		return GetDriver(name, root, options, uidMaps, gidMaps, pg)
 	}
 	}
 
 
 	// Guess for prior driver
 	// Guess for prior driver

+ 3 - 3
daemon/graphdriver/plugin.go

@@ -6,7 +6,7 @@ import (
 	"fmt"
 	"fmt"
 	"io"
 	"io"
 
 
-	"github.com/docker/docker/plugin/getter"
+	"github.com/docker/docker/pkg/plugingetter"
 )
 )
 
 
 type pluginClient interface {
 type pluginClient interface {
@@ -18,8 +18,8 @@ type pluginClient interface {
 	SendFile(string, io.Reader, interface{}) error
 	SendFile(string, io.Reader, interface{}) error
 }
 }
 
 
-func lookupPlugin(name, home string, opts []string, pluginGetter getter.PluginGetter) (Driver, error) {
-	pl, err := pluginGetter.Get(name, "GraphDriver", getter.LOOKUP)
+func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter) (Driver, error) {
+	pl, err := pg.Get(name, "GraphDriver", plugingetter.LOOKUP)
 	if err != nil {
 	if err != nil {
 		return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
 		return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
 	}
 	}

+ 2 - 2
daemon/graphdriver/plugin_unsupported.go

@@ -2,8 +2,8 @@
 
 
 package graphdriver
 package graphdriver
 
 
-import "github.com/docker/docker/plugin/getter"
+import "github.com/docker/docker/pkg/plugingetter"
 
 
-func lookupPlugin(name, home string, opts []string, plugingetter getter.PluginGetter) (Driver, error) {
+func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter) (Driver, error) {
 	return nil, ErrNotSupported
 	return nil, ErrNotSupported
 }
 }

+ 2 - 2
layer/layer_store.go

@@ -13,8 +13,8 @@ import (
 	"github.com/docker/docker/daemon/graphdriver"
 	"github.com/docker/docker/daemon/graphdriver"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/idtools"
 	"github.com/docker/docker/pkg/idtools"
+	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/stringid"
 	"github.com/docker/docker/pkg/stringid"
-	"github.com/docker/docker/plugin/getter"
 	"github.com/vbatts/tar-split/tar/asm"
 	"github.com/vbatts/tar-split/tar/asm"
 	"github.com/vbatts/tar-split/tar/storage"
 	"github.com/vbatts/tar-split/tar/storage"
 )
 )
@@ -45,7 +45,7 @@ type StoreOptions struct {
 	GraphDriverOptions        []string
 	GraphDriverOptions        []string
 	UIDMaps                   []idtools.IDMap
 	UIDMaps                   []idtools.IDMap
 	GIDMaps                   []idtools.IDMap
 	GIDMaps                   []idtools.IDMap
-	PluginGetter              getter.PluginGetter
+	PluginGetter              plugingetter.PluginGetter
 }
 }
 
 
 // NewStoreFromOptions creates a new Store instance
 // NewStoreFromOptions creates a new Store instance

+ 0 - 26
plugin/getter/interface.go

@@ -1,26 +0,0 @@
-package getter
-
-import "github.com/docker/docker/pkg/plugins"
-
-const (
-	// LOOKUP doesn't update RefCount
-	LOOKUP = 0
-	// CREATE increments RefCount
-	CREATE = 1
-	// REMOVE decrements RefCount
-	REMOVE = -1
-)
-
-// CompatPlugin is a abstraction to handle both v2(new) and v1(legacy) plugins.
-type CompatPlugin interface {
-	Client() *plugins.Client
-	Name() string
-	IsV1() bool
-}
-
-// PluginGetter is the interface implemented by Store
-type PluginGetter interface {
-	Get(name, capability string, mode int) (CompatPlugin, error)
-	GetAllByCap(capability string) ([]CompatPlugin, error)
-	Handle(capability string, callback func(string, *plugins.Client))
-}

+ 4 - 4
plugin/store/store.go

@@ -3,17 +3,17 @@
 package store
 package store
 
 
 import (
 import (
+	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/plugins"
 	"github.com/docker/docker/pkg/plugins"
-	"github.com/docker/docker/plugin/getter"
 )
 )
 
 
 // GetAllByCap returns a list of plugins matching the given capability.
 // GetAllByCap returns a list of plugins matching the given capability.
-func (ps Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
+func (ps Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
 	pl, err := plugins.GetAll(capability)
 	pl, err := plugins.GetAll(capability)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	result := make([]getter.CompatPlugin, len(pl))
+	result := make([]plugingetter.CompatPlugin, len(pl))
 	for i, p := range pl {
 	for i, p := range pl {
 		result[i] = p
 		result[i] = p
 	}
 	}
@@ -21,7 +21,7 @@ func (ps Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
 }
 }
 
 
 // Get returns a plugin matching the given name and capability.
 // Get returns a plugin matching the given name and capability.
-func (ps Store) Get(name, capability string, _ int) (getter.CompatPlugin, error) {
+func (ps Store) Get(name, capability string, _ int) (plugingetter.CompatPlugin, error) {
 	return plugins.Get(name, capability)
 	return plugins.Get(name, capability)
 }
 }
 
 

+ 6 - 6
plugin/store/store_experimental.go

@@ -9,8 +9,8 @@ import (
 
 
 	"github.com/Sirupsen/logrus"
 	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/pkg/ioutils"
 	"github.com/docker/docker/pkg/ioutils"
+	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/plugins"
 	"github.com/docker/docker/pkg/plugins"
-	"github.com/docker/docker/plugin/getter"
 	"github.com/docker/docker/plugin/v2"
 	"github.com/docker/docker/plugin/v2"
 	"github.com/docker/docker/reference"
 	"github.com/docker/docker/reference"
 )
 )
@@ -80,11 +80,11 @@ func (ps *Store) getByCap(name string, capability string) (*v2.Plugin, error) {
 	return p.FilterByCap(capability)
 	return p.FilterByCap(capability)
 }
 }
 
 
-func (ps *Store) getAllByCap(capability string) []getter.CompatPlugin {
+func (ps *Store) getAllByCap(capability string) []plugingetter.CompatPlugin {
 	ps.RLock()
 	ps.RLock()
 	defer ps.RUnlock()
 	defer ps.RUnlock()
 
 
-	result := make([]getter.CompatPlugin, 0, 1)
+	result := make([]plugingetter.CompatPlugin, 0, 1)
 	for _, p := range ps.plugins {
 	for _, p := range ps.plugins {
 		if _, err := p.FilterByCap(capability); err == nil {
 		if _, err := p.FilterByCap(capability); err == nil {
 			result = append(result, p)
 			result = append(result, p)
@@ -132,7 +132,7 @@ func (ps *Store) updatePluginDB() error {
 }
 }
 
 
 // Get returns a plugin matching the given name and capability.
 // Get returns a plugin matching the given name and capability.
-func (ps *Store) Get(name, capability string, mode int) (getter.CompatPlugin, error) {
+func (ps *Store) Get(name, capability string, mode int) (plugingetter.CompatPlugin, error) {
 	var (
 	var (
 		p   *v2.Plugin
 		p   *v2.Plugin
 		err error
 		err error
@@ -176,8 +176,8 @@ func (ps *Store) Get(name, capability string, mode int) (getter.CompatPlugin, er
 }
 }
 
 
 // GetAllByCap returns a list of plugins matching the given capability.
 // GetAllByCap returns a list of plugins matching the given capability.
-func (ps *Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) {
-	result := make([]getter.CompatPlugin, 0, 1)
+func (ps *Store) GetAllByCap(capability string) ([]plugingetter.CompatPlugin, error) {
+	result := make([]plugingetter.CompatPlugin, 0, 1)
 
 
 	/* Daemon start always calls plugin.Init thereby initializing a store.
 	/* Daemon start always calls plugin.Init thereby initializing a store.
 	 * So store on experimental builds can never be nil, even while
 	 * So store on experimental builds can never be nil, even while

+ 1 - 1
volume/drivers/extpoint.go

@@ -7,7 +7,7 @@ import (
 	"sync"
 	"sync"
 
 
 	"github.com/docker/docker/pkg/locker"
 	"github.com/docker/docker/pkg/locker"
-	"github.com/docker/docker/plugin/getter"
+	getter "github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/volume"
 	"github.com/docker/docker/volume"
 )
 )