From 3ec052328a7db815794feb3c6e74eee4aa058997 Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 16:51:41 +0800 Subject: [PATCH 1/6] fix: User-controlled data in numeric cast [#1987] --- .../api/traversers/AdamicAdarAPI.java | 2 +- .../api/traversers/ResourceAllocationAPI.java | 2 +- .../api/traversers/SameNeighborsAPI.java | 2 +- .../algorithm/PredictionTraverser.java | 6 +- .../algorithm/SameNeighborTraverser.java | 4 +- .../backend/store/raft/rpc/RaftRequests.java | 862 +++++++----------- 6 files changed, 351 insertions(+), 527 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java index f8bcd5d60a..2f3dc115e7 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java @@ -67,7 +67,7 @@ public String get(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get adamic adar between '{}' and '{}' with " + "direction {}, edge label {}, max degree '{}' and limit '{}'", graph, current, other, direction, edgeLabel, maxDegree, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java index 5c4b1e8b2f..ed729ad1c5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java @@ -67,7 +67,7 @@ public String create(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get resource allocation between '{}' and '{}' " + "with direction {}, edge label {}, max degree '{}' and " + "limit '{}'", graph, current, other, direction, edgeLabel, diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java index 6d87ec1d07..dbe49be53f 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java @@ -67,7 +67,7 @@ public String get(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get same neighbors between '{}' and '{}' with " + "direction {}, edge label {}, max degree '{}' and limit '{}'", graph, vertex, other, direction, edgeLabel, maxDegree, limit); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java index da6e924a8f..86191453de 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/PredictionTraverser.java @@ -35,7 +35,7 @@ public PredictionTraverser(HugeGraph graph) { } public double adamicAdar(Id source, Id target, Directions dir, - String label, long degree, long limit) { + String label, long degree, int limit) { Set neighbors = checkAndGetCommonNeighbors(source, target, dir, label, degree, limit); EdgeStep step = label == null ? new EdgeStep(graph(), dir) : @@ -52,7 +52,7 @@ public double adamicAdar(Id source, Id target, Directions dir, } public double resourceAllocation(Id source, Id target, Directions dir, - String label, long degree, long limit) { + String label, long degree, int limit) { Set neighbors = checkAndGetCommonNeighbors(source, target, dir, label, degree, limit); EdgeStep step = label == null ? new EdgeStep(graph(), dir) : @@ -70,7 +70,7 @@ public double resourceAllocation(Id source, Id target, Directions dir, private Set checkAndGetCommonNeighbors(Id source, Id target, Directions dir, String label, - long degree, long limit) { + long degree, int limit) { E.checkNotNull(source, "source id"); E.checkNotNull(target, "the target id"); this.checkVertexExist(source, "source"); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java index 6cb14b6db8..cafcd9059f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/SameNeighborTraverser.java @@ -36,7 +36,7 @@ public SameNeighborTraverser(HugeGraph graph) { } public Set sameNeighbors(Id vertex, Id other, Directions direction, - String label, long degree, long limit) { + String label, long degree, int limit) { E.checkNotNull(vertex, "vertex id"); E.checkNotNull(other, "the other vertex id"); this.checkVertexExist(vertex, "vertex"); @@ -54,7 +54,7 @@ public Set sameNeighbors(Id vertex, Id other, Directions direction, Set sameNeighbors = (Set) CollectionUtil.intersect( sourceNeighbors, targetNeighbors); if (limit != NO_LIMIT) { - int end = Math.min(sameNeighbors.size(), (int) limit); + int end = Math.min(sameNeighbors.size(), limit); sameNeighbors = CollectionUtil.subSet(sameNeighbors, 0, end); } return sameNeighbors; diff --git a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 2b1da29ffd..5c527cf86a 100644 --- a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -1,22 +1,3 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: raft.proto @@ -391,75 +372,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = rawValue; - } - break; - } - case 16: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - action_ = rawValue; - } - break; - } - case 26: { - bitField0_ |= 0x00000004; - data_ = input.readBytes(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandRequest_descriptor; @@ -566,7 +478,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, data_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -587,7 +499,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, data_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -615,7 +527,7 @@ public boolean equals(final java.lang.Object obj) { if (!getData() .equals(other.getData())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -638,7 +550,7 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -755,18 +667,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -875,7 +782,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasData()) { setData(other.getData()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -899,17 +806,59 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(1, tmpRaw); + } else { + type_ = tmpRaw; + bitField0_ |= 0x00000001; + } + break; + } // case 8 + case 16: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(2, tmpRaw); + } else { + action_ = tmpRaw; + bitField0_ |= 0x00000002; + } + break; + } // case 16 + case 26: { + data_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1074,7 +1023,18 @@ public StoreCommandRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1154,57 +1114,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandResponse_descriptor; @@ -1310,7 +1219,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -1326,7 +1235,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -1351,7 +1260,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1371,7 +1280,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -1488,18 +1397,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -1601,7 +1505,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -1619,17 +1523,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1789,7 +1716,18 @@ public StoreCommandResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1869,57 +1807,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private CommonResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_CommonResponse_descriptor; @@ -2025,7 +1912,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2041,7 +1928,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2066,7 +1953,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2086,7 +1973,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2203,18 +2090,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2316,7 +2198,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2334,17 +2216,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -2504,7 +2409,18 @@ public CommonResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new CommonResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -2555,45 +2471,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersRequest_descriptor; @@ -2621,7 +2498,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2630,7 +2507,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2645,7 +2522,7 @@ public boolean equals(final java.lang.Object obj) { } com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2656,7 +2533,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2773,18 +2650,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2863,7 +2735,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other) { if (other == com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2878,17 +2750,30 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @java.lang.Override @@ -2924,7 +2809,18 @@ public ListPeersRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3016,71 +2912,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000002; - } - endpoints_.add(bs); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = endpoints_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersResponse_descriptor; @@ -3184,7 +3015,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < endpoints_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, endpoints_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3205,7 +3036,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getEndpointsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -3227,7 +3058,7 @@ public boolean equals(final java.lang.Object obj) { } if (!getEndpointsList() .equals(other.getEndpointsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -3246,7 +3077,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINTS_FIELD_NUMBER; hash = (53 * hash) + getEndpointsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -3491,7 +3322,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -3512,17 +3343,43 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + ensureEndpointsIsMutable(); + endpoints_.add(bs); + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -3788,7 +3645,18 @@ public ListPeersResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3857,52 +3725,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - endpoint_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderRequest_descriptor; @@ -3986,7 +3808,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3998,7 +3820,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4018,7 +3840,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEndpoint() .equals(other.getEndpoint())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4033,7 +3855,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4150,18 +3972,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -4254,7 +4071,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests endpoint_ = other.endpoint_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4272,17 +4089,35 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + endpoint_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -4403,7 +4238,18 @@ public SetLeaderRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -4469,59 +4315,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderResponse_descriptor; @@ -4587,7 +4380,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getCommon()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -4600,7 +4393,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getCommon()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4620,7 +4413,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCommon() .equals(other.getCommon())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4635,7 +4428,7 @@ public int hashCode() { hash = (37 * hash) + COMMON_FIELD_NUMBER; hash = (53 * hash) + getCommon().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4863,7 +4656,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasCommon()) { mergeCommon(other.getCommon()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4884,17 +4677,37 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -5051,7 +4864,18 @@ public SetLeaderResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; From 0909d427f547936ec43b6ad64cecf439450f360e Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 17:34:27 +0800 Subject: [PATCH 2/6] restore RaftRequests.java --- .../backend/store/raft/rpc/RaftRequests.java | 862 +++++++++++------- 1 file changed, 519 insertions(+), 343 deletions(-) diff --git a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 5c527cf86a..2b1da29ffd 100644 --- a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: raft.proto @@ -372,6 +391,75 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private StoreCommandRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + type_ = rawValue; + } + break; + } + case 16: { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + action_ = rawValue; + } + break; + } + case 26: { + bitField0_ |= 0x00000004; + data_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandRequest_descriptor; @@ -478,7 +566,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, data_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -499,7 +587,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, data_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -527,7 +615,7 @@ public boolean equals(final java.lang.Object obj) { if (!getData() .equals(other.getData())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -550,7 +638,7 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -667,13 +755,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -782,7 +875,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasData()) { setData(other.getData()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -806,59 +899,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - int tmpRaw = input.readEnum(); - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType tmpValue = - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.forNumber(tmpRaw); - if (tmpValue == null) { - mergeUnknownVarintField(1, tmpRaw); - } else { - type_ = tmpRaw; - bitField0_ |= 0x00000001; - } - break; - } // case 8 - case 16: { - int tmpRaw = input.readEnum(); - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction tmpValue = - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.forNumber(tmpRaw); - if (tmpValue == null) { - mergeUnknownVarintField(2, tmpRaw); - } else { - action_ = tmpRaw; - bitField0_ |= 0x00000002; - } - break; - } // case 16 - case 26: { - data_ = input.readBytes(); - bitField0_ |= 0x00000004; - break; - } // case 26 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -1023,18 +1074,7 @@ public StoreCommandRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new StoreCommandRequest(input, extensionRegistry); } }; @@ -1114,6 +1154,57 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private StoreCommandResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + bitField0_ |= 0x00000001; + status_ = input.readBool(); + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + message_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandResponse_descriptor; @@ -1219,7 +1310,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -1235,7 +1326,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -1260,7 +1351,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1280,7 +1371,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -1397,13 +1488,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -1505,7 +1601,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -1523,40 +1619,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - status_ = input.readBool(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - message_ = input.readBytes(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -1716,18 +1789,7 @@ public StoreCommandResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new StoreCommandResponse(input, extensionRegistry); } }; @@ -1807,6 +1869,57 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private CommonResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + bitField0_ |= 0x00000001; + status_ = input.readBool(); + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + message_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_CommonResponse_descriptor; @@ -1912,7 +2025,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -1928,7 +2041,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -1953,7 +2066,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1973,7 +2086,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -2090,13 +2203,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -2198,7 +2316,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -2216,40 +2334,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - status_ = input.readBool(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - message_ = input.readBytes(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -2409,18 +2504,7 @@ public CommonResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new CommonResponse(input, extensionRegistry); } }; @@ -2471,6 +2555,45 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private ListPeersRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersRequest_descriptor; @@ -2498,7 +2621,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -2507,7 +2630,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -2522,7 +2645,7 @@ public boolean equals(final java.lang.Object obj) { } com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) obj; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -2533,7 +2656,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -2650,13 +2773,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -2735,7 +2863,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other) { if (other == com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -2750,30 +2878,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } @java.lang.Override @@ -2809,18 +2924,7 @@ public ListPeersRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new ListPeersRequest(input, extensionRegistry); } }; @@ -2912,6 +3016,71 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private ListPeersResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) != 0)) { + subBuilder = common_.toBuilder(); + } + common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(common_); + common_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + endpoints_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + endpoints_.add(bs); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) != 0)) { + endpoints_ = endpoints_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersResponse_descriptor; @@ -3015,7 +3184,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < endpoints_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, endpoints_.getRaw(i)); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -3036,7 +3205,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getEndpointsList().size(); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -3058,7 +3227,7 @@ public boolean equals(final java.lang.Object obj) { } if (!getEndpointsList() .equals(other.getEndpointsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -3077,7 +3246,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINTS_FIELD_NUMBER; hash = (53 * hash) + getEndpointsList().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -3322,7 +3491,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests } onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -3343,43 +3512,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - input.readMessage( - getCommonFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - ensureEndpointsIsMutable(); - endpoints_.add(bs); - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -3645,18 +3788,7 @@ public ListPeersResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new ListPeersResponse(input, extensionRegistry); } }; @@ -3725,6 +3857,52 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private SetLeaderRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + endpoint_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderRequest_descriptor; @@ -3808,7 +3986,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -3820,7 +3998,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -3840,7 +4018,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEndpoint() .equals(other.getEndpoint())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -3855,7 +4033,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -3972,13 +4150,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -4071,7 +4254,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests endpoint_ = other.endpoint_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -4089,35 +4272,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - endpoint_ = input.readBytes(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -4238,18 +4403,7 @@ public SetLeaderRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new SetLeaderRequest(input, extensionRegistry); } }; @@ -4315,6 +4469,59 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private SetLeaderResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) != 0)) { + subBuilder = common_.toBuilder(); + } + common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(common_); + common_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderResponse_descriptor; @@ -4380,7 +4587,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getCommon()); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -4393,7 +4600,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getCommon()); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -4413,7 +4620,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCommon() .equals(other.getCommon())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -4428,7 +4635,7 @@ public int hashCode() { hash = (37 * hash) + COMMON_FIELD_NUMBER; hash = (53 * hash) + getCommon().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -4656,7 +4863,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasCommon()) { mergeCommon(other.getCommon()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -4677,37 +4884,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - input.readMessage( - getCommonFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -4864,18 +5051,7 @@ public SetLeaderResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new SetLeaderResponse(input, extensionRegistry); } }; From 619d4169481a2194d7ca1794dda59bdbcdbbc5d5 Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 17:44:00 +0800 Subject: [PATCH 3/6] all algorithm limit type change to int --- .../api/traversers/CrosspointsAPI.java | 2 +- .../traversers/CustomizedCrosspointsAPI.java | 2 +- .../api/traversers/CustomizedPathsAPI.java | 2 +- .../api/traversers/FusiformSimilarityAPI.java | 2 +- .../api/traversers/KneighborAPI.java | 4 +- .../hugegraph/api/traversers/KoutAPI.java | 4 +- .../hugegraph/api/traversers/PathsAPI.java | 4 +- .../api/traversers/PersonalRankAPI.java | 2 +- .../hugegraph/api/traversers/RaysAPI.java | 2 +- .../hugegraph/api/traversers/RingsAPI.java | 2 +- .../SingleSourceShortestPathAPI.java | 2 +- .../api/traversers/TemplatePathsAPI.java | 2 +- .../backend/store/BackendStoreInfo.java | 1 - .../RoleElectionStateMachineImpl.java | 2 +- .../com/baidu/hugegraph/util/RateLimiter.java | 2 - .../backend/store/raft/rpc/RaftRequests.java | 862 +++++++----------- 16 files changed, 359 insertions(+), 538 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java index 689df287b9..a1e00c4e7e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java @@ -70,7 +70,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) { + @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) { LOG.debug("Graph [{}] get crosspoints with paths from '{}', to '{}' " + "with direction '{}', edge label '{}', max depth '{}', " + "max degree '{}', capacity '{}' and limit '{}'", diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java index 5af4a3cb22..0eb599dcc5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java @@ -141,7 +141,7 @@ private static class CrosspointsRequest { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT); @JsonProperty("with_path") public boolean withPath = false; @JsonProperty("with_vertex") diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java index 3c1d9559a5..530589c5fb 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java @@ -141,7 +141,7 @@ private static class PathRequest { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT); @JsonProperty("with_vertex") public boolean withVertex = false; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java index 6a34e9e6fd..716bc2a615 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java @@ -146,7 +146,7 @@ private static class FusiformSimilarityRequest { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT); @JsonProperty("with_intermediary") public boolean withIntermediary = false; @JsonProperty("with_vertex") diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java index 71e85b5288..11b017b31d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java @@ -81,7 +81,7 @@ public String get(@Context GraphManager manager, @QueryParam("max_degree") @DefaultValue(DEFAULT_MAX_DEGREE) long maxDegree, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get k-neighbor from '{}' with " + "direction '{}', edge label '{}', max depth '{}', " + "max degree '{}' and limit '{}'", @@ -172,7 +172,7 @@ private static class Request { @JsonProperty("max_depth") public int maxDepth; @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_ELEMENTS_LIMIT); @JsonProperty("count_only") public boolean countOnly = false; @JsonProperty("with_vertex") diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java index ef315dd36a..8d017182f3 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java @@ -86,7 +86,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_ELEMENTS_LIMIT) long limit) { + @DefaultValue(DEFAULT_ELEMENTS_LIMIT) int limit) { LOG.debug("Graph [{}] get k-out from '{}' with " + "direction '{}', edge label '{}', max depth '{}', nearest " + "'{}', max degree '{}', capacity '{}' and limit '{}'", @@ -188,7 +188,7 @@ private static class Request { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_ELEMENTS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_ELEMENTS_LIMIT); @JsonProperty("with_vertex") public boolean withVertex = false; @JsonProperty("with_path") diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java index fa87db58a2..517d127f23 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java @@ -83,7 +83,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) { + @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) { LOG.debug("Graph [{}] get paths from '{}', to '{}' with " + "direction {}, edge label {}, max depth '{}', " + "max degree '{}', capacity '{}' and limit '{}'", @@ -169,7 +169,7 @@ private static class Request { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT); @JsonProperty("with_vertex") public boolean withVertex = false; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java index da74ef04bd..66df0bcb32 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java @@ -121,7 +121,7 @@ private static class RankRequest { @JsonProperty("max_degree") private long maxDegree = Long.parseLong(DEFAULT_MAX_DEGREE); @JsonProperty("limit") - private long limit = Long.parseLong(DEFAULT_LIMIT); + private int limit = Integer.parseInt(DEFAULT_LIMIT); @JsonProperty("max_depth") private int maxDepth = DEFAULT_DEPTH; @JsonProperty("with_label") diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java index 321b4eb2c2..34f9364b94 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java @@ -69,7 +69,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) { + @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) { LOG.debug("Graph [{}] get rays paths from '{}' with " + "direction '{}', edge label '{}', max depth '{}', " + "max degree '{}', capacity '{}' and limit '{}'", diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java index 0bb1cb0a5c..70f75b41f5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java @@ -71,7 +71,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_PATHS_LIMIT) long limit) { + @DefaultValue(DEFAULT_PATHS_LIMIT) int limit) { LOG.debug("Graph [{}] get rings paths reachable from '{}' with " + "direction '{}', edge label '{}', max depth '{}', " + "source in ring '{}', max degree '{}', capacity '{}' " + diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java index fd3ebd345d..3fc5251391 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java @@ -75,7 +75,7 @@ public String get(@Context GraphManager manager, @QueryParam("capacity") @DefaultValue(DEFAULT_CAPACITY) long capacity, @QueryParam("limit") - @DefaultValue(DEFAULT_PATHS_LIMIT) long limit, + @DefaultValue(DEFAULT_PATHS_LIMIT) int limit, @QueryParam("with_vertex") boolean withVertex) { LOG.debug("Graph [{}] get single source shortest path from '{}' " + "with direction {}, edge label {}, weight property {}, " + diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java index b593aa0a7e..ccd5713c1a 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java @@ -136,7 +136,7 @@ private static class Request { @JsonProperty("capacity") public long capacity = Long.parseLong(DEFAULT_CAPACITY); @JsonProperty("limit") - public long limit = Long.parseLong(DEFAULT_PATHS_LIMIT); + public int limit = Integer.parseInt(DEFAULT_PATHS_LIMIT); @JsonProperty("with_vertex") public boolean withVertex = false; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java index 86021301bb..3c7f9dc4dc 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/store/BackendStoreInfo.java @@ -22,7 +22,6 @@ import com.baidu.hugegraph.config.HugeConfig; import org.slf4j.Logger; -import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.util.Log; public class BackendStoreInfo { diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java index 016f51cb8d..8529fb339e 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java @@ -57,7 +57,7 @@ public void apply(StateMachineCallback stateMachineCallback) { failCount = 0; } catch (Throwable e) { stateMachineCallback.error(context, e); - failCount ++; + failCount++; if (failCount >= this.config.exceedsFailCount()) { this.state = new AbdicationState(context.epoch()); Callback runnable = this.state.callback(stateMachineCallback); diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java index c2983da684..9888be99fa 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/util/RateLimiter.java @@ -19,8 +19,6 @@ package com.baidu.hugegraph.util; -import org.slf4j.Logger; - // TODO: Move to common module (concurrent package) public interface RateLimiter { diff --git a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 2b1da29ffd..5c527cf86a 100644 --- a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -1,22 +1,3 @@ -/* - * Copyright 2017 HugeGraph Authors - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with this - * work for additional information regarding copyright ownership. The ASF - * licenses this file to You under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ - // Generated by the protocol buffer compiler. DO NOT EDIT! // source: raft.proto @@ -391,75 +372,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - bitField0_ |= 0x00000001; - type_ = rawValue; - } - break; - } - case 16: { - int rawValue = input.readEnum(); - @SuppressWarnings("deprecation") - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - action_ = rawValue; - } - break; - } - case 26: { - bitField0_ |= 0x00000004; - data_ = input.readBytes(); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandRequest_descriptor; @@ -566,7 +478,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, data_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -587,7 +499,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, data_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -615,7 +527,7 @@ public boolean equals(final java.lang.Object obj) { if (!getData() .equals(other.getData())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -638,7 +550,7 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -755,18 +667,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -875,7 +782,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasData()) { setData(other.getData()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -899,17 +806,59 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(1, tmpRaw); + } else { + type_ = tmpRaw; + bitField0_ |= 0x00000001; + } + break; + } // case 8 + case 16: { + int tmpRaw = input.readEnum(); + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction tmpValue = + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.forNumber(tmpRaw); + if (tmpValue == null) { + mergeUnknownVarintField(2, tmpRaw); + } else { + action_ = tmpRaw; + bitField0_ |= 0x00000002; + } + break; + } // case 16 + case 26: { + data_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1074,7 +1023,18 @@ public StoreCommandRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1154,57 +1114,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private StoreCommandResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandResponse_descriptor; @@ -1310,7 +1219,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -1326,7 +1235,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -1351,7 +1260,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -1371,7 +1280,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -1488,18 +1397,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -1601,7 +1505,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -1619,17 +1523,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1789,7 +1716,18 @@ public StoreCommandResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new StoreCommandResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1869,57 +1807,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private CommonResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - bitField0_ |= 0x00000001; - status_ = input.readBool(); - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - message_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_CommonResponse_descriptor; @@ -2025,7 +1912,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2041,7 +1928,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2066,7 +1953,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2086,7 +1973,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2203,18 +2090,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2316,7 +2198,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2334,17 +2216,40 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + status_ = input.readBool(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + message_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -2504,7 +2409,18 @@ public CommonResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new CommonResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -2555,45 +2471,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersRequest_descriptor; @@ -2621,7 +2498,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -2630,7 +2507,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -2645,7 +2522,7 @@ public boolean equals(final java.lang.Object obj) { } com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) obj; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -2656,7 +2533,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -2773,18 +2650,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -2863,7 +2735,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other) { if (other == com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -2878,17 +2750,30 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } @java.lang.Override @@ -2924,7 +2809,18 @@ public ListPeersRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3016,71 +2912,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private ListPeersResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - if (!((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000002; - } - endpoints_.add(bs); - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) != 0)) { - endpoints_ = endpoints_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersResponse_descriptor; @@ -3184,7 +3015,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < endpoints_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, endpoints_.getRaw(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3205,7 +3036,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getEndpointsList().size(); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -3227,7 +3058,7 @@ public boolean equals(final java.lang.Object obj) { } if (!getEndpointsList() .equals(other.getEndpointsList())) return false; - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -3246,7 +3077,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINTS_FIELD_NUMBER; hash = (53 * hash) + getEndpointsList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -3491,7 +3322,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests } onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -3512,17 +3343,43 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + ensureEndpointsIsMutable(); + endpoints_.add(bs); + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -3788,7 +3645,18 @@ public ListPeersResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new ListPeersResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3857,52 +3725,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderRequest( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - endpoint_ = bs; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderRequest_descriptor; @@ -3986,7 +3808,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -3998,7 +3820,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4018,7 +3840,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEndpoint() .equals(other.getEndpoint())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4033,7 +3855,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4150,18 +3972,13 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } @java.lang.Override public Builder clear() { @@ -4254,7 +4071,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests endpoint_ = other.endpoint_; onChanged(); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4272,17 +4089,35 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + endpoint_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -4403,7 +4238,18 @@ public SetLeaderRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderRequest(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -4469,59 +4315,6 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } - private SetLeaderResponse( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) != 0)) { - subBuilder = common_.toBuilder(); - } - common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(common_); - common_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - default: { - if (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderResponse_descriptor; @@ -4587,7 +4380,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getCommon()); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } @java.lang.Override @@ -4600,7 +4393,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getCommon()); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } @@ -4620,7 +4413,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCommon() .equals(other.getCommon())) return false; } - if (!unknownFields.equals(other.unknownFields)) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4635,7 +4428,7 @@ public int hashCode() { hash = (37 * hash) + COMMON_FIELD_NUMBER; hash = (53 * hash) + getCommon().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } @@ -4863,7 +4656,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasCommon()) { mergeCommon(other.getCommon()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } @@ -4884,17 +4677,37 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + input.readMessage( + getCommonFieldBuilder().getBuilder(), + extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -5051,7 +4864,18 @@ public SetLeaderResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SetLeaderResponse(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; From 86c2b49cbb83996f558fe19e89052b0c6431437e Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 17:44:35 +0800 Subject: [PATCH 4/6] fix code style check --- .../java/com/baidu/hugegraph/api/API.java | 1 - .../baidu/hugegraph/api/auth/AccessAPI.java | 1 - .../baidu/hugegraph/api/auth/BelongAPI.java | 1 - .../baidu/hugegraph/api/auth/GroupAPI.java | 1 - .../baidu/hugegraph/api/auth/LoginAPI.java | 1 - .../baidu/hugegraph/api/auth/ProjectAPI.java | 1 - .../baidu/hugegraph/api/auth/TargetAPI.java | 1 - .../com/baidu/hugegraph/api/auth/UserAPI.java | 1 - .../api/filter/CompressInterceptor.java | 1 - .../baidu/hugegraph/api/job/ComputerAPI.java | 1 - .../baidu/hugegraph/api/job/GremlinAPI.java | 1 - .../com/baidu/hugegraph/api/job/TaskAPI.java | 1 - .../hugegraph/api/profile/GraphsAPI.java | 1 - .../api/traversers/AllShortestPathsAPI.java | 1 - .../hugegraph/api/traversers/CountAPI.java | 1 - .../api/traversers/CrosspointsAPI.java | 1 - .../traversers/CustomizedCrosspointsAPI.java | 1 - .../api/traversers/CustomizedPathsAPI.java | 1 - .../hugegraph/api/traversers/EdgesAPI.java | 1 - .../api/traversers/FusiformSimilarityAPI.java | 1 - .../api/traversers/JaccardSimilarityAPI.java | 1 - .../api/traversers/KneighborAPI.java | 1 - .../hugegraph/api/traversers/KoutAPI.java | 1 - .../traversers/MultiNodeShortestPathAPI.java | 1 - .../api/traversers/NeighborRankAPI.java | 1 - .../hugegraph/api/traversers/PathsAPI.java | 1 - .../api/traversers/PersonalRankAPI.java | 1 - .../hugegraph/api/traversers/RaysAPI.java | 1 - .../hugegraph/api/traversers/RingsAPI.java | 1 - .../api/traversers/SameNeighborsAPI.java | 1 - .../api/traversers/ShortestPathAPI.java | 1 - .../SingleSourceShortestPathAPI.java | 1 - .../api/traversers/TemplatePathsAPI.java | 1 - .../hugegraph/api/traversers/VerticesAPI.java | 1 - .../traversers/WeightedShortestPathAPI.java | 1 - .../hugegraph/api/variables/VariablesAPI.java | 1 - .../hugegraph/auth/HugeFactoryAuthProxy.java | 9 +- .../hugegraph/auth/StandardAuthenticator.java | 8 +- .../hugegraph/license/LicenseVerifier.java | 1 - .../hugegraph/analyzer/AnalyzerFactory.java | 12 +- .../RoleElectionStateMachineImpl.java | 6 +- .../backend/store/raft/rpc/RaftRequests.java | 862 +++++++++++------- .../static/conf/rest-server.properties | 3 +- .../backend/store/palo/PaloTable.java | 1 - .../store/postgresql/PostgresqlSessions.java | 1 - .../core/RoleElectionStateMachineTest.java | 28 +- .../hugegraph/unit/core/AnalyzerTest.java | 64 +- 47 files changed, 594 insertions(+), 437 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java index e1c98b1565..ab84acad21 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/API.java @@ -36,7 +36,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.metrics.MetricsUtil; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.JsonUtil; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java index 7e9b61e2e9..b616d6dd9c 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/AccessAPI.java @@ -46,7 +46,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java index 1567be3ce5..0435c60889 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/BelongAPI.java @@ -45,7 +45,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java index 7537724028..943a5d8bb9 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/GroupAPI.java @@ -45,7 +45,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java index 75b68e506c..08e1903939 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/LoginAPI.java @@ -47,7 +47,6 @@ import com.baidu.hugegraph.auth.UserWithRole; import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java index 871824f40e..6ecbe8de5e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/ProjectAPI.java @@ -50,7 +50,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java index 5ac5fb5f5b..c19facc8e6 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/TargetAPI.java @@ -45,7 +45,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.JsonUtil; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java index 2c3334e87c..ce4fe3b316 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/auth/UserAPI.java @@ -47,7 +47,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.define.Checkable; import com.baidu.hugegraph.exception.NotFoundException; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.StringEncoding; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java index df342af8d3..b7c3f24cfe 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/filter/CompressInterceptor.java @@ -36,7 +36,6 @@ import org.slf4j.Logger; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.Log; @Provider diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java index 5527cc7aa1..f3825f893e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/ComputerAPI.java @@ -40,7 +40,6 @@ import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.job.ComputerJob; import com.baidu.hugegraph.job.JobBuilder; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.task.HugeTask; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.JsonUtil; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java index 1f6e177d05..46039271a3 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/GremlinAPI.java @@ -49,7 +49,6 @@ import com.baidu.hugegraph.job.GremlinJob; import com.baidu.hugegraph.job.JobBuilder; import com.baidu.hugegraph.metrics.MetricsUtil; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.JsonUtil; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java index c96fb6008d..bdd7bdc8d5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/job/TaskAPI.java @@ -49,7 +49,6 @@ import com.baidu.hugegraph.backend.id.IdGenerator; import com.baidu.hugegraph.backend.page.PageInfo; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.task.HugeTask; import com.baidu.hugegraph.task.TaskScheduler; import com.baidu.hugegraph.task.TaskStatus; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java index 1b784f7594..d59a9afaa4 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/profile/GraphsAPI.java @@ -50,7 +50,6 @@ import com.baidu.hugegraph.auth.HugePermission; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.type.define.GraphMode; import com.baidu.hugegraph.type.define.GraphReadMode; import com.baidu.hugegraph.util.E; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java index 5f33a6f5d0..2b8660f90d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AllShortestPathsAPI.java @@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java index ef93aa8e39..3a0ebb2e64 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CountAPI.java @@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.CountTraverser; import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java index a1e00c4e7e..53daf2f1d3 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CrosspointsAPI.java @@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.PathsTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java index 0eb599dcc5..c1699e9bd5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedCrosspointsAPI.java @@ -47,7 +47,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.CustomizedCrosspointsTraverser; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java index 530589c5fb..4e525f2873 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/CustomizedPathsAPI.java @@ -49,7 +49,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.CustomizePathsTraverser; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.steps.WeightedEdgeStep; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java index a155b0e52c..200d0b1aeb 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/EdgesAPI.java @@ -44,7 +44,6 @@ import com.baidu.hugegraph.backend.query.ConditionQuery; import com.baidu.hugegraph.backend.store.Shard; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeEdge; import com.baidu.hugegraph.type.HugeType; import com.baidu.hugegraph.util.E; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java index 716bc2a615..8e659c101f 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/FusiformSimilarityAPI.java @@ -43,7 +43,6 @@ import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser; import com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser.SimilarsMap; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java index d8ec29562c..3a31cf4ebe 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/JaccardSimilarityAPI.java @@ -44,7 +44,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep; import com.baidu.hugegraph.traversal.algorithm.JaccardSimilarTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java index 11b017b31d..31fd626f83 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KneighborAPI.java @@ -49,7 +49,6 @@ import com.baidu.hugegraph.backend.query.Query; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.KneighborTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java index 8d017182f3..11a069cf80 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/KoutAPI.java @@ -50,7 +50,6 @@ import com.baidu.hugegraph.backend.query.Query; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.KoutTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java index f09da73854..dcf9d715f3 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/MultiNodeShortestPathAPI.java @@ -42,7 +42,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.steps.EdgeStep; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.MultiNodeShortestPathTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java index d164db502e..7361c27a1c 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java @@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.NeighborRankTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java index 517d127f23..c227c283e0 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PathsAPI.java @@ -50,7 +50,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.CollectionPathsTraverser; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.PathsTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java index 66df0bcb32..96c17e9e84 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/PersonalRankAPI.java @@ -40,7 +40,6 @@ import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.structure.HugeVertex; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.PersonalRankTraverser; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java index 34f9364b94..c2b78f43d2 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RaysAPI.java @@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java index 70f75b41f5..0574208161 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/RingsAPI.java @@ -41,7 +41,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java index dbe49be53f..1653e040ee 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SameNeighborsAPI.java @@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.SameNeighborTraverser; import com.baidu.hugegraph.type.define.Directions; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java index fbe6555f22..f64e369b21 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ShortestPathAPI.java @@ -42,7 +42,6 @@ import com.baidu.hugegraph.api.graph.VertexAPI; import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.ShortestPathTraverser; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java index 3fc5251391..6e0b612ead 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/SingleSourceShortestPathAPI.java @@ -45,7 +45,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser; import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.WeightedPaths; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java index ccd5713c1a..fdc8eca282 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/TemplatePathsAPI.java @@ -44,7 +44,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.HugeTraverser; import com.baidu.hugegraph.traversal.algorithm.TemplatePathsTraverser; import com.baidu.hugegraph.traversal.algorithm.steps.RepeatEdgeStep; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java index d9c0b70782..56b10d8f46 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/VerticesAPI.java @@ -45,7 +45,6 @@ import com.baidu.hugegraph.backend.query.ConditionQuery; import com.baidu.hugegraph.backend.store.Shard; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.type.HugeType; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java index 4cdd1f2571..65dfdf52ac 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/WeightedShortestPathAPI.java @@ -44,7 +44,6 @@ import com.baidu.hugegraph.backend.id.Id; import com.baidu.hugegraph.backend.query.QueryResults; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser; import com.baidu.hugegraph.traversal.algorithm.SingleSourceShortestPathTraverser.NodeWithWeight; import com.baidu.hugegraph.type.define.Directions; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java index bacce9c4b9..ab931ff128 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/variables/VariablesAPI.java @@ -39,7 +39,6 @@ import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.api.API; import com.baidu.hugegraph.core.GraphManager; -import com.baidu.hugegraph.server.RestServer; import com.baidu.hugegraph.util.E; import com.baidu.hugegraph.util.Log; import com.codahale.metrics.annotation.Timed; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java index 498b24f1e4..3e32a78df1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java @@ -28,6 +28,8 @@ import java.util.Map; import java.util.Set; +import org.slf4j.Logger; + import com.baidu.hugegraph.HugeException; import com.baidu.hugegraph.HugeFactory; import com.baidu.hugegraph.HugeGraph; @@ -55,6 +57,7 @@ import com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy; +import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.Reflection; import com.baidu.hugegraph.variables.HugeVariables; import com.google.common.collect.ImmutableSet; @@ -62,6 +65,8 @@ public final class HugeFactoryAuthProxy { + private static final Logger LOG = Log.logger(HugeFactoryAuthProxy.class); + public static final String GRAPH_FACTORY = "gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy"; @@ -309,13 +314,13 @@ private static boolean registerClass(Class clazz, code = String.format("Reflection.registerFieldsToFilter(%s.class, \"%s\");", clazz.getCanonicalName(), String.join("\", \"", fields)); if (!fields.isEmpty()) { - System.out.println(code); + LOG.info(code); } code = String.format("Reflection.registerMethodsToFilter(%s.class, \"%s\");", clazz.getCanonicalName(), String.join("\", \"", methods)); if (!methods.isEmpty()) { - System.out.println(code); + LOG.info(code); } return true; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java index b8e559680f..767b14dee6 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java @@ -27,6 +27,7 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.StringUtils; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; +import org.slf4j.Logger; import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.config.CoreOptions; @@ -35,10 +36,13 @@ import com.baidu.hugegraph.rpc.RpcClientProviderWithAuth; import com.baidu.hugegraph.util.ConfigUtil; import com.baidu.hugegraph.util.E; +import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.StringEncoding; public class StandardAuthenticator implements HugeAuthenticator { + private static final Logger LOG = Log.logger(StandardAuthenticator.class); + private static final String INITING_STORE = "initing_store"; private HugeGraph graph = null; @@ -87,7 +91,7 @@ private String inputPassword() { char[] chars = console.readPassword(inputPrompt); password = new String(chars); } else { - System.out.print(inputPrompt); + LOG.info(inputPrompt); @SuppressWarnings("resource") // just wrapper of System.in Scanner scanner = new Scanner(System.in); password = scanner.nextLine(); @@ -95,7 +99,7 @@ private String inputPassword() { if (!password.isEmpty()) { return password; } - System.out.println(notEmptyPrompt); + LOG.info(notEmptyPrompt); } } diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java index c1fab55eee..6b3ab4ab1e 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/license/LicenseVerifier.java @@ -28,7 +28,6 @@ import org.slf4j.Logger; import com.baidu.hugegraph.HugeException; -import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.core.GraphManager; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java index fbd043be28..ab84dba632 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/analyzer/AnalyzerFactory.java @@ -27,10 +27,10 @@ public class AnalyzerFactory { - private static final Map> analyzers; + private static final Map> ANALYZERS; static { - analyzers = new ConcurrentHashMap<>(); + ANALYZERS = new ConcurrentHashMap<>(); } public static Analyzer analyzer(String name, String mode) { @@ -58,7 +58,7 @@ public static Analyzer analyzer(String name, String mode) { } private static Analyzer customizedAnalyzer(String name, String mode) { - Class clazz = analyzers.get(name); + Class clazz = ANALYZERS.get(name); if (clazz == null) { throw new HugeException("Not exists analyzer: %s", name); } @@ -91,12 +91,12 @@ public static void register(String name, String classPath) { } // Check exists - if (analyzers.containsKey(name)) { + if (ANALYZERS.containsKey(name)) { throw new HugeException("Exists analyzer: %s(%s)", - name, analyzers.get(name).getName()); + name, ANALYZERS.get(name).getName()); } // Register class - analyzers.put(name, (Class) clazz); + ANALYZERS.put(name, (Class) clazz); } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java index 8529fb339e..69f8d5a3d9 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/election/RoleElectionStateMachineImpl.java @@ -69,7 +69,7 @@ public void apply(StateMachineCallback stateMachineCallback) { private interface RoleState { - SecureRandom secureRandom = new SecureRandom(); + SecureRandom SECURE_RANDOM = new SecureRandom(); RoleState transform(StateMachineContext context); @@ -83,7 +83,7 @@ static void heartBeatPark(StateMachineContext context) { static void randomPark(StateMachineContext context) { long randomTimeout = context.config().randomTimeoutMillisecond(); long baseTime = context.config().baseTimeoutMillisecond(); - long timeout = (long) (baseTime + (randomTimeout / 10.0 * secureRandom.nextInt(11))); + long timeout = (long) (baseTime + (randomTimeout / 10.0 * SECURE_RANDOM.nextInt(11))); LockSupport.parkNanos(timeout * 1_000_000); } } @@ -216,7 +216,7 @@ public void merge(WorkerState state) { if (state.roleTypeData.epoch() > this.roleTypeData.epoch()) { this.clock = 0; this.roleTypeData = state.roleTypeData; - } else if (state.roleTypeData.epoch() < this.roleTypeData.epoch()){ + } else if (state.roleTypeData.epoch() < this.roleTypeData.epoch()) { throw new IllegalStateException("Epoch must increase"); } else if (state.roleTypeData.epoch() == this.roleTypeData.epoch() && state.roleTypeData.clock() < this.roleTypeData.clock()) { diff --git a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java index 5c527cf86a..2b1da29ffd 100644 --- a/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java +++ b/hugegraph-core/src/protobuf/java/com/baidu/hugegraph/backend/store/raft/rpc/RaftRequests.java @@ -1,3 +1,22 @@ +/* + * Copyright 2017 HugeGraph Authors + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + // Generated by the protocol buffer compiler. DO NOT EDIT! // source: raft.proto @@ -372,6 +391,75 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private StoreCommandRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + bitField0_ |= 0x00000001; + type_ = rawValue; + } + break; + } + case 16: { + int rawValue = input.readEnum(); + @SuppressWarnings("deprecation") + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction value = com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(2, rawValue); + } else { + bitField0_ |= 0x00000002; + action_ = rawValue; + } + break; + } + case 26: { + bitField0_ |= 0x00000004; + data_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandRequest_descriptor; @@ -478,7 +566,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, data_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -499,7 +587,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, data_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -527,7 +615,7 @@ public boolean equals(final java.lang.Object obj) { if (!getData() .equals(other.getData())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -550,7 +638,7 @@ public int hashCode() { hash = (37 * hash) + DATA_FIELD_NUMBER; hash = (53 * hash) + getData().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -667,13 +755,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -782,7 +875,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasData()) { setData(other.getData()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -806,59 +899,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - int tmpRaw = input.readEnum(); - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType tmpValue = - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreType.forNumber(tmpRaw); - if (tmpValue == null) { - mergeUnknownVarintField(1, tmpRaw); - } else { - type_ = tmpRaw; - bitField0_ |= 0x00000001; - } - break; - } // case 8 - case 16: { - int tmpRaw = input.readEnum(); - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction tmpValue = - com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreAction.forNumber(tmpRaw); - if (tmpValue == null) { - mergeUnknownVarintField(2, tmpRaw); - } else { - action_ = tmpRaw; - bitField0_ |= 0x00000002; - } - break; - } // case 16 - case 26: { - data_ = input.readBytes(); - bitField0_ |= 0x00000004; - break; - } // case 26 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -1023,18 +1074,7 @@ public StoreCommandRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new StoreCommandRequest(input, extensionRegistry); } }; @@ -1114,6 +1154,57 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private StoreCommandResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + bitField0_ |= 0x00000001; + status_ = input.readBool(); + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + message_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_StoreCommandResponse_descriptor; @@ -1219,7 +1310,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -1235,7 +1326,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -1260,7 +1351,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1280,7 +1371,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -1397,13 +1488,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -1505,7 +1601,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -1523,40 +1619,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - status_ = input.readBool(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - message_ = input.readBytes(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.StoreCommandResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -1716,18 +1789,7 @@ public StoreCommandResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new StoreCommandResponse(input, extensionRegistry); } }; @@ -1807,6 +1869,57 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private CommonResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + bitField0_ |= 0x00000001; + status_ = input.readBool(); + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000002; + message_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_CommonResponse_descriptor; @@ -1912,7 +2025,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000002) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -1928,7 +2041,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -1953,7 +2066,7 @@ public boolean equals(final java.lang.Object obj) { if (!getMessage() .equals(other.getMessage())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1973,7 +2086,7 @@ public int hashCode() { hash = (37 * hash) + MESSAGE_FIELD_NUMBER; hash = (53 * hash) + getMessage().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -2090,13 +2203,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -2198,7 +2316,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests message_ = other.message_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -2216,40 +2334,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: { - status_ = input.readBool(); - bitField0_ |= 0x00000001; - break; - } // case 8 - case 18: { - message_ = input.readBytes(); - bitField0_ |= 0x00000002; - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -2409,18 +2504,7 @@ public CommonResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new CommonResponse(input, extensionRegistry); } }; @@ -2471,6 +2555,45 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private ListPeersRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersRequest_descriptor; @@ -2498,7 +2621,7 @@ public final boolean isInitialized() { @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -2507,7 +2630,7 @@ public int getSerializedSize() { if (size != -1) return size; size = 0; - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -2522,7 +2645,7 @@ public boolean equals(final java.lang.Object obj) { } com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) obj; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -2533,7 +2656,7 @@ public int hashCode() { } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -2650,13 +2773,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -2735,7 +2863,7 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest other) { if (other == com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest.getDefaultInstance()) return this; - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -2750,30 +2878,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } @java.lang.Override @@ -2809,18 +2924,7 @@ public ListPeersRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new ListPeersRequest(input, extensionRegistry); } }; @@ -2912,6 +3016,71 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private ListPeersResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) != 0)) { + subBuilder = common_.toBuilder(); + } + common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(common_); + common_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + case 18: { + com.google.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + endpoints_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + endpoints_.add(bs); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000002) != 0)) { + endpoints_ = endpoints_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_ListPeersResponse_descriptor; @@ -3015,7 +3184,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) for (int i = 0; i < endpoints_.size(); i++) { com.google.protobuf.GeneratedMessageV3.writeString(output, 2, endpoints_.getRaw(i)); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -3036,7 +3205,7 @@ public int getSerializedSize() { size += dataSize; size += 1 * getEndpointsList().size(); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -3058,7 +3227,7 @@ public boolean equals(final java.lang.Object obj) { } if (!getEndpointsList() .equals(other.getEndpointsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -3077,7 +3246,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINTS_FIELD_NUMBER; hash = (53 * hash) + getEndpointsList().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -3322,7 +3491,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests } onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -3343,43 +3512,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - input.readMessage( - getCommonFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000001; - break; - } // case 10 - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - ensureEndpointsIsMutable(); - endpoints_.add(bs); - break; - } // case 18 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.ListPeersResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -3645,18 +3788,7 @@ public ListPeersResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new ListPeersResponse(input, extensionRegistry); } }; @@ -3725,6 +3857,52 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private SetLeaderRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.google.protobuf.ByteString bs = input.readBytes(); + bitField0_ |= 0x00000001; + endpoint_ = bs; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderRequest_descriptor; @@ -3808,7 +3986,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -3820,7 +3998,7 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -3840,7 +4018,7 @@ public boolean equals(final java.lang.Object obj) { if (!getEndpoint() .equals(other.getEndpoint())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -3855,7 +4033,7 @@ public int hashCode() { hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; hash = (53 * hash) + getEndpoint().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -3972,13 +4150,18 @@ public static final class Builder extends // Construct using com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest.newBuilder() private Builder() { - + maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); - + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } } @java.lang.Override public Builder clear() { @@ -4071,7 +4254,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests endpoint_ = other.endpoint_; onChanged(); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -4089,35 +4272,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - endpoint_ = input.readBytes(); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderRequest) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -4238,18 +4403,7 @@ public SetLeaderRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new SetLeaderRequest(input, extensionRegistry); } }; @@ -4315,6 +4469,59 @@ protected java.lang.Object newInstance( getUnknownFields() { return this.unknownFields; } + private SetLeaderResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) != 0)) { + subBuilder = common_.toBuilder(); + } + common_ = input.readMessage(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.CommonResponse.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(common_); + common_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.internal_static_com_baidu_hugegraph_backend_store_raft_rpc_SetLeaderResponse_descriptor; @@ -4380,7 +4587,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(1, getCommon()); } - getUnknownFields().writeTo(output); + unknownFields.writeTo(output); } @java.lang.Override @@ -4393,7 +4600,7 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, getCommon()); } - size += getUnknownFields().getSerializedSize(); + size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @@ -4413,7 +4620,7 @@ public boolean equals(final java.lang.Object obj) { if (!getCommon() .equals(other.getCommon())) return false; } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -4428,7 +4635,7 @@ public int hashCode() { hash = (37 * hash) + COMMON_FIELD_NUMBER; hash = (53 * hash) + getCommon().hashCode(); } - hash = (29 * hash) + getUnknownFields().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } @@ -4656,7 +4863,7 @@ public Builder mergeFrom(com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests if (other.hasCommon()) { mergeCommon(other.getCommon()); } - this.mergeUnknownFields(other.getUnknownFields()); + this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @@ -4677,37 +4884,17 @@ public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } + com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse parsedMessage = null; try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: { - input.readMessage( - getCommonFieldBuilder().getBuilder(), - extensionRegistry); - bitField0_ |= 0x00000001; - break; - } // case 10 - default: { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.baidu.hugegraph.backend.store.raft.rpc.RaftRequests.SetLeaderResponse) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - onChanged(); - } // finally + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } return this; } private int bitField0_; @@ -4864,18 +5051,7 @@ public SetLeaderResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); + return new SetLeaderResponse(input, extensionRegistry); } }; diff --git a/hugegraph-dist/src/assembly/static/conf/rest-server.properties b/hugegraph-dist/src/assembly/static/conf/rest-server.properties index f7eda0010c..9e54fcf450 100644 --- a/hugegraph-dist/src/assembly/static/conf/rest-server.properties +++ b/hugegraph-dist/src/assembly/static/conf/rest-server.properties @@ -10,7 +10,8 @@ batch.max_write_ratio=80 batch.max_write_threads=0 # authentication configs -# choose 'com.baidu.hugegraph.auth.StandardAuthenticator' or 'com.baidu.hugegraph.auth.ConfigAuthenticator' +# choose 'com.baidu.hugegraph.auth.StandardAuthenticator' or +# 'com.baidu.hugegraph.auth.ConfigAuthenticator' #auth.authenticator= # for StandardAuthenticator mode diff --git a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java index 6a75589930..16721a6f00 100644 --- a/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java +++ b/hugegraph-palo/src/main/java/com/baidu/hugegraph/backend/store/palo/PaloTable.java @@ -32,7 +32,6 @@ import com.baidu.hugegraph.backend.store.TableDefine; import com.baidu.hugegraph.backend.store.mysql.MysqlBackendEntry; import com.baidu.hugegraph.backend.store.mysql.MysqlSessions; -import com.baidu.hugegraph.backend.store.mysql.MysqlStore; import com.baidu.hugegraph.backend.store.mysql.MysqlTable; import com.baidu.hugegraph.type.define.HugeKeys; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java index 448c07fa4b..4603b9dae0 100644 --- a/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java +++ b/hugegraph-postgresql/src/main/java/com/baidu/hugegraph/backend/store/postgresql/PostgresqlSessions.java @@ -31,7 +31,6 @@ import com.baidu.hugegraph.backend.BackendException; import com.baidu.hugegraph.backend.store.mysql.MysqlSessions; -import com.baidu.hugegraph.backend.store.mysql.MysqlStore; import com.baidu.hugegraph.backend.store.mysql.MysqlUtil; import com.baidu.hugegraph.config.HugeConfig; import com.baidu.hugegraph.util.Log; diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java index 6e8af972dc..aeffd57d80 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java @@ -40,10 +40,14 @@ import com.baidu.hugegraph.election.StateMachineCallback; import com.baidu.hugegraph.election.StateMachineContext; import com.baidu.hugegraph.testutil.Assert; +import com.baidu.hugegraph.util.Log; import org.junit.Test; +import org.slf4j.Logger; public class RoleElectionStateMachineTest { + protected static final Logger LOG = Log.logger(BaseCoreTest.class); + public static class LogEntry { Integer epoch; @@ -149,7 +153,7 @@ public void master(StateMachineContext context) { if (logRecords.size() > MAX_COUNT) { context.stateMachine().shutdown(); } - System.out.println("master node: " + node); + LOG.info("master node: " + node); masterNodes.add(node); } @@ -195,7 +199,9 @@ public void abdication(StateMachineContext context) { @Override public void error(StateMachineContext context, Throwable e) { - System.out.println("state machine error: node " + context.node() + " message " + e.getMessage()); + LOG.info("state machine error: node " + + context.node() + + " message " + e.getMessage()); } }; @@ -225,14 +231,14 @@ public boolean updateIfNodePresent(RoleTypeData stateData) { this.epoch = copy.epoch(); Assert.assertNull(value); metaDataLogs.add(copy); - System.out.println("The node " + copy + " become new master:"); + LOG.info("The node " + copy + " become new master:"); return copy; } Assert.assertEquals(value.epoch(), copy.epoch()); if (Objects.equals(value.node(), copy.node()) && value.clock() <= copy.clock()) { - System.out.println("The master node " + copy + " keep heartbeat"); + LOG.info("The master node " + copy + " keep heartbeat"); metaDataLogs.add(copy); if (value.clock() == copy.clock()) { Assert.fail("Clock must increase when same epoch and node id"); @@ -247,14 +253,16 @@ public boolean updateIfNodePresent(RoleTypeData stateData) { @Override public Optional query() { - return Optional.ofNullable(this.copy(this.data.get(this.epoch))); + return Optional.ofNullable( + this.copy(this.data.get(this.epoch))); } }; RoleElectionStateMachine[] machines = new RoleElectionStateMachine[4]; Thread node1 = new Thread(() -> { Config config = new TestConfig("1"); - RoleElectionStateMachine stateMachine = new RoleElectionStateMachineImpl(config, adapter); + RoleElectionStateMachine stateMachine = + new RoleElectionStateMachineImpl(config, adapter); machines[1] = stateMachine; stateMachine.apply(callback); stop.countDown(); @@ -262,7 +270,8 @@ public Optional query() { Thread node2 = new Thread(() -> { Config config = new TestConfig("2"); - RoleElectionStateMachine stateMachine = new RoleElectionStateMachineImpl(config, adapter); + RoleElectionStateMachine stateMachine = + new RoleElectionStateMachineImpl(config, adapter); machines[2] = stateMachine; stateMachine.apply(callback); stop.countDown(); @@ -270,7 +279,8 @@ public Optional query() { Thread node3 = new Thread(() -> { Config config = new TestConfig("3"); - RoleElectionStateMachine stateMachine = new RoleElectionStateMachineImpl(config, adapter); + RoleElectionStateMachine stateMachine = + new RoleElectionStateMachineImpl(config, adapter); machines[3] = stateMachine; stateMachine.apply(callback); stop.countDown(); @@ -294,7 +304,7 @@ public Optional query() { } machines[Integer.parseInt(node)].shutdown(); dropNodes.add(node); - System.out.println("----shutdown machine " + node); + LOG.info("----shutdown machine " + node); } stop.countDown(); }); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java index fdd7499930..3674ee83f1 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/unit/core/AnalyzerTest.java @@ -33,8 +33,8 @@ public class AnalyzerTest { - private static final String text1 = "England wins World Cup"; - private static final String text2 = "英格兰世界杯夺冠,中华人民共和国国歌," + + private static final String TEXT_1 = "England wins World Cup"; + private static final String TEXT_2 = "英格兰世界杯夺冠,中华人民共和国国歌," + "百度科技园位于北京市海淀区西北旺东路10号院"; @Before @@ -52,20 +52,20 @@ public void testWordAnalyzer() { // MaximumMatching mode Analyzer analyzer = AnalyzerFactory.analyzer("word", "MaximumMatching"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北旺", "东路", "10号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // ReverseMaximumMatching mode analyzer = AnalyzerFactory.analyzer("word", "ReverseMaximumMatching"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北旺", "东路", "10号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -73,20 +73,20 @@ public void testAnsjAnalyzer() { // BaseAnalysis mode Analyzer analyzer = AnalyzerFactory.analyzer("ansj", "BaseAnalysis"); Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国", "国歌", "百度", "科技", "园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // IndexAnalysis mode analyzer = AnalyzerFactory.analyzer("ansj", "IndexAnalysis"); Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国", "国歌", "百度", "科技", "园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -94,36 +94,36 @@ public void testHanlpAnalyzer() { // standard mode Analyzer analyzer = AnalyzerFactory.analyzer("hanlp", "standard"); Assert.assertEquals(setOf("England", " ", "wins", "World", "Cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北旺", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // Note latest hanlp portable version not contains model data // https://github.com/hankcs/HanLP/tree/portable#%E6%96%B9%E5%BC%8F%E4%B8%80maven // So test IndexTokenizer instead analyzer = AnalyzerFactory.analyzer("hanlp", "index"); Assert.assertEquals(setOf("England", " ", "wins", "World", "Cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "英格", "格兰", "世界杯", "世界", "夺冠", ",", "中华人民共和国", "中华", "华人", "人民", "共和国", "共和","国歌", "百度", "科技园", "科技", "位于", "北京市", "北京", "海淀区", "海淀", "淀区", "西北旺", "西北", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test public void testSmartCNAnalyzer() { Analyzer analyzer = AnalyzerFactory.analyzer("smartcn", ""); Assert.assertEquals(setOf("england", "win", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百", "度", "科技", "园", "位于", "北京市", "海淀区", "西北", "旺", "东", "路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -131,22 +131,22 @@ public void testJiebaAnalyzer() { // SEARCH mode Analyzer analyzer = AnalyzerFactory.analyzer("jieba", "SEARCH"); Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10", "号院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // INDEX mode analyzer = AnalyzerFactory.analyzer("jieba", "INDEX"); Assert.assertEquals(setOf("england", " ", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界", "世界杯", "夺冠", ",", "中华", "华人", "人民", "共和", "共和国", "中华人民共和国", "国歌", "百度", "科技", "科技园", "位于", "北京", "京市", "北京市", "海淀", "淀区", "海淀区", "西北", "旺", "东路", "10", "号院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -154,22 +154,22 @@ public void testJcsegAnalyzer() { // Simple mode Analyzer analyzer = AnalyzerFactory.analyzer("jcseg", "Simple"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华", "人民共和国", "国歌", "百度", "科技", "园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "1", "0", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // Complex mode analyzer = AnalyzerFactory.analyzer("jcseg", "Complex"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", ",", "中华", "人民共和国", "国歌", "百度", "科技", "园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "1", "0", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -177,22 +177,22 @@ public void testMMSeg4JAnalyzer() { // Simple mode Analyzer analyzer = AnalyzerFactory.analyzer("mmseg4j", "Simple"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // Complex mode analyzer = AnalyzerFactory.analyzer("mmseg4j", "Complex"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } @Test @@ -200,16 +200,16 @@ public void testIKAnalyzer() { // Smart mode Analyzer analyzer = AnalyzerFactory.analyzer("ikanalyzer", "smart"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "夺冠", "中华人民共和国", "国歌", "百度", "科技园", "位于", "北京市", "海淀区", "西北", "旺", "东路", "10号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); // Max_word mode analyzer = AnalyzerFactory.analyzer("ikanalyzer", "max_word"); Assert.assertEquals(setOf("england", "wins", "world", "cup"), - analyzer.segment(text1)); + analyzer.segment(TEXT_1)); Assert.assertEquals(setOf("英格兰", "世界杯", "世界", "杯", "夺冠", "中华人民共和国", "中华人民", "中华", "华人", "人民共和国", "人民", "共和国", "共和", "国", @@ -217,7 +217,7 @@ public void testIKAnalyzer() { "园", "位于", "北京市", "北京", "市", "海淀区", "海淀", "淀区", "西北", "旺", "东路", "10", "号", "院"), - analyzer.segment(text2)); + analyzer.segment(TEXT_2)); } private static Set setOf(String... elems) { From c6d8b9b94deb015501844841bebaabe0cb432b89 Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 20:08:49 +0800 Subject: [PATCH 5/6] fix: code style --- .../hugegraph/auth/HugeAuthenticator.java | 2 +- .../hugegraph/auth/HugeGraphAuthProxy.java | 1 + .../backend/store/hbase/HbaseSessions.java | 9 +++++---- .../core/RoleElectionStateMachineTest.java | 19 ++++++++----------- .../com/baidu/hugegraph/testutil/Utils.java | 6 ++++++ 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java index 88c5c78705..66c6a935e5 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeAuthenticator.java @@ -81,7 +81,7 @@ default void setup(final Map config) { @Override default User authenticate(final Map credentials) - throws AuthenticationException { + throws AuthenticationException { HugeGraphAuthProxy.resetContext(); diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java index 78a3fabf05..8fac1fdf1d 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java @@ -1679,6 +1679,7 @@ public TraversalStrategies removeStrategies( @Override public TraversalStrategies clone() { + // CHECKSTYLE:OFF return this.strategies.clone(); } diff --git a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java index 03d0d5596e..89f82d63c5 100644 --- a/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java +++ b/hugegraph-hbase/src/main/java/com/baidu/hugegraph/backend/store/hbase/HbaseSessions.java @@ -457,7 +457,7 @@ long increase(String table, byte[] family, byte[] rowkey, * Session implement for HBase */ public class Session extends AbstractBackendSession - implements HbaseSession { + implements HbaseSession { private final Map> batch; @@ -483,7 +483,7 @@ private int batchSize() { } private void checkBatchResults(Object[] results, List rows) - throws Throwable { + throws Throwable { assert rows.size() == results.length; for (int i = 0; i < results.length; i++) { Object result = results[i]; @@ -552,7 +552,7 @@ public Integer commit() { } catch (Throwable e) { // TODO: Mark and delete committed records throw new BackendException("Failed to commit, " + - "there may be inconsistent states for HBase", e); + "there may be inconsistent states for HBase", e); } } @@ -806,7 +806,8 @@ private void dump(String table, Scan scan) throws IOException { Cell cell = cellScanner.current(); byte[] key = CellUtil.cloneQualifier(cell); byte[] val = CellUtil.cloneValue(cell); - LOG.info(" {}={}", StringEncoding.format(key), + LOG.info(" {}={}", + StringEncoding.format(key), StringEncoding.format(val)); } } diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java index aeffd57d80..c32e1ee23d 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/core/RoleElectionStateMachineTest.java @@ -40,14 +40,11 @@ import com.baidu.hugegraph.election.StateMachineCallback; import com.baidu.hugegraph.election.StateMachineContext; import com.baidu.hugegraph.testutil.Assert; -import com.baidu.hugegraph.util.Log; +import com.baidu.hugegraph.testutil.Utils; import org.junit.Test; -import org.slf4j.Logger; public class RoleElectionStateMachineTest { - protected static final Logger LOG = Log.logger(BaseCoreTest.class); - public static class LogEntry { Integer epoch; @@ -153,7 +150,7 @@ public void master(StateMachineContext context) { if (logRecords.size() > MAX_COUNT) { context.stateMachine().shutdown(); } - LOG.info("master node: " + node); + Utils.println("master node: " + node); masterNodes.add(node); } @@ -199,9 +196,9 @@ public void abdication(StateMachineContext context) { @Override public void error(StateMachineContext context, Throwable e) { - LOG.info("state machine error: node " + - context.node() + - " message " + e.getMessage()); + Utils.println("state machine error: node " + + context.node() + + " message " + e.getMessage()); } }; @@ -231,14 +228,14 @@ public boolean updateIfNodePresent(RoleTypeData stateData) { this.epoch = copy.epoch(); Assert.assertNull(value); metaDataLogs.add(copy); - LOG.info("The node " + copy + " become new master:"); + Utils.println("The node " + copy + " become new master:"); return copy; } Assert.assertEquals(value.epoch(), copy.epoch()); if (Objects.equals(value.node(), copy.node()) && value.clock() <= copy.clock()) { - LOG.info("The master node " + copy + " keep heartbeat"); + Utils.println("The master node " + copy + " keep heartbeat"); metaDataLogs.add(copy); if (value.clock() == copy.clock()) { Assert.fail("Clock must increase when same epoch and node id"); @@ -304,7 +301,7 @@ public Optional query() { } machines[Integer.parseInt(node)].shutdown(); dropNodes.add(node); - LOG.info("----shutdown machine " + node); + Utils.println("----shutdown machine " + node); } stop.countDown(); }); diff --git a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java index d1f245b323..770b0f26ed 100644 --- a/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java +++ b/hugegraph-test/src/main/java/com/baidu/hugegraph/testutil/Utils.java @@ -105,4 +105,10 @@ public static PropertiesConfiguration getConf() { } return config; } + + public static void println(String message) { + // CHECKSTYLE:OFF + System.out.println(message); + // CHECKSTYLE:ON + } } From f08bda3b8c51b22da9a18de47935183cb73d36ee Mon Sep 17 00:00:00 2001 From: zyxxoo <1318247699@qq.com> Date: Sun, 30 Oct 2022 21:07:23 +0800 Subject: [PATCH 6/6] fix code style --- .../baidu/hugegraph/auth/HugeFactoryAuthProxy.java | 13 ++++++------- .../baidu/hugegraph/auth/StandardAuthenticator.java | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java index 3e32a78df1..2fd14536d1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeFactoryAuthProxy.java @@ -28,8 +28,6 @@ import java.util.Map; import java.util.Set; -import org.slf4j.Logger; - import com.baidu.hugegraph.HugeException; import com.baidu.hugegraph.HugeFactory; import com.baidu.hugegraph.HugeGraph; @@ -57,7 +55,6 @@ import com.baidu.hugegraph.traversal.optimize.HugeCountStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeGraphStepStrategy; import com.baidu.hugegraph.traversal.optimize.HugeVertexStepStrategy; -import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.Reflection; import com.baidu.hugegraph.variables.HugeVariables; import com.google.common.collect.ImmutableSet; @@ -65,8 +62,6 @@ public final class HugeFactoryAuthProxy { - private static final Logger LOG = Log.logger(HugeFactoryAuthProxy.class); - public static final String GRAPH_FACTORY = "gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy"; @@ -314,13 +309,17 @@ private static boolean registerClass(Class clazz, code = String.format("Reflection.registerFieldsToFilter(%s.class, \"%s\");", clazz.getCanonicalName(), String.join("\", \"", fields)); if (!fields.isEmpty()) { - LOG.info(code); + // CHECKSTYLE:OFF + System.out.println(code); + // CHECKSTYLE:ON } code = String.format("Reflection.registerMethodsToFilter(%s.class, \"%s\");", clazz.getCanonicalName(), String.join("\", \"", methods)); if (!methods.isEmpty()) { - LOG.info(code); + // CHECKSTYLE:OFF + System.out.println(code); + // CHECKSTYLE:ON } return true; diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java index 767b14dee6..6006aad927 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/StandardAuthenticator.java @@ -27,7 +27,6 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.StringUtils; import org.apache.tinkerpop.gremlin.structure.util.GraphFactory; -import org.slf4j.Logger; import com.baidu.hugegraph.HugeGraph; import com.baidu.hugegraph.config.CoreOptions; @@ -36,13 +35,10 @@ import com.baidu.hugegraph.rpc.RpcClientProviderWithAuth; import com.baidu.hugegraph.util.ConfigUtil; import com.baidu.hugegraph.util.E; -import com.baidu.hugegraph.util.Log; import com.baidu.hugegraph.util.StringEncoding; public class StandardAuthenticator implements HugeAuthenticator { - private static final Logger LOG = Log.logger(StandardAuthenticator.class); - private static final String INITING_STORE = "initing_store"; private HugeGraph graph = null; @@ -91,7 +87,9 @@ private String inputPassword() { char[] chars = console.readPassword(inputPrompt); password = new String(chars); } else { - LOG.info(inputPrompt); + // CHECKSTYLE:OFF + System.out.println(inputPrompt); + // CHECKSTYLE:ON @SuppressWarnings("resource") // just wrapper of System.in Scanner scanner = new Scanner(System.in); password = scanner.nextLine(); @@ -99,7 +97,9 @@ private String inputPassword() { if (!password.isEmpty()) { return password; } - LOG.info(notEmptyPrompt); + // CHECKSTYLE:OFF + System.out.println(notEmptyPrompt); + // CHECKSTYLE:ON } }