enumerateDataFilesInDir returns all data file IDs in the directory
(dir string)
| 2283 | |
| 2284 | // enumerateDataFilesInDir returns all data file IDs in the directory |
| 2285 | func enumerateDataFilesInDir(dir string) []int64 { |
| 2286 | entries, err := os.ReadDir(dir) |
| 2287 | if err != nil { |
| 2288 | return nil |
| 2289 | } |
| 2290 | |
| 2291 | var fileIDs []int64 |
| 2292 | for _, entry := range entries { |
| 2293 | if entry.IsDir() { |
| 2294 | continue |
| 2295 | } |
| 2296 | name := entry.Name() |
| 2297 | // Check if it's a data file (ends with .data) |
| 2298 | if strings.HasSuffix(name, DataSuffix) { |
| 2299 | // Extract file ID from filename |
| 2300 | idStr := strings.TrimSuffix(name, DataSuffix) |
| 2301 | if id, err := strconv.ParseInt(idStr, 10, 64); err == nil { |
| 2302 | fileIDs = append(fileIDs, id) |
| 2303 | } |
| 2304 | } |
| 2305 | } |
| 2306 | return fileIDs |
| 2307 | } |
| 2308 | |
| 2309 | func TestDB_HintFileCorruptedFallback(t *testing.T) { |
| 2310 | bucket := "bucket" |
no test coverage detected