MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / initGateway

Method initGateway

module/strategy/iml.go:363–394  ·  view source on GitHub ↗
(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver)

Source from the content-addressed store, hash-verified

361}
362
363func (i *imlStrategyModule) initGateway(ctx context.Context, clusterId string, clientDriver gateway.IClientDriver) error {
364 commits, err := i.strategyService.ListLatestStrategyCommit(ctx, strategy_dto.ScopeGlobal, "")
365 if err != nil {
366 return err
367 }
368 publishStrategies := make([]*eosc.Base[gateway.StrategyRelease], 0, len(commits))
369 for _, c := range commits {
370 l := c.Data
371 if l.IsDelete {
372 err = i.strategyService.Delete(ctx, l.Id)
373 if err != nil {
374 return err
375 }
376 }
377 d, has := strategy_driver.GetDriver(l.Driver)
378 if !has {
379 continue
380 }
381 publishStrategies = append(publishStrategies, d.ToRelease(strategy_dto.ToStrategy(&strategy.Strategy{
382 Id: l.Id,
383 Name: l.Name,
384 Priority: l.Priority,
385 Filters: l.Filters,
386 Config: l.Config,
387 Driver: l.Driver,
388 IsStop: l.IsStop,
389 IsDelete: l.IsDelete,
390 }), nil, 5000))
391 }
392
393 return clientDriver.Strategy().Online(ctx, publishStrategies...)
394}

Callers

nothing calls this directly

Calls 6

GetDriverMethod · 0.80
DeleteMethod · 0.65
ToReleaseMethod · 0.65
OnlineMethod · 0.65
StrategyMethod · 0.65

Tested by

no test coverage detected