MCPcopy
hub / github.com/moby/moby / initPlugin

Method initPlugin

pkg/authorization/plugin.go:97–118  ·  view source on GitHub ↗

initPlugin initializes the authorization plugin if needed

()

Source from the content-addressed store, hash-verified

95
96// initPlugin initializes the authorization plugin if needed
97func (a *authorizationPlugin) initPlugin() error {
98 // Lazy loading of plugins
99 a.once.Do(func() {
100 if a.plugin == nil {
101 var plugin plugingetter.CompatPlugin
102 var e error
103
104 if pg := GetPluginGetter(); pg != nil {
105 plugin, e = pg.Get(a.name, AuthZApiImplements, plugingetter.Lookup)
106 a.SetName(plugin.Name())
107 } else {
108 plugin, e = plugins.Get(a.name, AuthZApiImplements)
109 }
110 if e != nil {
111 a.initErr = e
112 return
113 }
114 a.plugin = plugin.Client()
115 }
116 })
117 return a.initErr
118}

Callers 2

AuthZRequestMethod · 0.95
AuthZResponseMethod · 0.95

Calls 7

SetNameMethod · 0.95
NameMethod · 0.95
GetFunction · 0.92
GetPluginGetterFunction · 0.85
GetMethod · 0.65
ClientMethod · 0.65
DoMethod · 0.45

Tested by

no test coverage detected