github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/plugin/store/defs.go (about)

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