MCPcopy
hub / github.com/moby/moby / Get

Function Get

pkg/plugins/plugins.go:256–269  ·  view source on GitHub ↗

Get returns the plugin given the specified name and requested implementation.

(name, imp string)

Source from the content-addressed store, hash-verified

254
255// Get returns the plugin given the specified name and requested implementation.
256func Get(name, imp string) (*Plugin, error) {
257 if name == "" {
258 return nil, errors.New("Unable to find plugin without name")
259 }
260 pl, err := get(name)
261 if err != nil {
262 return nil, err
263 }
264 if err := pl.waitActive(); err == nil && pl.implements(imp) {
265 log.G(context.TODO()).Debugf("%s implements: %s", name, imp)
266 return pl, nil
267 }
268 return nil, fmt.Errorf("%w: plugin=%q, requested implementation=%q", ErrNotImplements, name, imp)
269}
270
271// Handle adds the specified function to the extpointHandlers.
272func Handle(iface string, fn func(string, *Client)) {

Callers 15

initPluginMethod · 0.92
loadDriverMethod · 0.92
loadIPAMDriverMethod · 0.92
TestGetCapabilitiesFunction · 0.92
TestRemoteDriverFunction · 0.92
TestGetEmptyCapabilitiesFunction · 0.92
TestGetExtraCapabilitiesFunction · 0.92
TestRemoteDriverFunction · 0.92
TestDriverErrorFunction · 0.92

Calls 6

getFunction · 0.85
waitActiveMethod · 0.80
implementsMethod · 0.80
DebugfMethod · 0.80
ErrorfMethod · 0.80
NewMethod · 0.65

Tested by 13

TestGetCapabilitiesFunction · 0.74
TestRemoteDriverFunction · 0.74
TestGetEmptyCapabilitiesFunction · 0.74
TestGetExtraCapabilitiesFunction · 0.74
TestRemoteDriverFunction · 0.74
TestDriverErrorFunction · 0.74
TestMissingValuesFunction · 0.74
TestRollbackFunction · 0.74
TestGetFunction · 0.56