code: func NewManager(config ManagerConfig) (*Manager, error) {
  	if config.RegistryService != nil {
  		config.RegistryService = pluginRegistryService{config.RegistryService}
  	}
  	manager := &Manager{
  		config: config,
  	}
  	for _, dirName := range []string{manager.config.Root, manager.config.ExecRoot, manager.tmpDir()} {
  		if err := os.MkdirAll(dirName, 0700); err != nil {
  			return nil, errors.Wrapf(err, "failed to mkdir %v", dirName)
  		}
  	}
  	var err error
  	manager.executor, err = config.CreateExecutor(manager)
  	if err != nil {
  		return nil, err
  	}
  
  	manager.blobStore, err = newBasicBlobStore(filepath.Join(manager.config.Root, "storage/blobs"))
  	if err != nil {
  		return nil, err
  	}
  
  	manager.cMap = make(map[*v2.Plugin]*controller)
  	if err := manager.reload(); err != nil {
  		return nil, errors.Wrap(err, "failed to restore plugins")
  	}
  
  	manager.publisher = pubsub.NewPublisher(0, 0)
  	return manager, nil
  }
docs: // NewManager returns a new plugin manager.