func()

in internal/file_cleaner/file_cleaner.go [194:224]


func (c *FileCleaner) removeShards(ctx context.Context, repoIDs ...uint32) error {
	removeFunc := func(path string) bool {
		fileName := filepath.Base(path)

		repoIDStr := IDRegex.FindString(fileName)

		if repoIDStr == "" {
			return false
		}

		rID, err := strconv.ParseUint(repoIDStr, 10, 32)

		if err != nil {
			return false
		}

		if fmt.Sprintf("%d.delete", rID) == fileName {
			return false
		}

		for _, repoID := range repoIDs {
			if repoID == uint32(rID) {
				return true
			}
		}

		return false
	}

	return c.removeFiles(ctx, removeFunc)
}