(ic *plugin.InitContext)
| 100 | } |
| 101 | |
| 102 | func initFunc(ic *plugin.InitContext) (any, error) { |
| 103 | config := ic.Config.(*Config) |
| 104 | |
| 105 | v2r, err := ic.GetByID(plugins.RuntimePluginV2, "task") |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | |
| 110 | m, err := ic.GetSingle(plugins.MetadataPlugin) |
| 111 | if err != nil { |
| 112 | return nil, err |
| 113 | } |
| 114 | |
| 115 | ep, err := ic.GetSingle(plugins.EventPlugin) |
| 116 | if err != nil { |
| 117 | return nil, err |
| 118 | } |
| 119 | |
| 120 | monitor, err := ic.GetSingle(plugins.TaskMonitorPlugin) |
| 121 | if err != nil { |
| 122 | if !errors.Is(err, plugin.ErrPluginNotFound) { |
| 123 | return nil, err |
| 124 | } |
| 125 | monitor = runtime.NewNoopMonitor() |
| 126 | } |
| 127 | |
| 128 | warnings, err := ic.GetSingle(plugins.WarningPlugin) |
| 129 | if err != nil { |
| 130 | return nil, err |
| 131 | } |
| 132 | |
| 133 | db := m.(*metadata.DB) |
| 134 | l := &local{ |
| 135 | containers: metadata.NewContainerStore(db), |
| 136 | store: db.ContentStore(), |
| 137 | publisher: ep.(events.Publisher), |
| 138 | monitor: monitor.(runtime.TaskMonitor), |
| 139 | v2Runtime: v2r.(runtime.PlatformRuntime), |
| 140 | warnings: warnings.(warning.Service), |
| 141 | } |
| 142 | |
| 143 | v2Tasks, err := l.v2Runtime.Tasks(ic.Context, true) |
| 144 | if err != nil { |
| 145 | return nil, err |
| 146 | } |
| 147 | for _, t := range v2Tasks { |
| 148 | l.monitor.Monitor(t, nil) |
| 149 | } |
| 150 | |
| 151 | if err := blockio.SetConfig(config.BlockIOConfigFile); err != nil { |
| 152 | log.G(ic.Context).WithError(err).Errorf("blockio initialization failed") |
| 153 | } |
| 154 | if err := rdt.SetConfig(config.RdtConfigFile); err != nil { |
| 155 | log.G(ic.Context).WithError(err).Errorf("RDT initialization failed") |
| 156 | } |
| 157 | |
| 158 | return l, nil |
| 159 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…