validateNoDuplicateCacheIDs checks for duplicate cache IDs and returns an error if found. Uses the generic validateNoDuplicateIDs helper for consistent duplicate detection.
(caches []CacheMemoryEntry)
| 50 | // validateNoDuplicateCacheIDs checks for duplicate cache IDs and returns an error if found. |
| 51 | // Uses the generic validateNoDuplicateIDs helper for consistent duplicate detection. |
| 52 | func validateNoDuplicateCacheIDs(caches []CacheMemoryEntry) error { |
| 53 | cacheLog.Printf("Validating cache IDs: checking %d caches for duplicates", len(caches)) |
| 54 | err := validateNoDuplicateIDs(caches, func(c CacheMemoryEntry) string { return c.ID }, func(id string) error { |
| 55 | cacheLog.Printf("Duplicate cache ID found: %s", id) |
| 56 | return NewValidationError( |
| 57 | "sandbox.cache-memory", |
| 58 | id, |
| 59 | "duplicate cache-memory ID found - each cache must have a unique ID", |
| 60 | "Change the cache ID to a unique value. Example:\n\nsandbox:\n cache-memory:\n - id: cache-1\n size: 100MB\n - id: cache-2 # Use unique IDs\n size: 50MB", |
| 61 | ) |
| 62 | }) |
| 63 | if err != nil { |
| 64 | return err |
| 65 | } |
| 66 | cacheLog.Print("Cache ID validation passed: no duplicates found") |
| 67 | return nil |
| 68 | } |
no test coverage detected