Skip to content

Commit 72003b0

Browse files
committed
feat: make it possible to stream existing configurations
1 parent 83da1c1 commit 72003b0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/AbstractConfigurationService.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.Map;
77
import java.util.Set;
88
import java.util.concurrent.ConcurrentHashMap;
9+
import java.util.stream.Stream;
910

1011
public abstract class AbstractConfigurationService implements ConfigurationService {
1112

@@ -24,8 +25,8 @@ protected <R extends CustomResource> void replace(ControllerConfiguration<R> con
2425
put(config, false);
2526
}
2627

27-
private <R extends CustomResource> void put(ControllerConfiguration<R> config,
28-
boolean failIfExisting) {
28+
private <R extends CustomResource> void put(
29+
ControllerConfiguration<R> config, boolean failIfExisting) {
2930
final var name = config.getName();
3031
if (failIfExisting) {
3132
final var existing = configurations.get(name);
@@ -61,6 +62,10 @@ protected ControllerConfiguration getFor(String controllerName) {
6162
return configurations.get(controllerName);
6263
}
6364

65+
protected Stream<ControllerConfiguration> controllerConfigurations() {
66+
return configurations.values().stream();
67+
}
68+
6469
@Override
6570
public Set<String> getKnownControllerNames() {
6671
return configurations.keySet();

0 commit comments

Comments
 (0)