@Test public void requireThatVipStatusIsDefaultDownWithLocalDispatch() { try (State test = new State("cluster.1", 1, HostName.getLocalhost(), "b")) { assertTrue(test.searchCluster.localCorpusDispatchTarget().isPresent()); assertFalse(test.vipStatus.isInRotation()); test.waitOneFullPingRound(); assertTrue(test.vipStatus.isInRotation()); } }
public Optional<Node> localCorpusDispatchTarget() { if ( localCorpusDispatchTarget.isEmpty()) return Optional.empty(); Group localSearchGroup = groups().get(localCorpusDispatchTarget.get().group()); if ( ! localSearchGroup.hasSufficientCoverage()) return Optional.empty(); if ( localCorpusDispatchTarget.get().isWorking() == Boolean.FALSE) return Optional.empty(); return localCorpusDispatchTarget; }
SearchCluster implements NodeManager<Node> { public Optional<Node> localCorpusDispatchTarget() { if ( localCorpusDispatchTarget.isEmpty()) return Optional.empty(); Group localSearchGroup = groups().get(localCorpusDispatchTarget.get().group()); if ( ! localSearchGroup.hasSufficientCoverage()) return Optional.empty(); if ( localCorpusDispatchTarget.get().isWorking() == Boolean.FALSE) return Optional.empty(); return localCorpusDispatchTarget; } }
SearchCluster implements NodeManager<Node> { public Optional<Node> localCorpusDispatchTarget() { if ( localCorpusDispatchTarget.isEmpty()) return Optional.empty(); Group localSearchGroup = groups().get(localCorpusDispatchTarget.get().group()); if ( ! localSearchGroup.hasSufficientCoverage()) return Optional.empty(); if ( localCorpusDispatchTarget.get().isWorking() == Boolean.FALSE) return Optional.empty(); return localCorpusDispatchTarget; } SearchCluster(String clusterId, DispatchConfig dispatchConfig, int containerClusterSize,
                         VipStatus vipStatus, PingFactory pingFactory);  SearchCluster(String clusterId, DispatchConfig dispatchConfig,
                         VipStatus vipStatus, PingFactory pingFactory); }
SearchCluster implements NodeManager<Node> { public Optional<Node> localCorpusDispatchTarget() { if ( localCorpusDispatchTarget.isEmpty()) return Optional.empty(); Group localSearchGroup = groups().get(localCorpusDispatchTarget.get().group()); if ( ! localSearchGroup.hasSufficientCoverage()) return Optional.empty(); if ( localCorpusDispatchTarget.get().isWorking() == Boolean.FALSE) return Optional.empty(); return localCorpusDispatchTarget; } SearchCluster(String clusterId, DispatchConfig dispatchConfig, int containerClusterSize,
                         VipStatus vipStatus, PingFactory pingFactory);  SearchCluster(String clusterId, DispatchConfig dispatchConfig,
                         VipStatus vipStatus, PingFactory pingFactory); void addMonitoring(ClusterMonitor clusterMonitor); DispatchConfig dispatchConfig(); int size(); ImmutableMap<Integer, Group> groups(); ImmutableList<Group> orderedGroups(); Optional<Group> group(int n); int groupSize(); int groupsWithSufficientCoverage(); Optional<Node> localCorpusDispatchTarget(); @Override void working(Node node); @Override void failed(Node node); int estimateHitsToFetch(int wantedHits, int numPartitions); int estimateHitsToFetch(int wantedHits, int numPartitions, double topKProbability); boolean hasInformationAboutAllNodes(); @Override void ping(ClusterMonitor clusterMonitor, Node node, Executor executor); @Override void pingIterationCompleted(); boolean isPartialGroupCoverageSufficient(OptionalInt knownGroupId, List<Node> nodes); }
SearchCluster implements NodeManager<Node> { public Optional<Node> localCorpusDispatchTarget() { if ( localCorpusDispatchTarget.isEmpty()) return Optional.empty(); Group localSearchGroup = groups().get(localCorpusDispatchTarget.get().group()); if ( ! localSearchGroup.hasSufficientCoverage()) return Optional.empty(); if ( localCorpusDispatchTarget.get().isWorking() == Boolean.FALSE) return Optional.empty(); return localCorpusDispatchTarget; } SearchCluster(String clusterId, DispatchConfig dispatchConfig, int containerClusterSize,
                         VipStatus vipStatus, PingFactory pingFactory);  SearchCluster(String clusterId, DispatchConfig dispatchConfig,
                         VipStatus vipStatus, PingFactory pingFactory); void addMonitoring(ClusterMonitor clusterMonitor); DispatchConfig dispatchConfig(); int size(); ImmutableMap<Integer, Group> groups(); ImmutableList<Group> orderedGroups(); Optional<Group> group(int n); int groupSize(); int groupsWithSufficientCoverage(); Optional<Node> localCorpusDispatchTarget(); @Override void working(Node node); @Override void failed(Node node); int estimateHitsToFetch(int wantedHits, int numPartitions); int estimateHitsToFetch(int wantedHits, int numPartitions, double topKProbability); boolean hasInformationAboutAllNodes(); @Override void ping(ClusterMonitor clusterMonitor, Node node, Executor executor); @Override void pingIterationCompleted(); boolean isPartialGroupCoverageSufficient(OptionalInt knownGroupId, List<Node> nodes);  }