2016-10-04 20:52:18 +03:00
|
|
|
package plugingetter
|
|
|
|
|
|
|
|
import "github.com/docker/docker/pkg/plugins"
|
|
|
|
|
|
|
|
const (
|
2016-12-20 05:18:43 +03:00
|
|
|
// Lookup doesn't update RefCount
|
|
|
|
Lookup = 0
|
|
|
|
// Acquire increments RefCount
|
|
|
|
Acquire = 1
|
|
|
|
// Release decrements RefCount
|
|
|
|
Release = -1
|
2016-10-04 20:52:18 +03:00
|
|
|
)
|
|
|
|
|
2016-12-19 09:45:48 +03:00
|
|
|
// CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins.
|
2016-10-04 20:52:18 +03:00
|
|
|
type CompatPlugin interface {
|
|
|
|
Client() *plugins.Client
|
|
|
|
Name() string
|
2016-11-22 22:21:34 +03:00
|
|
|
BasePath() string
|
2016-10-04 20:52:18 +03:00
|
|
|
IsV1() bool
|
|
|
|
}
|
|
|
|
|
2016-12-01 00:02:45 +03:00
|
|
|
// CountedPlugin is a plugin which is reference counted.
|
|
|
|
type CountedPlugin interface {
|
|
|
|
Acquire()
|
|
|
|
Release()
|
|
|
|
CompatPlugin
|
|
|
|
}
|
|
|
|
|
2016-10-04 20:52:18 +03:00
|
|
|
// PluginGetter is the interface implemented by Store
|
|
|
|
type PluginGetter interface {
|
|
|
|
Get(name, capability string, mode int) (CompatPlugin, error)
|
|
|
|
GetAllByCap(capability string) ([]CompatPlugin, error)
|
2016-12-22 21:26:04 +03:00
|
|
|
GetAllManagedPluginsByCap(capability string) []CompatPlugin
|
2016-10-04 20:52:18 +03:00
|
|
|
Handle(capability string, callback func(string, *plugins.Client))
|
|
|
|
}
|