refact: handle rpc package alone for other modules

Change-Id: Icd740de03f9572d8d515c3d2237c2c6cb8318af3
This commit is contained in:
imbajin 2023-04-26 11:08:15 +08:00
parent 03b6d3761b
commit d62386b5a3
17 changed files with 390 additions and 101 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
*/

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -1,4 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

View File

@ -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<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq,
com.baidu.hugegraph.store.grpc.stream.KvStream> 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<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq,
com.baidu.hugegraph.store.grpc.stream.KvStream> getScanBatch2Method() {
io.grpc.MethodDescriptor<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq, com.baidu.hugegraph.store.grpc.stream.KvStream> getScanBatch2Method;
KvStream> getScanBatch2Method() {
io.grpc.MethodDescriptor<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq, KvStream> getScanBatch2Method;
if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) {
synchronized (HgStoreStreamGrpc.class) {
if ((getScanBatch2Method = HgStoreStreamGrpc.getScanBatch2Method) == null) {
HgStoreStreamGrpc.getScanBatch2Method = getScanBatch2Method =
io.grpc.MethodDescriptor.<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq, com.baidu.hugegraph.store.grpc.stream.KvStream>newBuilder()
io.grpc.MethodDescriptor.<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq, KvStream>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<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq> scanBatch2(
io.grpc.stub.StreamObserver<com.baidu.hugegraph.store.grpc.stream.KvStream> responseObserver) {
io.grpc.stub.StreamObserver<KvStream> 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<com.baidu.hugegraph.store.grpc.stream.ScanStreamBatchReq> scanBatch2(
io.grpc.stub.StreamObserver<com.baidu.hugegraph.store.grpc.stream.KvStream> responseObserver) {
io.grpc.stub.StreamObserver<KvStream> responseObserver) {
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
getChannel().newCall(getScanBatch2Method(), getCallOptions()), responseObserver);
}
@ -477,7 +494,7 @@ public final class HgStoreStreamGrpc {
(io.grpc.stub.StreamObserver<com.baidu.hugegraph.store.grpc.stream.KvPageRes>) responseObserver);
case METHODID_SCAN_BATCH2:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.scanBatch2(
(io.grpc.stub.StreamObserver<com.baidu.hugegraph.store.grpc.stream.KvStream>) responseObserver);
(io.grpc.stub.StreamObserver<KvStream>) 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

View File

@ -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() {}

View File

@ -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<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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
/**
* 批量查询处理器批量查询数据流式返回数据

View File

@ -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();