github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/daemon/graphdriver/plugin.go (about)

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