in mode/cluster/repository/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java [177:196]
public List<String> getChildrenKeys(final String key) {
try {
Stream<String> concatKeys = Stream.empty();
for (ServiceMetaData each : serviceController.getAllServices()) {
Stream<String> keys = findExistedInstance(each.isEphemeral()).stream()
.map(instance -> {
String fullPath = NacosMetaDataUtils.getKey(instance);
if (fullPath.startsWith(key + PATH_SEPARATOR)) {
String pathWithoutPrefix = fullPath.substring((key + PATH_SEPARATOR).length());
return pathWithoutPrefix.contains(PATH_SEPARATOR) ? pathWithoutPrefix.substring(0, pathWithoutPrefix.indexOf(PATH_SEPARATOR)) : pathWithoutPrefix;
}
return null;
}).filter(Objects::nonNull);
concatKeys = Stream.concat(concatKeys, keys);
}
return concatKeys.distinct().sorted(Comparator.reverseOrder()).collect(Collectors.toList());
} catch (final NacosException ex) {
throw new ClusterRepositoryPersistException(ex);
}
}