Skip to content

Better repository configuration#195

Merged
cstamas merged 3 commits intomainfrom
better-repo-support
Dec 5, 2025
Merged

Better repository configuration#195
cstamas merged 3 commits intomainfrom
better-repo-support

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Dec 4, 2025

So far Mimir offered (and was quite reluctant) to cache anything else than direct Central. Open this up, as Central is becoming "non-special".

So far Mimir offered (and was quite reluctant) to cache
anything else than direct Central. Open this up, as
Central is becoming "non-special".
@cstamas cstamas self-assigned this Dec 4, 2025
@cstamas cstamas requested a review from bmarwell December 4, 2025 21:51
@cstamas cstamas marked this pull request as ready for review December 5, 2025 11:34
Copy link

@bmarwell bmarwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except a nit, can't wait to test it

Comment on lines +47 to +82
Predicate<RemoteRepository> result = null;
for (String repoSpec : repositories) {
Predicate<RemoteRepository> repoPredicate;
if (!repoSpec.contains("(") && !repoSpec.contains(")")) {
if ("*".equals(repoSpec)) {
repoPredicate = release();
} else {
repoPredicate = idOnly(repoSpec).and(release());
}
} else if (repoSpec.contains("(") && repoSpec.contains(")")) {
String repoId = repoSpec.substring(0, repoSpec.indexOf("("));
if ("*".equals(repoId)) {
repoPredicate = r -> true;
} else {
repoPredicate = idOnly(repoId);
}
if (repoSpec.contains(MOD_HTTPS_ONLY)) {
repoPredicate = repoPredicate.and(httpsOnly());
}
if (repoSpec.contains(MOD_DIRECT_ONLY)) {
repoPredicate = repoPredicate.and(directOnly());
}
if (repoSpec.contains(MOD_RELEASE_ONLY)) {
repoPredicate = repoPredicate.and(releaseOnly());
} else {
repoPredicate = repoPredicate.and(release());
}
} else {
throw new IllegalStateException("Invalid repository spec: " + repoSpec);
}
if (result == null) {
result = repoPredicate;
} else {
result = result.or(repoPredicate);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend factoring out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? All the parsing, constants and parsing result (predicates) are in single class? What would give factoring out?

@cstamas cstamas merged commit 33a4b10 into main Dec 5, 2025
10 checks passed
@cstamas cstamas deleted the better-repo-support branch December 5, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants