use of com.couchbase.client.core.config.PortInfo in project couchbase-jvm-clients by couchbase.
the class GlobalRefresher method filterEligibleNodes.
private Flux<PortInfo> filterEligibleNodes() {
return Flux.defer(() -> {
GlobalConfig config = provider.config().globalConfig();
if (config == null) {
// todo: log debug that no node found to refresh a config from
return Flux.empty();
}
List<PortInfo> nodes = new ArrayList<>(config.portInfos());
shiftNodeList(nodes);
return Flux.fromIterable(nodes).filter(n -> n.ports().containsKey(ServiceType.KV) || n.sslPorts().containsKey(ServiceType.KV)).take(MAX_PARALLEL_FETCH);
});
}
use of com.couchbase.client.core.config.PortInfo in project couchbase-jvm-clients by couchbase.
the class GlobalRefresher method attemptUpdateGlobalConfig.
private Flux<ProposedGlobalConfigContext> attemptUpdateGlobalConfig(final Flux<PortInfo> nodes) {
return nodes.flatMap(nodeInfo -> {
CoreContext ctx = core.context();
CarrierGlobalConfigRequest request = new CarrierGlobalConfigRequest(configRequestTimeout, ctx, FailFastRetryStrategy.INSTANCE, nodeInfo.identifier());
core.send(request);
return Reactor.wrap(request, request.response(), true).filter(response -> {
// TODO: debug event that it got ignored.
return response.status().success();
}).map(response -> new ProposedGlobalConfigContext(new String(response.content(), UTF_8), nodeInfo.hostname())).onErrorResume(t -> {
// TODO: raise a warning that fetching a config individual failed.
return Mono.empty();
});
});
}
Aggregations