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