public static ServingStatusAggregator computeServingStatusAggregator(Ring ring, DomainGroup domainGroup) throws IOException { ServingStatusAggregator servingStatusAggregator = new ServingStatusAggregator(); for (Host host : ring.getHosts()) { servingStatusAggregator.aggregate(Hosts.computeServingStatusAggregator(host, domainGroup)); } return servingStatusAggregator; }
public static ServingStatusAggregator computeServingStatusAggregator(RingGroup ringGroup, DomainGroup domainGroup) throws IOException { ServingStatusAggregator servingStatusAggregator = new ServingStatusAggregator(); for (Ring ring : ringGroup.getRings()) { servingStatusAggregator.aggregate(Rings.computeServingStatusAggregator(ring, domainGroup)); } return servingStatusAggregator; }
public static ServingStatusAggregator computeServingStatusAggregator(Host host, DomainGroup domainGroup) throws IOException { ServingStatusAggregator result = new ServingStatusAggregator(); for (HostDomain hostDomain : host.getAssignedDomains()) { DomainAndVersion domainVersion = domainGroup.getDomainVersion(hostDomain.getDomain()); // Ignore domains that are not relevant if (domainVersion != null) { for (HostDomainPartition partition : hostDomain.getPartitions()) { // Ignore deletable partitions if (!partition.isDeletable()) { // Check if partition is served and up to date boolean servedAndUpToDate = host.getState() == HostState.SERVING && partition.getCurrentDomainVersion() != null && partition.getCurrentDomainVersion().equals(domainVersion.getVersionNumber()); // Aggregate counts result.add(hostDomain.getDomain(), partition.getPartitionNumber(), servedAndUpToDate); } } } } return result; }