MCPcopy
hub / github.com/weaviate/weaviate / Init

Method Init

usecases/modules/modules.go:147–188  ·  view source on GitHub ↗
(ctx context.Context,
	params moduletools.ModuleInitParams, logger logrus.FieldLogger,
)

Source from the content-addressed store, hash-verified

145}
146
147func (p *Provider) Init(ctx context.Context,
148 params moduletools.ModuleInitParams, logger logrus.FieldLogger,
149) error {
150 for i, mod := range p.GetAll() {
151 if err := mod.Init(ctx, params); err != nil {
152 return errors.Wrapf(err, "init module %d (%q)", i, mod.Name())
153 } else {
154 logger.WithField("action", "startup").
155 WithField("module", mod.Name()).
156 Debug("initialized module")
157 }
158 }
159 for i, mod := range p.GetAll() {
160 if modExtension, ok := mod.(modulecapabilities.ModuleExtension); ok {
161 if err := modExtension.InitExtension(p.GetAllExclude(mod.Name())); err != nil {
162 return errors.Wrapf(err, "init module extension %d (%q)", i, mod.Name())
163 } else {
164 logger.WithField("action", "startup").
165 WithField("module", mod.Name()).
166 Debug("initialized module extension")
167 }
168 }
169 }
170 for i, mod := range p.GetAll() {
171 if modDependency, ok := mod.(modulecapabilities.ModuleDependency); ok {
172 if err := modDependency.InitDependency(p.GetAllExclude(mod.Name())); err != nil {
173 return errors.Wrapf(err, "init module dependency %d (%q)", i, mod.Name())
174 } else {
175 logger.WithField("action", "startup").
176 WithField("module", mod.Name()).
177 Debug("initialized module dependency")
178 }
179 }
180 }
181 if err := p.validate(); err != nil {
182 return errors.Wrap(err, "validate modules")
183 }
184 if p.HasMultipleVectorizers() {
185 logger.Warn("Multiple vector spaces are present, GraphQL Explore and REST API list objects endpoint module include params has been disabled as a result.")
186 }
187 return nil
188}
189
190func (p *Provider) validate() error {
191 searchers := map[string][]string{}

Callers 2

TestModulesWithSearchersFunction · 0.95
TestModulesProviderFunction · 0.95

Calls 11

GetAllMethod · 0.95
GetAllExcludeMethod · 0.95
validateMethod · 0.95
DebugMethod · 0.80
WarnMethod · 0.80
InitMethod · 0.65
NameMethod · 0.65
InitExtensionMethod · 0.65
InitDependencyMethod · 0.65
WrapMethod · 0.65

Tested by 2

TestModulesWithSearchersFunction · 0.76
TestModulesProviderFunction · 0.76