MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / validatePathInternal

Method validatePathInternal

lib/blobtypes/migrator.go:234–253  ·  view source on GitHub ↗
(startKind, startVersion, endKind, endVersion string)

Source from the content-addressed store, hash-verified

232}
233
234func (m *Migrator) validatePathInternal(startKind, startVersion, endKind, endVersion string) error {
235 currKey := makeKey(startKind, startVersion)
236 targetKey := makeKey(endKind, endVersion)
237 visited := make(map[string]bool)
238
239 for currKey != targetKey {
240 if visited[currKey] {
241 return fmt.Errorf("%w: at %q", ErrMigrationCycle, currKey)
242 }
243 visited[currKey] = true
244
245 nextKey, exists := m.pathGraph[currKey]
246 if !exists {
247 return fmt.Errorf("%w: broken chain at %q (target: %q)", ErrMigrationPathNotFound, currKey, targetKey)
248 }
249 currKey = nextKey
250 }
251
252 return nil
253}
254
255func makeKey(kind, version string) string {
256 return fmt.Sprintf("%s:%s", kind, version)

Callers 1

ValidatePathFunction · 0.80

Calls 1

makeKeyFunction · 0.85

Tested by

no test coverage detected