github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/plugin/store/store.go (about) 1 // +build !experimental 2 3 package store 4 5 import ( 6 "github.com/docker/docker/pkg/plugins" 7 "github.com/docker/docker/plugin/getter" 8 ) 9 10 // GetAllByCap returns a list of plugins matching the given capability. 11 func (ps Store) GetAllByCap(capability string) ([]getter.CompatPlugin, error) { 12 pl, err := plugins.GetAll(capability) 13 if err != nil { 14 return nil, err 15 } 16 result := make([]getter.CompatPlugin, len(pl)) 17 for i, p := range pl { 18 result[i] = p 19 } 20 return result, nil 21 } 22 23 // Get returns a plugin matching the given name and capability. 24 func (ps Store) Get(name, capability string, _ int) (getter.CompatPlugin, error) { 25 return plugins.Get(name, capability) 26 } 27 28 // Handle sets a callback for a given capability. It is only used by network 29 // and ipam drivers during plugin registration. The callback registers the 30 // driver with the subsystem (network, ipam). 31 func (ps *Store) Handle(capability string, callback func(string, *plugins.Client)) { 32 plugins.Handle(capability, callback) 33 }