From 2f33a8554a3e12880fda93811ef8675ca6f42767 Mon Sep 17 00:00:00 2001 From: wuyuhao Date: Fri, 26 Jul 2024 19:47:35 +0800 Subject: [PATCH] Update metadata_service_v2.proto --- .../DubboMetadataServiceV2Triple.java | 28 +-- .../{Revision.java => MetadataRequest.java} | 207 +++++++++--------- ...der.java => MetadataRequestOrBuilder.java} | 16 +- .../dubbo/metadata/MetadataServiceV2.java | 4 +- .../metadata/MetadataServiceV2OuterClass.java | 48 ++-- .../src/main/proto/metadata_service_v2.proto | 8 +- .../metadata/MetadataServiceDelegationV2.java | 8 +- .../client/metadata/MetadataUtils.java | 7 +- 8 files changed, 165 insertions(+), 161 deletions(-) rename dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/{Revision.java => MetadataRequest.java} (69%) rename dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/{RevisionOrBuilder.java => MetadataRequestOrBuilder.java} (76%) diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DubboMetadataServiceV2Triple.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DubboMetadataServiceV2Triple.java index 2cbb904e795..37cad3c89a9 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DubboMetadataServiceV2Triple.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/DubboMetadataServiceV2Triple.java @@ -63,32 +63,32 @@ public static MetadataServiceV2 newStub(Invoker invoker) { private static final StubMethodDescriptor getMetadataInfoMethod = new StubMethodDescriptor( "GetMetadataInfo", - Revision.class, + MetadataRequest.class, MetadataInfoV2.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), - Revision::parseFrom, + MetadataRequest::parseFrom, MetadataInfoV2::parseFrom); private static final StubMethodDescriptor getMetadataInfoAsyncMethod = new StubMethodDescriptor( "GetMetadataInfo", - Revision.class, + MetadataRequest.class, CompletableFuture.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), - Revision::parseFrom, + MetadataRequest::parseFrom, MetadataInfoV2::parseFrom); private static final StubMethodDescriptor getMetadataInfoProxyAsyncMethod = new StubMethodDescriptor( "GetMetadataInfoAsync", - Revision.class, + MetadataRequest.class, MetadataInfoV2.class, MethodDescriptor.RpcType.UNARY, obj -> ((Message) obj).toByteArray(), obj -> ((Message) obj).toByteArray(), - Revision::parseFrom, + MetadataRequest::parseFrom, MetadataInfoV2::parseFrom); static { @@ -104,15 +104,15 @@ public MetadataServiceV2Stub(Invoker invoker) { } @Override - public MetadataInfoV2 getMetadataInfo(Revision request) { + public MetadataInfoV2 getMetadataInfo(MetadataRequest request) { return StubInvocationUtil.unaryCall(invoker, getMetadataInfoMethod, request); } - public CompletableFuture getMetadataInfoAsync(Revision request) { + public CompletableFuture getMetadataInfoAsync(MetadataRequest request) { return StubInvocationUtil.unaryCall(invoker, getMetadataInfoAsyncMethod, request); } - public void getMetadataInfo(Revision request, StreamObserver responseObserver) { + public void getMetadataInfo(MetadataRequest request, StreamObserver responseObserver) { StubInvocationUtil.unaryCall(invoker, getMetadataInfoMethod, request, responseObserver); } } @@ -136,7 +136,7 @@ public void accept(T t, StreamObserver observer) { } @Override - public CompletableFuture getMetadataInfoAsync(Revision request) { + public CompletableFuture getMetadataInfoAsync(MetadataRequest request) { return CompletableFuture.completedFuture(getMetadataInfo(request)); } @@ -144,7 +144,7 @@ public CompletableFuture getMetadataInfoAsync(Revision request) * This server stream type unary method is only used for generated stub to support async unary method. * It will not be called if you are NOT using Dubbo3 generated triple stub and DO NOT implement this method. */ - public void getMetadataInfo(Revision request, StreamObserver responseObserver) { + public void getMetadataInfo(MetadataRequest request, StreamObserver responseObserver) { getMetadataInfoAsync(request).whenComplete((r, t) -> { if (t != null) { responseObserver.onError(t); @@ -168,9 +168,9 @@ public final Invoker getInvoker(URL url) { pathResolver.addNativeStub("/" + JAVA_SERVICE_NAME + "/GetMetadataInfo"); pathResolver.addNativeStub("/" + JAVA_SERVICE_NAME + "/GetMetadataInfoAsync"); - BiConsumer> getMetadataInfoFunc = this::getMetadataInfo; + BiConsumer> getMetadataInfoFunc = this::getMetadataInfo; handlers.put(getMetadataInfoMethod.getMethodName(), new UnaryStubMethodHandler<>(getMetadataInfoFunc)); - BiConsumer> getMetadataInfoAsyncFunc = + BiConsumer> getMetadataInfoAsyncFunc = syncToAsync(this::getMetadataInfo); handlers.put( getMetadataInfoProxyAsyncMethod.getMethodName(), @@ -180,7 +180,7 @@ public final Invoker getInvoker(URL url) { } @Override - public MetadataInfoV2 getMetadataInfo(Revision request) { + public MetadataInfoV2 getMetadataInfo(MetadataRequest request) { throw unimplementedMethodException(getMetadataInfoMethod); } diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/Revision.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequest.java similarity index 69% rename from dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/Revision.java rename to dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequest.java index e2001280577..c989693c43e 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/Revision.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequest.java @@ -17,68 +17,68 @@ package org.apache.dubbo.metadata; /** - * Protobuf type {@code org.apache.dubbo.metadata.Revision} + * Protobuf type {@code org.apache.dubbo.metadata.MetadataRequest} */ -public final class Revision extends com.google.protobuf.GeneratedMessageV3 +public final class MetadataRequest extends com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:org.apache.dubbo.metadata.Revision) - RevisionOrBuilder { + // @@protoc_insertion_point(message_implements:org.apache.dubbo.metadata.MetadataRequest) + MetadataRequestOrBuilder { private static final long serialVersionUID = 0L; - // Use Revision.newBuilder() to construct. - private Revision(com.google.protobuf.GeneratedMessageV3.Builder builder) { + // Use MetadataRequest.newBuilder() to construct. + private MetadataRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { super(builder); } - private Revision() { - value_ = ""; + private MetadataRequest() { + revision_ = ""; } @Override @SuppressWarnings({"unused"}) protected Object newInstance(UnusedPrivateParameter unused) { - return new Revision(); + return new MetadataRequest(); } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_Revision_descriptor; + return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { - return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_Revision_fieldAccessorTable - .ensureFieldAccessorsInitialized(Revision.class, Builder.class); + return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_MetadataRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized(MetadataRequest.class, Builder.class); } - public static final int VALUE_FIELD_NUMBER = 1; + public static final int REVISION_FIELD_NUMBER = 1; @SuppressWarnings("serial") - private volatile Object value_ = ""; + private volatile Object revision_ = ""; /** - * string value = 1; - * @return The value. + * string revision = 1; + * @return The revision. */ @Override - public String getValue() { - Object ref = value_; + public String getRevision() { + Object ref = revision_; if (ref instanceof String) { return (String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); - value_ = s; + revision_ = s; return s; } } /** - * string value = 1; - * @return The bytes for value. + * string revision = 1; + * @return The bytes for revision. */ @Override - public com.google.protobuf.ByteString getValueBytes() { - Object ref = value_; + public com.google.protobuf.ByteString getRevisionBytes() { + Object ref = revision_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; + revision_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; @@ -99,8 +99,8 @@ public final boolean isInitialized() { @Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, value_); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(revision_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, revision_); } getUnknownFields().writeTo(output); } @@ -111,8 +111,8 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(value_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, value_); + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(revision_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, revision_); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -124,12 +124,12 @@ public boolean equals(final Object obj) { if (obj == this) { return true; } - if (!(obj instanceof Revision)) { + if (!(obj instanceof MetadataRequest)) { return super.equals(obj); } - Revision other = (Revision) obj; + MetadataRequest other = (MetadataRequest) obj; - if (!getValue().equals(other.getValue())) return false; + if (!getRevision().equals(other.getRevision())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -141,69 +141,69 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + VALUE_FIELD_NUMBER; - hash = (53 * hash) + getValue().hashCode(); + hash = (37 * hash) + REVISION_FIELD_NUMBER; + hash = (53 * hash) + getRevision().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } - public static Revision parseFrom(java.nio.ByteBuffer data) + public static MetadataRequest parseFrom(java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static Revision parseFrom( + public static MetadataRequest parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static Revision parseFrom(com.google.protobuf.ByteString data) + public static MetadataRequest parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static Revision parseFrom( + public static MetadataRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static Revision parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + public static MetadataRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static Revision parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + public static MetadataRequest parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static Revision parseFrom(java.io.InputStream input) throws java.io.IOException { + public static MetadataRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static Revision parseFrom( + public static MetadataRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); } - public static Revision parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + public static MetadataRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); } - public static Revision parseDelimitedFrom( + public static MetadataRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input, extensionRegistry); } - public static Revision parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + public static MetadataRequest parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); } - public static Revision parseFrom( + public static MetadataRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input, extensionRegistry); @@ -218,7 +218,7 @@ public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } - public static Builder newBuilder(Revision prototype) { + public static Builder newBuilder(MetadataRequest prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @@ -233,23 +233,24 @@ protected Builder newBuilderForType(BuilderParent parent) { return builder; } /** - * Protobuf type {@code org.apache.dubbo.metadata.Revision} + * Protobuf type {@code org.apache.dubbo.metadata.MetadataRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements - // @@protoc_insertion_point(builder_implements:org.apache.dubbo.metadata.Revision) - RevisionOrBuilder { + // @@protoc_insertion_point(builder_implements:org.apache.dubbo.metadata.MetadataRequest) + MetadataRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_Revision_descriptor; + return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor; } @Override protected FieldAccessorTable internalGetFieldAccessorTable() { - return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_Revision_fieldAccessorTable - .ensureFieldAccessorsInitialized(Revision.class, Builder.class); + return MetadataServiceV2OuterClass + .internal_static_org_apache_dubbo_metadata_MetadataRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized(MetadataRequest.class, Builder.class); } - // Construct using org.apache.dubbo.metadata.Revision.newBuilder() + // Construct using org.apache.dubbo.metadata.MetadataRequest.newBuilder() private Builder() {} private Builder(BuilderParent parent) { @@ -260,23 +261,23 @@ private Builder(BuilderParent parent) { public Builder clear() { super.clear(); bitField0_ = 0; - value_ = ""; + revision_ = ""; return this; } @Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_Revision_descriptor; + return MetadataServiceV2OuterClass.internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor; } @Override - public Revision getDefaultInstanceForType() { - return Revision.getDefaultInstance(); + public MetadataRequest getDefaultInstanceForType() { + return MetadataRequest.getDefaultInstance(); } @Override - public Revision build() { - Revision result = buildPartial(); + public MetadataRequest build() { + MetadataRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -284,8 +285,8 @@ public Revision build() { } @Override - public Revision buildPartial() { - Revision result = new Revision(this); + public MetadataRequest buildPartial() { + MetadataRequest result = new MetadataRequest(this); if (bitField0_ != 0) { buildPartial0(result); } @@ -293,27 +294,27 @@ public Revision buildPartial() { return result; } - private void buildPartial0(Revision result) { + private void buildPartial0(MetadataRequest result) { int from_bitField0_ = bitField0_; if (((from_bitField0_ & 0x00000001) != 0)) { - result.value_ = value_; + result.revision_ = revision_; } } @Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof Revision) { - return mergeFrom((Revision) other); + if (other instanceof MetadataRequest) { + return mergeFrom((MetadataRequest) other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(Revision other) { - if (other == Revision.getDefaultInstance()) return this; - if (!other.getValue().isEmpty()) { - value_ = other.value_; + public Builder mergeFrom(MetadataRequest other) { + if (other == MetadataRequest.getDefaultInstance()) return this; + if (!other.getRevision().isEmpty()) { + revision_ = other.revision_; bitField0_ |= 0x00000001; onChanged(); } @@ -343,7 +344,7 @@ public Builder mergeFrom( done = true; break; case 10: { - value_ = input.readStringRequireUtf8(); + revision_ = input.readStringRequireUtf8(); bitField0_ |= 0x00000001; break; } // case 10 @@ -365,71 +366,71 @@ public Builder mergeFrom( private int bitField0_; - private Object value_ = ""; + private Object revision_ = ""; /** - * string value = 1; - * @return The value. + * string revision = 1; + * @return The revision. */ - public String getValue() { - Object ref = value_; + public String getRevision() { + Object ref = revision_; if (!(ref instanceof String)) { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; String s = bs.toStringUtf8(); - value_ = s; + revision_ = s; return s; } else { return (String) ref; } } /** - * string value = 1; - * @return The bytes for value. + * string revision = 1; + * @return The bytes for revision. */ - public com.google.protobuf.ByteString getValueBytes() { - Object ref = value_; + public com.google.protobuf.ByteString getRevisionBytes() { + Object ref = revision_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref); - value_ = b; + revision_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** - * string value = 1; - * @param value The value to set. + * string revision = 1; + * @param value The revision to set. * @return This builder for chaining. */ - public Builder setValue(String value) { + public Builder setRevision(String value) { if (value == null) { throw new NullPointerException(); } - value_ = value; + revision_ = value; bitField0_ |= 0x00000001; onChanged(); return this; } /** - * string value = 1; + * string revision = 1; * @return This builder for chaining. */ - public Builder clearValue() { - value_ = getDefaultInstance().getValue(); + public Builder clearRevision() { + revision_ = getDefaultInstance().getRevision(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** - * string value = 1; - * @param value The bytes for value to set. + * string revision = 1; + * @param value The bytes for revision to set. * @return This builder for chaining. */ - public Builder setValueBytes(com.google.protobuf.ByteString value) { + public Builder setRevisionBytes(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } checkByteStringIsUtf8(value); - value_ = value; + revision_ = value; bitField0_ |= 0x00000001; onChanged(); return this; @@ -445,24 +446,24 @@ public final Builder mergeUnknownFields(final com.google.protobuf.UnknownFieldSe return super.mergeUnknownFields(unknownFields); } - // @@protoc_insertion_point(builder_scope:org.apache.dubbo.metadata.Revision) + // @@protoc_insertion_point(builder_scope:org.apache.dubbo.metadata.MetadataRequest) } - // @@protoc_insertion_point(class_scope:org.apache.dubbo.metadata.Revision) - private static final Revision DEFAULT_INSTANCE; + // @@protoc_insertion_point(class_scope:org.apache.dubbo.metadata.MetadataRequest) + private static final MetadataRequest DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new Revision(); + DEFAULT_INSTANCE = new MetadataRequest(); } - public static Revision getDefaultInstance() { + public static MetadataRequest getDefaultInstance() { return DEFAULT_INSTANCE; } - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { @Override - public Revision parsePartialFrom( + public MetadataRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -481,17 +482,17 @@ public Revision parsePartialFrom( } }; - public static com.google.protobuf.Parser parser() { + public static com.google.protobuf.Parser parser() { return PARSER; } @Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } @Override - public Revision getDefaultInstanceForType() { + public MetadataRequest getDefaultInstanceForType() { return DEFAULT_INSTANCE; } } diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/RevisionOrBuilder.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequestOrBuilder.java similarity index 76% rename from dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/RevisionOrBuilder.java rename to dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequestOrBuilder.java index e8e15962464..4099bb21cec 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/RevisionOrBuilder.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataRequestOrBuilder.java @@ -16,19 +16,19 @@ */ package org.apache.dubbo.metadata; -public interface RevisionOrBuilder +public interface MetadataRequestOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.apache.dubbo.metadata.Revision) + // @@protoc_insertion_point(interface_extends:org.apache.dubbo.metadata.MetadataRequest) com.google.protobuf.MessageOrBuilder { /** - * string value = 1; - * @return The value. + * string revision = 1; + * @return The revision. */ - String getValue(); + String getRevision(); /** - * string value = 1; - * @return The bytes for value. + * string revision = 1; + * @return The bytes for revision. */ - com.google.protobuf.ByteString getValueBytes(); + com.google.protobuf.ByteString getRevisionBytes(); } diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2.java index 5ab55384039..d85df91a140 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2.java @@ -23,7 +23,7 @@ public interface MetadataServiceV2 extends org.apache.dubbo.rpc.model.DubboStub String JAVA_SERVICE_NAME = "org.apache.dubbo.metadata.MetadataServiceV2"; String SERVICE_NAME = "org.apache.dubbo.metadata.MetadataServiceV2"; - MetadataInfoV2 getMetadataInfo(Revision request); + MetadataInfoV2 getMetadataInfo(MetadataRequest request); - CompletableFuture getMetadataInfoAsync(Revision request); + CompletableFuture getMetadataInfoAsync(MetadataRequest request); } diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2OuterClass.java b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2OuterClass.java index ff1e6a2374b..01c1362d70e 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2OuterClass.java +++ b/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/MetadataServiceV2OuterClass.java @@ -26,9 +26,9 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r } static final com.google.protobuf.Descriptors.Descriptor - internal_static_org_apache_dubbo_metadata_Revision_descriptor; + internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_org_apache_dubbo_metadata_Revision_fieldAccessorTable; + internal_static_org_apache_dubbo_metadata_MetadataRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_org_apache_dubbo_metadata_MetadataInfoV2_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -55,33 +55,33 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { static { String[] descriptorData = { "\n\031metadata_service_v2.proto\022\031org.apache." - + "dubbo.metadata\"\031\n\010Revision\022\r\n\005value\030\001 \001(" - + "\t\"\324\001\n\016MetadataInfoV2\022\013\n\003app\030\001 \001(\t\022\017\n\007ver" - + "sion\030\002 \001(\t\022I\n\010services\030\003 \003(\01327.org.apach" - + "e.dubbo.metadata.MetadataInfoV2.Services" - + "Entry\032Y\n\rServicesEntry\022\013\n\003key\030\001 \001(\t\0227\n\005v" - + "alue\030\002 \001(\0132(.org.apache.dubbo.metadata.S" - + "erviceInfoV2:\0028\001\"\340\001\n\rServiceInfoV2\022\014\n\004na" - + "me\030\001 \001(\t\022\r\n\005group\030\002 \001(\t\022\017\n\007version\030\003 \001(\t" - + "\022\020\n\010protocol\030\004 \001(\t\022\014\n\004port\030\005 \001(\005\022\014\n\004path" - + "\030\006 \001(\t\022D\n\006params\030\007 \003(\01324.org.apache.dubb" - + "o.metadata.ServiceInfoV2.ParamsEntry\032-\n\013" - + "ParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:" - + "\0028\0012v\n\021MetadataServiceV2\022a\n\017GetMetadataI" - + "nfo\022#.org.apache.dubbo.metadata.Revision" - + "\032).org.apache.dubbo.metadata.MetadataInf" - + "oV2BO\n\031org.apache.dubbo.metadataP\001Z0dubb" - + "o.apache.org/dubbo-go/v3/metadata/triple" - + "_apib\006proto3" + + "dubbo.metadata\"#\n\017MetadataRequest\022\020\n\010rev" + + "ision\030\001 \001(\t\"\324\001\n\016MetadataInfoV2\022\013\n\003app\030\001 " + + "\001(\t\022\017\n\007version\030\002 \001(\t\022I\n\010services\030\003 \003(\01327" + + ".org.apache.dubbo.metadata.MetadataInfoV" + + "2.ServicesEntry\032Y\n\rServicesEntry\022\013\n\003key\030" + + "\001 \001(\t\0227\n\005value\030\002 \001(\0132(.org.apache.dubbo." + + "metadata.ServiceInfoV2:\0028\001\"\340\001\n\rServiceIn" + + "foV2\022\014\n\004name\030\001 \001(\t\022\r\n\005group\030\002 \001(\t\022\017\n\007ver" + + "sion\030\003 \001(\t\022\020\n\010protocol\030\004 \001(\t\022\014\n\004port\030\005 \001" + + "(\005\022\014\n\004path\030\006 \001(\t\022D\n\006params\030\007 \003(\01324.org.a" + + "pache.dubbo.metadata.ServiceInfoV2.Param" + + "sEntry\032-\n\013ParamsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005va" + + "lue\030\002 \001(\t:\0028\0012}\n\021MetadataServiceV2\022h\n\017Ge" + + "tMetadataInfo\022*.org.apache.dubbo.metadat" + + "a.MetadataRequest\032).org.apache.dubbo.met" + + "adata.MetadataInfoV2BZ\n\031org.apache.dubbo" + + ".metadataP\001Z;dubbo.apache.org/dubbo-go/v" + + "3/metadata/triple_api;triple_apib\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); - internal_static_org_apache_dubbo_metadata_Revision_descriptor = + internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_org_apache_dubbo_metadata_Revision_fieldAccessorTable = + internal_static_org_apache_dubbo_metadata_MetadataRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_org_apache_dubbo_metadata_Revision_descriptor, new String[] { - "Value", + internal_static_org_apache_dubbo_metadata_MetadataRequest_descriptor, new String[] { + "Revision", }); internal_static_org_apache_dubbo_metadata_MetadataInfoV2_descriptor = getDescriptor().getMessageTypes().get(1); diff --git a/dubbo-metadata/dubbo-metadata-api/src/main/proto/metadata_service_v2.proto b/dubbo-metadata/dubbo-metadata-api/src/main/proto/metadata_service_v2.proto index 709d35c1a1b..77c49d1021e 100644 --- a/dubbo-metadata/dubbo-metadata-api/src/main/proto/metadata_service_v2.proto +++ b/dubbo-metadata/dubbo-metadata-api/src/main/proto/metadata_service_v2.proto @@ -18,16 +18,16 @@ syntax = "proto3"; package org.apache.dubbo.metadata; -option go_package = "dubbo.apache.org/dubbo-go/v3/metadata/triple_api"; +option go_package = "dubbo.apache.org/dubbo-go/v3/metadata/triple_api;triple_api"; option java_package = "org.apache.dubbo.metadata"; option java_multiple_files = true; service MetadataServiceV2{ - rpc GetMetadataInfo(Revision) returns (MetadataInfoV2); + rpc GetMetadataInfo(MetadataRequest) returns (MetadataInfoV2); } -message Revision{ - string value = 1; +message MetadataRequest{ + string revision = 1; } message MetadataInfoV2{ diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataServiceDelegationV2.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataServiceDelegationV2.java index 1eec46e1952..10878cce00d 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataServiceDelegationV2.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataServiceDelegationV2.java @@ -22,6 +22,7 @@ import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.metadata.DubboMetadataServiceV2Triple.MetadataServiceV2ImplBase; import org.apache.dubbo.metadata.MetadataInfo; +import org.apache.dubbo.metadata.MetadataRequest; import org.apache.dubbo.registry.client.ServiceDiscovery; import org.apache.dubbo.registry.support.RegistryManager; import org.apache.dubbo.rpc.model.ApplicationModel; @@ -47,8 +48,8 @@ public MetadataServiceDelegationV2(ApplicationModel applicationModel) { } @Override - public org.apache.dubbo.metadata.MetadataInfoV2 getMetadataInfo(org.apache.dubbo.metadata.Revision revisionV2) { - String revision = revisionV2.getValue(); + public org.apache.dubbo.metadata.MetadataInfoV2 getMetadataInfo(MetadataRequest metadataRequestV2) { + String revision = metadataRequestV2.getRevision(); MetadataInfo info = null; if (StringUtils.isEmpty(revision)) { return null; @@ -63,7 +64,8 @@ public org.apache.dubbo.metadata.MetadataInfoV2 getMetadataInfo(org.apache.dubbo } if (logger.isWarnEnabled()) { - logger.warn(REGISTRY_FAILED_LOAD_METADATA, "", "", "metadataV2 not found for revision: " + revisionV2); + logger.warn( + REGISTRY_FAILED_LOAD_METADATA, "", "", "metadataV2 not found for revision: " + metadataRequestV2); } return null; } diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataUtils.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataUtils.java index 79c6208fad4..9c170eb8355 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataUtils.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/metadata/MetadataUtils.java @@ -24,10 +24,10 @@ import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.metadata.MetadataInfo; +import org.apache.dubbo.metadata.MetadataRequest; import org.apache.dubbo.metadata.MetadataService; import org.apache.dubbo.metadata.MetadataServiceV2; import org.apache.dubbo.metadata.MetadataServiceV2Detector; -import org.apache.dubbo.metadata.Revision; import org.apache.dubbo.metadata.definition.model.FullServiceDefinition; import org.apache.dubbo.metadata.report.MetadataReport; import org.apache.dubbo.metadata.report.MetadataReportInstance; @@ -343,8 +343,9 @@ public MetadataInfo getRemoteMetadata(String revision) { return ((MetadataService) existProxy).getMetadataInfo(revision); } else { return MetadataServiceVersionUtils.toV1(((MetadataServiceV2) existProxy) - .getMetadataInfo( - Revision.newBuilder().setValue(revision).build())); + .getMetadataInfo(MetadataRequest.newBuilder() + .setRevision(revision) + .build())); } } }