MCPcopy
hub / github.com/harness/harness / GetOrderedRepos

Function GetOrderedRepos

registry/app/pkg/base/wrapper.go:147–181  ·  view source on GitHub ↗
(
	ctx context.Context,
	registryDao store.RegistryRepository,
	repoKey string,
	parentID int64,
	upstream bool,
)

Source from the content-addressed store, hash-verified

145}
146
147func GetOrderedRepos(
148 ctx context.Context,
149 registryDao store.RegistryRepository,
150 repoKey string,
151 parentID int64,
152 upstream bool,
153) ([]registrytypes.Registry, error) {
154 var result []registrytypes.Registry
155 registry, err := registryDao.GetByParentIDAndName(ctx, parentID, repoKey)
156 if err != nil {
157 return result, errors.NotFound("registry %s not found", repoKey)
158 }
159 result = append(result, *registry)
160 if !upstream {
161 return result, nil
162 }
163 proxies := registry.UpstreamProxies
164 if len(proxies) > 0 {
165 upstreamRepos, err2 := registryDao.GetByIDIn(ctx, proxies)
166 if err2 != nil {
167 log.Ctx(ctx).Error().Msgf("Failed to get upstream proxies for %s: %v", repoKey, err2)
168 return result, err2
169 }
170 repoMap := make(map[int64]registrytypes.Registry)
171 for _, repo := range *upstreamRepos {
172 repoMap[repo.ID] = repo
173 }
174 for _, proxyID := range proxies {
175 if repo, ok := repoMap[proxyID]; ok {
176 result = append(result, repo)
177 }
178 }
179 }
180 return result, nil
181}
182
183func SearchPackagesProxyWrapper(
184 ctx context.Context,

Callers 2

buildForVirtualMethod · 0.92
filterRegsFunction · 0.85

Calls 5

NotFoundFunction · 0.92
MsgfMethod · 0.80
GetByParentIDAndNameMethod · 0.65
GetByIDInMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…