github.com/sams1990/dockerrepo@v17.12.1-ce-rc2+incompatible/pkg/plugingetter/getter.go (about)

     1  package plugingetter
     2  
     3  import (
     4  	"github.com/docker/docker/pkg/plugins"
     5  )
     6  
     7  const (
     8  	// Lookup doesn't update RefCount
     9  	Lookup = 0
    10  	// Acquire increments RefCount
    11  	Acquire = 1
    12  	// Release decrements RefCount
    13  	Release = -1
    14  )
    15  
    16  // CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins.
    17  type CompatPlugin interface {
    18  	Client() *plugins.Client
    19  	Name() string
    20  	BasePath() string
    21  	IsV1() bool
    22  }
    23  
    24  // CountedPlugin is a plugin which is reference counted.
    25  type CountedPlugin interface {
    26  	Acquire()
    27  	Release()
    28  	CompatPlugin
    29  }
    30  
    31  // PluginGetter is the interface implemented by Store
    32  type PluginGetter interface {
    33  	Get(name, capability string, mode int) (CompatPlugin, error)
    34  	GetAllByCap(capability string) ([]CompatPlugin, error)
    35  	GetAllManagedPluginsByCap(capability string) []CompatPlugin
    36  	Handle(capability string, callback func(string, *plugins.Client))
    37  }