MCPcopy
hub / github.com/ipfs/kubo / Inject

Method Inject

plugin/loader/loader.go:269–306  ·  view source on GitHub ↗

Inject hooks all the plugins into the appropriate subsystems.

()

Source from the content-addressed store, hash-verified

267
268// Inject hooks all the plugins into the appropriate subsystems.
269func (loader *PluginLoader) Inject() error {
270 if err := loader.transition(loaderInitialized, loaderInjecting); err != nil {
271 return err
272 }
273
274 for _, pl := range loader.plugins {
275 if pl, ok := pl.(plugin.PluginIPLD); ok {
276 err := injectIPLDPlugin(pl)
277 if err != nil {
278 loader.state = loaderFailed
279 return err
280 }
281 }
282 if pl, ok := pl.(plugin.PluginTracer); ok {
283 err := injectTracerPlugin(pl)
284 if err != nil {
285 loader.state = loaderFailed
286 return err
287 }
288 }
289 if pl, ok := pl.(plugin.PluginDatastore); ok {
290 err := injectDatastorePlugin(pl)
291 if err != nil {
292 loader.state = loaderFailed
293 return err
294 }
295 }
296 if pl, ok := pl.(plugin.PluginFx); ok {
297 err := injectFxPlugin(pl)
298 if err != nil {
299 loader.state = loaderFailed
300 return err
301 }
302 }
303 }
304
305 return loader.transition(loaderInjecting, loaderInjected)
306}
307
308// Start starts all long-running plugins.
309func (loader *PluginLoader) Start(node *core.IpfsNode) error {

Callers 5

loadPluginsFunction · 0.95
setupPluginsFunction · 0.95
setupPluginsFunction · 0.95
daemonFuncFunction · 0.80

Calls 5

transitionMethod · 0.95
injectIPLDPluginFunction · 0.85
injectTracerPluginFunction · 0.85
injectDatastorePluginFunction · 0.85
injectFxPluginFunction · 0.85

Tested by 2

setupPluginsFunction · 0.76