2018-02-05 16:05:59 -05:00
|
|
|
package plugingetter // import "github.com/docker/docker/pkg/plugingetter"
|
2016-10-04 13:52:18 -04:00
|
|
|
|
2017-10-20 15:39:47 -04:00
|
|
|
import (
|
|
|
|
"github.com/docker/docker/pkg/plugins"
|
|
|
|
)
|
2016-10-04 13:52:18 -04:00
|
|
|
|
|
|
|
const (
|
2016-12-19 21:18:43 -05:00
|
|
|
// Lookup doesn't update RefCount
|
|
|
|
Lookup = 0
|
|
|
|
// Acquire increments RefCount
|
|
|
|
Acquire = 1
|
|
|
|
// Release decrements RefCount
|
|
|
|
Release = -1
|
2016-10-04 13:52:18 -04:00
|
|
|
)
|
|
|
|
|
2016-12-19 01:45:48 -05:00
|
|
|
// CompatPlugin is an abstraction to handle both v2(new) and v1(legacy) plugins.
|
2016-10-04 13:52:18 -04:00
|
|
|
type CompatPlugin interface {
|
|
|
|
Client() *plugins.Client
|
|
|
|
Name() string
|
2017-12-14 10:27:10 -05:00
|
|
|
ScopedPath(string) string
|
2016-10-04 13:52:18 -04:00
|
|
|
IsV1() bool
|
|
|
|
}
|
|
|
|
|
2016-11-30 16:02:45 -05:00
|
|
|
// CountedPlugin is a plugin which is reference counted.
|
|
|
|
type CountedPlugin interface {
|
|
|
|
Acquire()
|
|
|
|
Release()
|
|
|
|
CompatPlugin
|
|
|
|
}
|
|
|
|
|
2016-10-04 13:52:18 -04: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 13:26:04 -05:00
|
|
|
GetAllManagedPluginsByCap(capability string) []CompatPlugin
|
2016-10-04 13:52:18 -04:00
|
|
|
Handle(capability string, callback func(string, *plugins.Client))
|
|
|
|
}
|