
pl.allegro.tech.hermes.management.domain.consistency.MetadataCopies Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-management Show documentation
Show all versions of hermes-management Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.management.domain.consistency;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
class MetadataCopies {
private final String id;
private final Map copyPerDatacenter = new HashMap<>();
MetadataCopies(String id, Set datacenters) {
this.id = id;
datacenters.forEach(dc -> copyPerDatacenter.put(dc, null));
}
void put(String datacenter, Object value) {
if (!copyPerDatacenter.containsKey(datacenter)) {
throw new IllegalArgumentException("Invalid datacenter: " + datacenter);
}
copyPerDatacenter.put(datacenter, value);
}
boolean areAllEqual() {
return copyPerDatacenter.values().stream().distinct().count() == 1;
}
String getId() {
return id;
}
Map getCopyPerDatacenter() {
return copyPerDatacenter;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy