Skip to content

Commit

Permalink
Polish #6296 : Adding the new methods into MetadataReport to manipula…
Browse files Browse the repository at this point in the history
…te the exported URLs for service introspection (#6299)
  • Loading branch information
mercyblitz authored Jun 10, 2020
1 parent 91989ca commit 951955a
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@


import org.apache.dubbo.common.URL;
import org.apache.dubbo.metadata.URLRevisionResolver;
import org.apache.dubbo.metadata.definition.model.ServiceDefinition;
import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.ServiceMetadataIdentifier;
import org.apache.dubbo.metadata.report.identifier.SubscriberMetadataIdentifier;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;

import static org.apache.dubbo.rpc.model.ApplicationModel.getName;

/**
*
*/
Expand All @@ -47,4 +52,52 @@ public interface MetadataReport {
List<String> getSubscribedURLs(SubscriberMetadataIdentifier subscriberMetadataIdentifier);

String getServiceDefinition(MetadataIdentifier metadataIdentifier);

/**
* Save the exported {@link URL urls} in bulk.
*
* @param exportedURLs the exported {@link URL urls}
* @return If successful, return <code>true</code>, or <code>false</code>
* @since 2.7.8
*/
default boolean saveExportedURLs(Collection<URL> exportedURLs) {
return saveExportedURLs(getName(), exportedURLs);
}

/**
* Save the exported {@link URL urls} in bulk.
*
* @param serviceName the specified Dubbo service name
* @param exportedURLs the exported {@link URL urls}
* @return If successful, return <code>true</code>, or <code>false</code>
* @since 2.7.8
*/
default boolean saveExportedURLs(String serviceName, Collection<URL> exportedURLs) {
return saveExportedURLs(serviceName, new URLRevisionResolver().resolve(exportedURLs), exportedURLs);
}

/**
* Save the exported {@link URL urls} in bulk.
*
* @param serviceName the specified Dubbo service name
* @param exportedServicesRevision the revision of the exported Services
* @param exportedURLs the exported {@link URL urls}
* @return If successful, return <code>true</code>, or <code>false</code>
* @since 2.7.8
*/
default boolean saveExportedURLs(String serviceName, String exportedServicesRevision, Collection<URL> exportedURLs) {
return true;
}

/**
* Get the {@link URL#toFullString() strings} presenting the {@link URL URLs} that were exported by the provider
*
* @param serviceName the specified Dubbo service name
* @param exportedServicesRevision the revision of the exported Services
* @return non-null
* @since 2.7.8
*/
default List<String> getExportedURLs(String serviceName, String exportedServicesRevision) {
return Collections.emptyList();
}
}

0 comments on commit 951955a

Please sign in to comment.