getter.go 864 B

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