defs.go 810 B

12345678910111213141516171819202122232425262728293031
  1. package store
  2. import (
  3. "path/filepath"
  4. "sync"
  5. "github.com/docker/docker/pkg/plugins"
  6. "github.com/docker/docker/plugin/v2"
  7. )
  8. // Store manages the plugin inventory in memory and on-disk
  9. type Store struct {
  10. sync.RWMutex
  11. plugins map[string]*v2.Plugin
  12. /* handlers are necessary for transition path of legacy plugins
  13. * to the new model. Legacy plugins use Handle() for registering an
  14. * activation callback.*/
  15. handlers map[string][]func(string, *plugins.Client)
  16. nameToID map[string]string
  17. plugindb string
  18. }
  19. // NewStore creates a Store.
  20. func NewStore(libRoot string) *Store {
  21. return &Store{
  22. plugins: make(map[string]*v2.Plugin),
  23. handlers: make(map[string][]func(string, *plugins.Client)),
  24. nameToID: make(map[string]string),
  25. plugindb: filepath.Join(libRoot, "plugins", "plugins.json"),
  26. }
  27. }