diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java index 3a4347b25..4a6c3203a 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreNodeSessionImpl.java @@ -1,3 +1,20 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; import static com.baidu.hugegraph.store.client.util.HgStoreClientConst.EMPTY_BYTES; @@ -16,6 +33,8 @@ import java.util.stream.Collectors; import javax.annotation.concurrent.NotThreadSafe; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; + import com.baidu.hugegraph.store.HgKvEntry; import com.baidu.hugegraph.store.HgKvIterator; import com.baidu.hugegraph.store.HgKvStore; @@ -33,7 +52,6 @@ import com.baidu.hugegraph.store.grpc.common.Key; import com.baidu.hugegraph.store.grpc.common.OpType; import com.baidu.hugegraph.store.grpc.common.TableMethod; import com.baidu.hugegraph.store.grpc.session.BatchEntry; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; import com.baidu.hugegraph.store.grpc.stream.ScanStreamReq; import com.google.protobuf.ByteString; import com.google.protobuf.UnsafeByteOperations; diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreStreamClient.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreStreamClient.java index bd148523f..e4a0b7ed4 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreStreamClient.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/GrpcStoreStreamClient.java @@ -1,16 +1,34 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; import javax.annotation.concurrent.ThreadSafe; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamBlockingStub; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; + import com.baidu.hugegraph.store.HgKvEntry; import com.baidu.hugegraph.store.HgKvIterator; import com.baidu.hugegraph.store.HgOwnerKey; import com.baidu.hugegraph.store.HgScanQuery; import com.baidu.hugegraph.store.client.HgStoreNodeSession; import com.baidu.hugegraph.store.grpc.common.Kv; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamBlockingStub; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; import io.grpc.ManagedChannel; import io.grpc.stub.AbstractAsyncStub; diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchOneShotScanner.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchOneShotScanner.java index f59418fe7..a4c02b5ef 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchOneShotScanner.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchOneShotScanner.java @@ -1,20 +1,42 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; +import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.EMPTY_POSITION; +import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.createQueryReq; +import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.getHeader; + +import java.util.Iterator; +import java.util.List; + +import javax.annotation.concurrent.NotThreadSafe; + +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc; + import com.baidu.hugegraph.store.HgPageSize; import com.baidu.hugegraph.store.HgScanQuery; import com.baidu.hugegraph.store.HgSeekAble; import com.baidu.hugegraph.store.client.HgStoreNodeSession; import com.baidu.hugegraph.store.grpc.common.Kv; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc; import com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq; + import lombok.extern.slf4j.Slf4j; -import javax.annotation.concurrent.NotThreadSafe; -import java.util.Iterator; -import java.util.List; - -import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.*; - /** * @author lynn.bond@hotmail.com created on 2022/04/08 */ diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner.java index 3bce3827e..ad898a381 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner.java @@ -1,3 +1,20 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.createQueryReq; @@ -12,6 +29,9 @@ import java.util.function.Supplier; import javax.annotation.concurrent.NotThreadSafe; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc; +import org.apache.hugegraph.store.grpc.stream.KvStream; + import com.baidu.hugegraph.store.HgKvEntry; import com.baidu.hugegraph.store.HgKvIterator; import com.baidu.hugegraph.store.HgKvOrderedIterator; @@ -21,8 +41,6 @@ import com.baidu.hugegraph.store.buffer.KVByteBuffer; import com.baidu.hugegraph.store.client.util.PropertyUtil; import com.baidu.hugegraph.store.grpc.common.Header; import com.baidu.hugegraph.store.grpc.common.ScanOrderType; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc; -import com.baidu.hugegraph.store.grpc.stream.KvStream; import com.baidu.hugegraph.store.grpc.stream.ScanReceiptRequest; import com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq; diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner5.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner5.java index 77fcadd7e..7491601a4 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner5.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvBatchScanner5.java @@ -1,17 +1,25 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; -import com.baidu.hugegraph.store.HgPageSize; -import com.baidu.hugegraph.store.HgScanQuery; -import com.baidu.hugegraph.store.client.HgStoreNodeSession; -import com.baidu.hugegraph.store.client.type.HgStoreClientException; -import com.baidu.hugegraph.store.client.util.Base58; -import com.baidu.hugegraph.store.client.util.HgStoreClientConfig; -import com.baidu.hugegraph.store.grpc.common.Kv; -import com.baidu.hugegraph.store.grpc.stream.*; -import io.grpc.stub.StreamObserver; -import lombok.extern.slf4j.Slf4j; +import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.createQueryReq; +import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.getRequestBuilder; -import javax.annotation.concurrent.NotThreadSafe; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -24,8 +32,21 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantLock; import java.util.function.Supplier; -import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.createQueryReq; -import static com.baidu.hugegraph.store.client.grpc.KvBatchUtil.getRequestBuilder; +import javax.annotation.concurrent.NotThreadSafe; + +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc; + +import com.baidu.hugegraph.store.HgPageSize; +import com.baidu.hugegraph.store.HgScanQuery; +import com.baidu.hugegraph.store.client.HgStoreNodeSession; +import com.baidu.hugegraph.store.client.type.HgStoreClientException; +import com.baidu.hugegraph.store.client.util.Base58; +import com.baidu.hugegraph.store.client.util.HgStoreClientConfig; +import com.baidu.hugegraph.store.grpc.common.Kv; +import com.baidu.hugegraph.store.grpc.stream.*; + +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; /** * @author lynn.bond@hotmail.com created on 2022/03/23 diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvOneShotScanner.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvOneShotScanner.java index b50d4d98e..a307ff6f3 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvOneShotScanner.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvOneShotScanner.java @@ -1,3 +1,20 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; import static com.baidu.hugegraph.store.HgKvStore.SCAN_ANY; @@ -11,6 +28,8 @@ import java.util.List; import javax.annotation.concurrent.NotThreadSafe; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamBlockingStub; + import com.baidu.hugegraph.store.HgOwnerKey; import com.baidu.hugegraph.store.HgPageSize; import com.baidu.hugegraph.store.HgSeekAble; @@ -20,7 +39,6 @@ import com.baidu.hugegraph.store.client.util.HgStoreClientConst; import com.baidu.hugegraph.store.grpc.common.Header; import com.baidu.hugegraph.store.grpc.common.Kv; import com.baidu.hugegraph.store.grpc.common.ScanMethod; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamBlockingStub; import com.baidu.hugegraph.store.grpc.stream.ScanStreamReq; import com.google.protobuf.ByteString; diff --git a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvPageScanner.java b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvPageScanner.java index c6bd5795d..bf5f24f85 100644 --- a/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvPageScanner.java +++ b/hg-store-client/src/main/java/com/baidu/hugegraph/store/client/grpc/KvPageScanner.java @@ -1,3 +1,20 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.client.grpc; import static com.baidu.hugegraph.store.HgKvStore.SCAN_ANY; @@ -16,6 +33,8 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.concurrent.NotThreadSafe; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; + import com.baidu.hugegraph.store.HgOwnerKey; import com.baidu.hugegraph.store.HgPageSize; import com.baidu.hugegraph.store.HgSeekAble; @@ -27,7 +46,6 @@ import com.baidu.hugegraph.store.client.util.MetricX; import com.baidu.hugegraph.store.grpc.common.Header; import com.baidu.hugegraph.store.grpc.common.Kv; import com.baidu.hugegraph.store.grpc.common.ScanMethod; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc.HgStoreStreamStub; import com.baidu.hugegraph.store.grpc.stream.KvPageRes; import com.baidu.hugegraph.store.grpc.stream.ScanStreamReq; import com.baidu.hugegraph.store.grpc.stream.SelectParam; diff --git a/hg-store-grpc/build.sh b/hg-store-grpc/build.sh index 1906b3f2a..42aafffc7 100644 --- a/hg-store-grpc/build.sh +++ b/hg-store-grpc/build.sh @@ -1,4 +1,21 @@ #!/bin/bash +# +# 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. +# + mkdir output touch output/1 export JAVA_HOME=$ORACLEJDK_1_8_0_HOME diff --git a/hg-store-grpc/pom.xml b/hg-store-grpc/pom.xml index eb158db3f..44a954d99 100644 --- a/hg-store-grpc/pom.xml +++ b/hg-store-grpc/pom.xml @@ -1,4 +1,21 @@ + + diff --git a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java similarity index 94% rename from hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java rename to hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java index 38245f8c6..6b9d87a41 100644 --- a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java +++ b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java @@ -1,4 +1,21 @@ -package com.baidu.hugegraph.store.grpc.stream; +/* + * 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. + */ + +package org.apache.hugegraph.store.grpc.stream; import static io.grpc.MethodDescriptor.generateFullMethodName; @@ -112,28 +129,28 @@ public final class HgStoreStreamGrpc { } private static volatile io.grpc.MethodDescriptor getScanBatch2Method; + KvStream> getScanBatch2Method; @io.grpc.stub.annotations.RpcMethod( fullMethodName = SERVICE_NAME + '/' + "ScanBatch2", requestType = com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq.class, - responseType = com.baidu.hugegraph.store.grpc.stream.KvStream.class, + responseType = KvStream.class, methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getScanBatch2Method() { - io.grpc.MethodDescriptor getScanBatch2Method; + KvStream> getScanBatch2Method() { + io.grpc.MethodDescriptor getScanBatch2Method; if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) { synchronized (HgStoreStreamGrpc.class) { if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) { HgStoreStreamGrpc.getScanBatch2Method = getScanBatch2Method = - io.grpc.MethodDescriptor.newBuilder() + io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatch2")) .setSampledToLocalTracing(true) .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.baidu.hugegraph.store.grpc.stream.KvStream.getDefaultInstance())) + KvStream.getDefaultInstance())) .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatch2")) .build(); } @@ -249,7 +266,7 @@ public final class HgStoreStreamGrpc { /** */ public io.grpc.stub.StreamObserver scanBatch2( - io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.StreamObserver responseObserver) { return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatch2Method(), responseObserver); } @@ -288,7 +305,7 @@ public final class HgStoreStreamGrpc { io.grpc.stub.ServerCalls.asyncBidiStreamingCall( new MethodHandlers< com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq, - com.baidu.hugegraph.store.grpc.stream.KvStream>( + KvStream>( this, METHODID_SCAN_BATCH2))) .addMethod( getScanBatchOneShotMethod(), @@ -346,7 +363,7 @@ public final class HgStoreStreamGrpc { /** */ public io.grpc.stub.StreamObserver scanBatch2( - io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.StreamObserver responseObserver) { return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( getChannel().newCall(getScanBatch2Method(), getCallOptions()), responseObserver); } @@ -477,7 +494,7 @@ public final class HgStoreStreamGrpc { (io.grpc.stub.StreamObserver) responseObserver); case METHODID_SCAN_BATCH2: return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch2( - (io.grpc.stub.StreamObserver) responseObserver); + (io.grpc.stub.StreamObserver) responseObserver); default: throw new AssertionError(); } @@ -490,7 +507,7 @@ public final class HgStoreStreamGrpc { @java.lang.Override public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.getDescriptor(); + return HgStoreStreamProto.getDescriptor(); } @java.lang.Override diff --git a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamProto.java b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java similarity index 76% rename from hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamProto.java rename to hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java index c8d682923..7736b1538 100644 --- a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/HgStoreStreamProto.java +++ b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java @@ -1,7 +1,24 @@ +/* + * 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: store_stream.proto -package com.baidu.hugegraph.store.grpc.stream; +package org.apache.hugegraph.store.grpc.stream; public final class HgStoreStreamProto { private HgStoreStreamProto() {} diff --git a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStream.java b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java similarity index 85% rename from hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStream.java rename to hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java index c29c2fe48..fce5a832d 100644 --- a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStream.java +++ b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java @@ -1,7 +1,24 @@ +/* + * 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: store_stream.proto -package com.baidu.hugegraph.store.grpc.stream; +package org.apache.hugegraph.store.grpc.stream; import java.nio.ByteBuffer; import java.util.function.Consumer; @@ -93,15 +110,15 @@ public final class KvStream extends } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.internal_static_KvStream_descriptor; + return HgStoreStreamProto.internal_static_KvStream_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable + return HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.baidu.hugegraph.store.grpc.stream.KvStream.class, com.baidu.hugegraph.store.grpc.stream.KvStream.Builder.class); + KvStream.class, KvStream.Builder.class); } public static final int SEQ_NO_FIELD_NUMBER = 1; @@ -249,10 +266,10 @@ public final class KvStream extends if (obj == this) { return true; } - if (!(obj instanceof com.baidu.hugegraph.store.grpc.stream.KvStream)) { + if (!(obj instanceof KvStream)) { return super.equals(obj); } - com.baidu.hugegraph.store.grpc.stream.KvStream other = (com.baidu.hugegraph.store.grpc.stream.KvStream) obj; + KvStream other = (KvStream) obj; if (getSeqNo() != other.getSeqNo()) return false; @@ -287,69 +304,69 @@ public final class KvStream extends return hash; } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom(byte[] data) + public static KvStream parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom(java.io.InputStream input) + public static KvStream parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseDelimitedFrom(java.io.InputStream input) + public static KvStream parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseDelimitedFrom( + public static KvStream parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream parseFrom( + public static KvStream parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -362,7 +379,7 @@ public final class KvStream extends public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } - public static Builder newBuilder(com.baidu.hugegraph.store.grpc.stream.KvStream prototype) { + public static Builder newBuilder(KvStream prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override @@ -383,21 +400,21 @@ public final class KvStream extends public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder implements // @@protoc_insertion_point(builder_implements:KvStream) - com.baidu.hugegraph.store.grpc.stream.KvStreamOrBuilder { + KvStreamOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.internal_static_KvStream_descriptor; + return HgStoreStreamProto.internal_static_KvStream_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable + return HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable .ensureFieldAccessorsInitialized( - com.baidu.hugegraph.store.grpc.stream.KvStream.class, com.baidu.hugegraph.store.grpc.stream.KvStream.Builder.class); + KvStream.class, KvStream.Builder.class); } - // Construct using com.baidu.hugegraph.store.grpc.stream.KvStream.newBuilder() + // Construct using org.apache.hugegraph.store.grpc.stream.KvStream.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -431,17 +448,17 @@ public final class KvStream extends @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.baidu.hugegraph.store.grpc.stream.HgStoreStreamProto.internal_static_KvStream_descriptor; + return HgStoreStreamProto.internal_static_KvStream_descriptor; } @java.lang.Override - public com.baidu.hugegraph.store.grpc.stream.KvStream getDefaultInstanceForType() { - return com.baidu.hugegraph.store.grpc.stream.KvStream.getDefaultInstance(); + public KvStream getDefaultInstanceForType() { + return KvStream.getDefaultInstance(); } @java.lang.Override - public com.baidu.hugegraph.store.grpc.stream.KvStream build() { - com.baidu.hugegraph.store.grpc.stream.KvStream result = buildPartial(); + public KvStream build() { + KvStream result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } @@ -449,8 +466,8 @@ public final class KvStream extends } @java.lang.Override - public com.baidu.hugegraph.store.grpc.stream.KvStream buildPartial() { - com.baidu.hugegraph.store.grpc.stream.KvStream result = new com.baidu.hugegraph.store.grpc.stream.KvStream(this); + public KvStream buildPartial() { + KvStream result = new KvStream(this); result.seqNo_ = seqNo_; result.over_ = over_; result.version_ = version_; @@ -495,16 +512,16 @@ public final class KvStream extends } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.baidu.hugegraph.store.grpc.stream.KvStream) { - return mergeFrom((com.baidu.hugegraph.store.grpc.stream.KvStream)other); + if (other instanceof KvStream) { + return mergeFrom((KvStream)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(com.baidu.hugegraph.store.grpc.stream.KvStream other) { - if (other == com.baidu.hugegraph.store.grpc.stream.KvStream.getDefaultInstance()) return this; + public Builder mergeFrom(KvStream other) { + if (other == KvStream.getDefaultInstance()) return this; if (other.getSeqNo() != 0) { setSeqNo(other.getSeqNo()); } @@ -532,11 +549,11 @@ public final class KvStream extends com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - com.baidu.hugegraph.store.grpc.stream.KvStream parsedMessage = null; + KvStream parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.baidu.hugegraph.store.grpc.stream.KvStream) e.getUnfinishedMessage(); + parsedMessage = (KvStream) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { @@ -773,12 +790,12 @@ public final class KvStream extends } // @@protoc_insertion_point(class_scope:KvStream) - private static final com.baidu.hugegraph.store.grpc.stream.KvStream DEFAULT_INSTANCE; + private static final KvStream DEFAULT_INSTANCE; static { - DEFAULT_INSTANCE = new com.baidu.hugegraph.store.grpc.stream.KvStream(); + DEFAULT_INSTANCE = new KvStream(); } - public static com.baidu.hugegraph.store.grpc.stream.KvStream getDefaultInstance() { + public static KvStream getDefaultInstance() { return DEFAULT_INSTANCE; } @@ -803,7 +820,7 @@ public final class KvStream extends } @java.lang.Override - public com.baidu.hugegraph.store.grpc.stream.KvStream getDefaultInstanceForType() { + public KvStream getDefaultInstanceForType() { return DEFAULT_INSTANCE; } diff --git a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStreamOrBuilder.java b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java similarity index 54% rename from hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStreamOrBuilder.java rename to hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java index 5bc433605..ca35db990 100644 --- a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/KvStreamOrBuilder.java +++ b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java @@ -1,7 +1,24 @@ +/* + * 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: store_stream.proto -package com.baidu.hugegraph.store.grpc.stream; +package org.apache.hugegraph.store.grpc.stream; import java.nio.ByteBuffer; diff --git a/hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/store_stream.proto b/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/store_stream.proto similarity index 100% rename from hg-store-grpc/src/main/dev/com/baidu/hugegraph/store/grpc/stream/store_stream.proto rename to hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/store_stream.proto diff --git a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/HgStoreStreamImpl.java b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/HgStoreStreamImpl.java index fb549204e..a185271bc 100644 --- a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/HgStoreStreamImpl.java +++ b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/HgStoreStreamImpl.java @@ -1,15 +1,32 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.node.grpc; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ThreadPoolExecutor; +import org.apache.hugegraph.store.grpc.stream.HgStoreStreamGrpc; +import org.apache.hugegraph.store.grpc.stream.KvStream; import org.lognet.springboot.grpc.GRpcService; import org.springframework.beans.factory.annotation.Autowired; import com.baidu.hugegraph.store.grpc.state.ScanState; -import com.baidu.hugegraph.store.grpc.stream.HgStoreStreamGrpc; import com.baidu.hugegraph.store.grpc.stream.KvPageRes; -import com.baidu.hugegraph.store.grpc.stream.KvStream; import com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq; import com.baidu.hugegraph.store.grpc.stream.ScanStreamReq; import com.baidu.hugegraph.store.node.AppConfig; diff --git a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponse.java b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponse.java index ae9fe0c00..93eb0b671 100644 --- a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponse.java +++ b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponse.java @@ -1,22 +1,41 @@ +/* + * 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. + */ + package com.baidu.hugegraph.store.node.grpc; -import com.baidu.hugegraph.rocksdb.access.ScanIterator; -import com.baidu.hugegraph.store.buffer.ByteBufferAllocator; -import com.baidu.hugegraph.store.buffer.KVByteBuffer; -import com.baidu.hugegraph.store.grpc.stream.KvStream; -import com.baidu.hugegraph.store.grpc.stream.ScanQueryRequest; -import com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq; -import com.baidu.hugegraph.store.node.util.HgGrpc; -import com.baidu.hugegraph.store.node.util.PropertyUtil; -import io.grpc.stub.StreamObserver; -import lombok.extern.slf4j.Slf4j; +import static com.baidu.hugegraph.store.node.grpc.ScanUtil.getParallelIterator; import java.util.List; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.locks.ReentrantLock; -import static com.baidu.hugegraph.store.node.grpc.ScanUtil.getParallelIterator; +import org.apache.hugegraph.store.grpc.stream.KvStream; + +import com.baidu.hugegraph.rocksdb.access.ScanIterator; +import com.baidu.hugegraph.store.buffer.ByteBufferAllocator; +import com.baidu.hugegraph.store.buffer.KVByteBuffer; +import com.baidu.hugegraph.store.grpc.stream.ScanQueryRequest; +import com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq; +import com.baidu.hugegraph.store.node.util.HgGrpc; +import com.baidu.hugegraph.store.node.util.PropertyUtil; + +import io.grpc.stub.StreamObserver; +import lombok.extern.slf4j.Slf4j; /** * 批量查询处理器,批量查询数据,流式返回数据。 diff --git a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponseFactory.java b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponseFactory.java index eca79bbc1..35436034b 100644 --- a/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponseFactory.java +++ b/hg-store-node/src/main/java/com/baidu/hugegraph/store/node/grpc/ScanBatchResponseFactory.java @@ -1,13 +1,31 @@ -package com.baidu.hugegraph.store.node.grpc; +/* + * 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. + */ -import com.alipay.sofa.jraft.util.concurrent.ConcurrentHashSet; -import com.baidu.hugegraph.store.grpc.stream.KvStream; -import com.baidu.hugegraph.store.node.util.HgAssert; -import io.grpc.stub.StreamObserver; +package com.baidu.hugegraph.store.node.grpc; import java.util.Set; import java.util.concurrent.ThreadPoolExecutor; +import org.apache.hugegraph.store.grpc.stream.KvStream; + +import com.alipay.sofa.jraft.util.concurrent.ConcurrentHashSet; + +import io.grpc.stub.StreamObserver; + public class ScanBatchResponseFactory { private final static ScanBatchResponseFactory instance = new ScanBatchResponseFactory();