Skip to content

Commit

Permalink
Merge branch 'master' into idarmans/symbol-id
Browse files Browse the repository at this point in the history
  • Loading branch information
idarmans authored Sep 24, 2024
2 parents d5ed10d + e0b2683 commit c1a73a4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 326 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ and what APIs have changed, if applicable.

## [Unreleased]

## [29.58.8] - 2024-09-19
## [29.58.9] - 2024-09-19
- Add symbol ID in the exception message when protobuf fails to resolve string references.

## [29.58.8] - 2024-09-23
- Revert Add WildcardResourceSubscriber which could subscribe to all resources, like NODE and URIMap resources.

## [29.58.7] - 2024-09-13
- Add WildcardResourceSubscriber which could subscribe to all resources, like NODE and URIMap resources.

Expand Down
116 changes: 6 additions & 110 deletions d2/src/main/java/com/linkedin/d2/xds/XdsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,91 +95,6 @@ final void onChanged(ResourceUpdate update)
}
}

public static abstract class WildcardResourceWatcher
{
private final ResourceType _type;

/**
* Defining a private constructor means only classes that are defined in this file can extend this class (see
* {@link ResourceWatcher}).
*/
WildcardResourceWatcher(ResourceType type)
{
_type = type;
}

final ResourceType getType()
{
return _type;
}

/**
* Called when the resource discovery RPC encounters some transient error.
*/
public abstract void onError(Status error);

/**
* Called when the resource discovery RPC reestablishes connection.
*/
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);
}

public static abstract class WildcardNodeResourceWatcher extends WildcardResourceWatcher
{
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
final void onChanged(String resourceName, ResourceUpdate update)
{
onChanged(resourceName, (NodeUpdate) update);
}
}

public static abstract class WildcardD2URIMapResourceWatcher extends WildcardResourceWatcher
{
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
final void onChanged(String resourceName, ResourceUpdate update)
{
onChanged(resourceName, (D2URIMapUpdate) update);
}
}

public interface ResourceUpdate
{
boolean isValid();
Expand All @@ -194,7 +109,7 @@ public static final class NodeUpdate implements ResourceUpdate
_nodeData = nodeData;
}

public XdsD2.Node getNodeData()
XdsD2.Node getNodeData()
{
return _nodeData;
}
Expand Down Expand Up @@ -346,32 +261,13 @@ static ResourceType fromTypeUrl(String typeUrl)
* will always notify the given watcher of the current data if it is already present, even if the given watcher was
* already subscribed to said resource. However, the subscription will only be added once.
*/
public abstract void watchXdsResource(String resourceName, ResourceWatcher watcher);
abstract void watchXdsResource(String resourceName, ResourceWatcher watcher);

/**
* Subscribes the given {@link WildcardResourceWatcher} to all the resources of the corresponding type. The watcher
* will be notified whenever a resource is added or removed. Repeated calls to this function with the same watcher
* will always notify the given watcher of the current data.
*/
public abstract void watchAllXdsResources(WildcardResourceWatcher watcher);
abstract void startRpcStream();

/**
* Initiates the RPC stream to the xDS server.
*/
public abstract void startRpcStream();

/**
* Shuts down the xDS client.
*/
public abstract void shutdown();
abstract void shutdown();

/**
* Returns the authority of the xDS server.
*/
public abstract String getXdsServerAuthority();
abstract String getXdsServerAuthority();

/**
* Returns the JMX bean for the xDS client.
*/
public abstract XdsClientJmx getXdsClientJmx();
abstract public XdsClientJmx getXdsClientJmx();
}
Loading

0 comments on commit c1a73a4

Please sign in to comment.