github.com/damirazo/docker@v1.9.0/daemon/graphdriver/plugin.go (about) 1 // +build experimental 2 // +build daemon 3 4 package graphdriver 5 6 import ( 7 "fmt" 8 "io" 9 10 "github.com/docker/docker/pkg/plugins" 11 ) 12 13 type pluginClient interface { 14 // Call calls the specified method with the specified arguments for the plugin. 15 Call(string, interface{}, interface{}) error 16 // Stream calls the specified method with the specified arguments for the plugin and returns the response IO stream 17 Stream(string, interface{}) (io.ReadCloser, error) 18 // SendFile calls the specified method, and passes through the IO stream 19 SendFile(string, io.Reader, interface{}) error 20 } 21 22 func lookupPlugin(name, home string, opts []string) (Driver, error) { 23 pl, err := plugins.Get(name, "GraphDriver") 24 if err != nil { 25 return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err) 26 } 27 return newPluginDriver(name, home, opts, pl.Client) 28 } 29 30 func newPluginDriver(name, home string, opts []string, c pluginClient) (Driver, error) { 31 proxy := &graphDriverProxy{name, c} 32 return proxy, proxy.Init(home, opts) 33 }