From c60be223ac6e8caea679bc6f86fc50c437d00798 Mon Sep 17 00:00:00 2001 From: brycezhongqing Date: Tue, 17 Sep 2024 10:29:45 -0700 Subject: [PATCH] resolve all the comments --- .../java/com/linkedin/d2/xds/XdsClient.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/d2/src/main/java/com/linkedin/d2/xds/XdsClient.java b/d2/src/main/java/com/linkedin/d2/xds/XdsClient.java index 01a6eea879..cd90a03b59 100644 --- a/d2/src/main/java/com/linkedin/d2/xds/XdsClient.java +++ b/d2/src/main/java/com/linkedin/d2/xds/XdsClient.java @@ -123,8 +123,17 @@ final ResourceType getType() */ public abstract void onReconnect(); + /** + * Called when a resource is added or updated. + * @param resourceName the name of the resource that was added or updated. + * @param update the new data {@link ResourceUpdate} for the resource. + */ abstract void onChanged(String resourceName, ResourceUpdate update); + /** + * Called when a resource is removed. + * @param resourceName the name of the resource that was removed. + */ public abstract void onRemoval(String resourceName); } @@ -135,6 +144,11 @@ public WildcardNodeResourceWatcher() super(ResourceType.NODE); } + /** + * Called when a node resource is added or updated. + * @param resourceName the resource name of the {@link NodeUpdate} that was added or updated. + * @param update the new data for the {@link NodeUpdate}, including D2 cluster and service information. + */ public abstract void onChanged(String resourceName, NodeUpdate update); @Override @@ -151,6 +165,13 @@ public WildcardD2URIMapResourceWatcher() super(ResourceType.D2_URI_MAP); } + /** + * Called when a {@link D2URIMapUpdate} resource is added or updated. + * @param resourceName the resource name of the {@link D2URIMapUpdate} map resource that was added or updated. + * like the + * /d2/uris/clusterName + * @param update the new data for the {@link D2URIMapUpdate} resource + */ public abstract void onChanged(String resourceName, D2URIMapUpdate update); @Override