public void delete()

in mode/cluster/repository/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/NacosRepository.java [294:313]


    public void delete(final String key) {
        try {
            for (ServiceMetaData each : serviceController.getAllServices()) {
                Collection<Instance> instances = findExistedInstance(each.isEphemeral()).stream()
                        .filter(instance -> {
                            String fullPath = NacosMetaDataUtils.getKey(instance);
                            return fullPath.startsWith(key + PATH_SEPARATOR) || key.equals(fullPath);
                        })
                        .sorted(Comparator.comparing(NacosMetaDataUtils::getKey).reversed()).collect(Collectors.toList());
                Collection<KeyValue> keyValues = new LinkedList<>();
                for (Instance instance : instances) {
                    client.deregisterInstance(each.getServiceName(), instance);
                    keyValues.add(new KeyValue(NacosMetaDataUtils.getKey(instance), null, each.isEphemeral()));
                }
                waitValue(keyValues);
            }
        } catch (final NacosException ex) {
            throw new ClusterRepositoryPersistException(ex);
        }
    }