diff --git a/hugegraph-store/hg-store-grpc/pom.xml b/hugegraph-store/hg-store-grpc/pom.xml
new file mode 100644
index 000000000..dac8a811d
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/pom.xml
@@ -0,0 +1,162 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache.hugegraph
+ hugegraph-store
+ ${revision}
+ ../pom.xml
+
+
+ hg-store-grpc
+
+
+ 11
+ 11
+
+ 1.6.2
+ 1.39.0
+ 3.17.2
+ 0.6.1
+
+
+
+
+
+ io.grpc
+ grpc-netty-shaded
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-protobuf
+ ${grpc.version}
+
+
+ io.grpc
+ grpc-stub
+ ${grpc.version}
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+
+
+ ${basedir}/src/main/java
+
+
+ src/main/resources
+
+
+ src/main/proto
+
+
+
+
+ kr.motd.maven
+ os-maven-plugin
+ ${os.plugin.version}
+
+
+
+
+ org.xolstice.maven.plugins
+ protobuf-maven-plugin
+ ${protobuf.plugin.version}
+ true
+
+
+ com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
+
+ grpc-java
+
+ io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
+
+
+ ${project.basedir}/src/main/proto
+
+
+ ${project.basedir}/src/main/java
+
+ false
+
+
+
+
+
+ generate-sources
+
+
+ compile
+
+ compile-custom
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.3.0
+
+
+ add-source
+ generate-sources
+
+ add-source
+
+
+
+ ${basedir}/src/main/java
+ ${basedir}/src/main/dev
+
+
+
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+
+ src/main/java
+
+
+
+
+
+
+ initialize
+
+ clean
+
+
+
+
+
+
+
diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java
new file mode 100644
index 000000000..bd7a2a2b3
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamGrpc.java
@@ -0,0 +1,560 @@
+/*
+ * 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;
+
+/**
+ *
+ **
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ *
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.39.0)",
+ comments = "Source: store_stream.proto")
+public final class HgStoreStreamGrpc {
+
+ private HgStoreStreamGrpc() {}
+
+ public static final String SERVICE_NAME = "HgStoreStream";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor getScanMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "Scan",
+ requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class,
+ responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ public static io.grpc.MethodDescriptor getScanMethod() {
+ io.grpc.MethodDescriptor getScanMethod;
+ if ((getScanMethod = HgStoreStreamGrpc.getScanMethod) == null) {
+ synchronized (HgStoreStreamGrpc.class) {
+ if ((getScanMethod = HgStoreStreamGrpc.getScanMethod) == null) {
+ HgStoreStreamGrpc.getScanMethod = getScanMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Scan"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance()))
+ .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("Scan"))
+ .build();
+ }
+ }
+ }
+ return getScanMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getScanOneShotMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ScanOneShot",
+ requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamReq.class,
+ responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getScanOneShotMethod() {
+ io.grpc.MethodDescriptor getScanOneShotMethod;
+ if ((getScanOneShotMethod = HgStoreStreamGrpc.getScanOneShotMethod) == null) {
+ synchronized (HgStoreStreamGrpc.class) {
+ if ((getScanOneShotMethod = HgStoreStreamGrpc.getScanOneShotMethod) == null) {
+ HgStoreStreamGrpc.getScanOneShotMethod = getScanOneShotMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanOneShot"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamReq.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance()))
+ .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanOneShot"))
+ .build();
+ }
+ }
+ }
+ return getScanOneShotMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getScanBatchMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ScanBatch",
+ requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class,
+ responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ public static io.grpc.MethodDescriptor getScanBatchMethod() {
+ io.grpc.MethodDescriptor getScanBatchMethod;
+ if ((getScanBatchMethod = HgStoreStreamGrpc.getScanBatchMethod) == null) {
+ synchronized (HgStoreStreamGrpc.class) {
+ if ((getScanBatchMethod = HgStoreStreamGrpc.getScanBatchMethod) == null) {
+ HgStoreStreamGrpc.getScanBatchMethod = getScanBatchMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatch"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance()))
+ .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatch"))
+ .build();
+ }
+ }
+ }
+ return getScanBatchMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getScanBatch2Method;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ScanBatch2",
+ requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class,
+ responseType = KvStream.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ public static io.grpc.MethodDescriptor 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()
+ .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatch2"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ KvStream.getDefaultInstance()))
+ .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatch2"))
+ .build();
+ }
+ }
+ }
+ return getScanBatch2Method;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getScanBatchOneShotMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "ScanBatchOneShot",
+ requestType = org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.class,
+ responseType = org.apache.hugegraph.store.grpc.stream.KvPageRes.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getScanBatchOneShotMethod() {
+ io.grpc.MethodDescriptor getScanBatchOneShotMethod;
+ if ((getScanBatchOneShotMethod = HgStoreStreamGrpc.getScanBatchOneShotMethod) == null) {
+ synchronized (HgStoreStreamGrpc.class) {
+ if ((getScanBatchOneShotMethod = HgStoreStreamGrpc.getScanBatchOneShotMethod) == null) {
+ HgStoreStreamGrpc.getScanBatchOneShotMethod = getScanBatchOneShotMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ScanBatchOneShot"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ org.apache.hugegraph.store.grpc.stream.KvPageRes.getDefaultInstance()))
+ .setSchemaDescriptor(new HgStoreStreamMethodDescriptorSupplier("ScanBatchOneShot"))
+ .build();
+ }
+ }
+ }
+ return getScanBatchOneShotMethod;
+ }
+
+ /**
+ * Creates a new async stub that supports all call types for the service
+ */
+ public static HgStoreStreamStub newStub(io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HgStoreStreamStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamStub(channel, callOptions);
+ }
+ };
+ return HgStoreStreamStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+ */
+ public static HgStoreStreamBlockingStub newBlockingStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HgStoreStreamBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamBlockingStub(channel, callOptions);
+ }
+ };
+ return HgStoreStreamBlockingStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new ListenableFuture-style stub that supports unary calls on the service
+ */
+ public static HgStoreStreamFutureStub newFutureStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public HgStoreStreamFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamFutureStub(channel, callOptions);
+ }
+ };
+ return HgStoreStreamFutureStub.newStub(factory, channel);
+ }
+
+ /**
+ *
+ **
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ *
+ */
+ public static abstract class HgStoreStreamImplBase implements io.grpc.BindableService {
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scan(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanMethod(), responseObserver);
+ }
+
+ /**
+ */
+ public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanOneShotMethod(), responseObserver);
+ }
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scanBatch(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatchMethod(), responseObserver);
+ }
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scanBatch2(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getScanBatch2Method(), responseObserver);
+ }
+
+ /**
+ */
+ public void scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getScanBatchOneShotMethod(), responseObserver);
+ }
+
+ @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getScanMethod(),
+ io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
+ new MethodHandlers<
+ org.apache.hugegraph.store.grpc.stream.ScanStreamReq,
+ org.apache.hugegraph.store.grpc.stream.KvPageRes>(
+ this, METHODID_SCAN)))
+ .addMethod(
+ getScanOneShotMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ org.apache.hugegraph.store.grpc.stream.ScanStreamReq,
+ org.apache.hugegraph.store.grpc.stream.KvPageRes>(
+ this, METHODID_SCAN_ONE_SHOT)))
+ .addMethod(
+ getScanBatchMethod(),
+ io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
+ new MethodHandlers<
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq,
+ org.apache.hugegraph.store.grpc.stream.KvPageRes>(
+ this, METHODID_SCAN_BATCH)))
+ .addMethod(
+ getScanBatch2Method(),
+ io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
+ new MethodHandlers<
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq,
+ KvStream>(
+ this, METHODID_SCAN_BATCH2)))
+ .addMethod(
+ getScanBatchOneShotMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq,
+ org.apache.hugegraph.store.grpc.stream.KvPageRes>(
+ this, METHODID_SCAN_BATCH_ONE_SHOT)))
+ .build();
+ }
+ }
+
+ /**
+ *
+ **
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ *
+ */
+ public static final class HgStoreStreamStub extends io.grpc.stub.AbstractAsyncStub {
+ private HgStoreStreamStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HgStoreStreamStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scan(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
+ getChannel().newCall(getScanMethod(), getCallOptions()), responseObserver);
+ }
+
+ /**
+ */
+ public void scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request, responseObserver);
+ }
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scanBatch(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
+ getChannel().newCall(getScanBatchMethod(), getCallOptions()), responseObserver);
+ }
+
+ /**
+ */
+ public io.grpc.stub.StreamObserver scanBatch2(
+ io.grpc.stub.StreamObserver responseObserver) {
+ return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
+ getChannel().newCall(getScanBatch2Method(), getCallOptions()), responseObserver);
+ }
+
+ /**
+ */
+ public void scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request, responseObserver);
+ }
+ }
+
+ /**
+ *
+ **
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ *
+ */
+ public static final class HgStoreStreamBlockingStub extends io.grpc.stub.AbstractBlockingStub {
+ private HgStoreStreamBlockingStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HgStoreStreamBlockingStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamBlockingStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public org.apache.hugegraph.store.grpc.stream.KvPageRes scanOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getScanOneShotMethod(), getCallOptions(), request);
+ }
+
+ /**
+ */
+ public org.apache.hugegraph.store.grpc.stream.KvPageRes scanBatchOneShot(org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getScanBatchOneShotMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ *
+ **
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ *
+ */
+ public static final class HgStoreStreamFutureStub extends io.grpc.stub.AbstractFutureStub {
+ private HgStoreStreamFutureStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected HgStoreStreamFutureStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new HgStoreStreamFutureStub(channel, callOptions);
+ }
+
+ /**
+ */
+ public com.google.common.util.concurrent.ListenableFuture scanOneShot(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamReq request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getScanOneShotMethod(), getCallOptions()), request);
+ }
+
+ /**
+ */
+ public com.google.common.util.concurrent.ListenableFuture scanBatchOneShot(
+ org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getScanBatchOneShotMethod(), getCallOptions()), request);
+ }
+ }
+
+ private static final int METHODID_SCAN_ONE_SHOT = 0;
+ private static final int METHODID_SCAN_BATCH_ONE_SHOT = 1;
+ private static final int METHODID_SCAN = 2;
+ private static final int METHODID_SCAN_BATCH = 3;
+ private static final int METHODID_SCAN_BATCH2 = 4;
+
+ private static final class MethodHandlers implements
+ io.grpc.stub.ServerCalls.UnaryMethod,
+ io.grpc.stub.ServerCalls.ServerStreamingMethod,
+ io.grpc.stub.ServerCalls.ClientStreamingMethod,
+ io.grpc.stub.ServerCalls.BidiStreamingMethod {
+ private final HgStoreStreamImplBase serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(HgStoreStreamImplBase serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_SCAN_ONE_SHOT:
+ serviceImpl.scanOneShot((org.apache.hugegraph.store.grpc.stream.ScanStreamReq) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ case METHODID_SCAN_BATCH_ONE_SHOT:
+ serviceImpl.scanBatchOneShot((org.apache.hugegraph.store.grpc.stream.ScanStreamBatchReq) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver invoke(
+ io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_SCAN:
+ return (io.grpc.stub.StreamObserver) serviceImpl.scan(
+ (io.grpc.stub.StreamObserver) responseObserver);
+ case METHODID_SCAN_BATCH:
+ return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch(
+ (io.grpc.stub.StreamObserver) responseObserver);
+ case METHODID_SCAN_BATCH2:
+ return (io.grpc.stub.StreamObserver) serviceImpl.scanBatch2(
+ (io.grpc.stub.StreamObserver) responseObserver);
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ private static abstract class HgStoreStreamBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+ HgStoreStreamBaseDescriptorSupplier() {}
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+ return HgStoreStreamProto.getDescriptor();
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+ return getFileDescriptor().findServiceByName("HgStoreStream");
+ }
+ }
+
+ private static final class HgStoreStreamFileDescriptorSupplier
+ extends HgStoreStreamBaseDescriptorSupplier {
+ HgStoreStreamFileDescriptorSupplier() {}
+ }
+
+ private static final class HgStoreStreamMethodDescriptorSupplier
+ extends HgStoreStreamBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+ private final String methodName;
+
+ HgStoreStreamMethodDescriptorSupplier(String methodName) {
+ this.methodName = methodName;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+ return getServiceDescriptor().findMethodByName(methodName);
+ }
+ }
+
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (HgStoreStreamGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new HgStoreStreamFileDescriptorSupplier())
+ .addMethod(getScanMethod())
+ .addMethod(getScanOneShotMethod())
+ .addMethod(getScanBatchMethod())
+ .addMethod(getScanBatch2Method())
+ .addMethod(getScanBatchOneShotMethod())
+ .build();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java
new file mode 100644
index 000000000..7fb363b40
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/HgStoreStreamProto.java
@@ -0,0 +1,78 @@
+/*
+ * 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 org.apache.hugegraph.store.grpc.stream;
+
+public final class HgStoreStreamProto {
+ private HgStoreStreamProto() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_KvStream_descriptor;
+ static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_KvStream_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\022store_stream.proto\032\022store_common.proto" +
+ "\032\027store_stream_meta.proto\"I\n\010KvStream\022\016\n" +
+ "\006seq_no\030\001 \001(\005\022\014\n\004over\030\002 \001(\010\022\017\n\007version\030\004" +
+ " \001(\r\022\016\n\006stream\030\005 \001(\0142\205\002\n\rHgStoreStream\022(" +
+ "\n\004Scan\022\016.ScanStreamReq\032\n.KvPageRes\"\000(\0010\001" +
+ "\022+\n\013ScanOneShot\022\016.ScanStreamReq\032\n.KvPage" +
+ "Res\"\000\0222\n\tScanBatch\022\023.ScanStreamBatchReq\032" +
+ "\n.KvPageRes\"\000(\0010\001\0222\n\nScanBatch2\022\023.ScanSt" +
+ "reamBatchReq\032\t.KvStream\"\000(\0010\001\0225\n\020ScanBat" +
+ "chOneShot\022\023.ScanStreamBatchReq\032\n.KvPageR" +
+ "es\"\000B=\n%org.apache.hugegraph.store.grpc.s" +
+ "treamB\022HgStoreStreamProtoP\001b\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor(),
+ org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor(),
+ });
+ internal_static_KvStream_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_KvStream_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_KvStream_descriptor,
+ new java.lang.String[] { "SeqNo", "Over", "Version", "Stream", });
+ org.apache.hugegraph.store.grpc.common.HgStoreCommonProto.getDescriptor();
+ org.apache.hugegraph.store.grpc.stream.HgStoreStreamMetaProto.getDescriptor();
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java
new file mode 100644
index 000000000..00476ffeb
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStream.java
@@ -0,0 +1,910 @@
+/*
+ * 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 org.apache.hugegraph.store.grpc.stream;
+
+import java.nio.ByteBuffer;
+import java.util.function.Consumer;
+
+/**
+ * In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be rewritten.
+ */
+public final class KvStream extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point
+ // (message_implements
+ // :KvStream)
+ KvStreamOrBuilder {
+ public static final int SEQ_NO_FIELD_NUMBER = 1;
+ public static final int OVER_FIELD_NUMBER = 2;
+ public static final int VERSION_FIELD_NUMBER = 4;
+ public static final int STREAM_FIELD_NUMBER = 5;
+ public static final int TYPE_FIELD_NUMBER = 6;
+ private static final long serialVersionUID = 0L;
+ // @@protoc_insertion_point(class_scope:KvStream)
+ private static final KvStream DEFAULT_INSTANCE;
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser<>() {
+ @java.lang.Override
+ public KvStream parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return new KvStream(input, extensionRegistry);
+ }
+ };
+
+ static {
+ DEFAULT_INSTANCE = new KvStream();
+ }
+
+ private int seqNo_;
+ private boolean over_;
+ private int version_;
+ private ByteBuffer stream_;
+ private Consumer complete_;
+ private int type_;
+ private byte memoizedIsInitialized = -1;
+
+ // Use KvStream.newBuilder() to construct.
+ private KvStream(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+
+ private KvStream() {
+ stream_ = ByteBuffer.allocate(0);
+ }
+ private KvStream(
+ 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;
+ case 8: {
+
+ seqNo_ = input.readInt32();
+ break;
+ }
+ case 16: {
+
+ over_ = input.readBool();
+ break;
+ }
+ case 32: {
+
+ version_ = input.readUInt32();
+ break;
+ }
+ case 42: {
+
+ stream_ = input.readByteBuffer();
+ break;
+ }
+ default: {
+ if (!parseUnknownField(
+ input, unknownFields, extensionRegistry, tag)) {
+ done = true;
+ }
+ break;
+ }
+ }
+ }
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(this);
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(
+ e).setUnfinishedMessage(this);
+ } finally {
+ this.unknownFields = unknownFields.build();
+ makeExtensionsImmutable();
+ }
+ }
+
+ public static com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return HgStoreStreamProto.internal_static_KvStream_descriptor;
+ }
+
+ public static KvStream parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ 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 KvStream parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ 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 KvStream parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+
+ public static KvStream parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+
+ public static KvStream parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ 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 KvStream parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+
+ 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 KvStream parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+
+ public static KvStream parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+
+ public static Builder newBuilder(KvStream prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+
+ public static KvStream getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new KvStream();
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ KvStream.class, KvStream.Builder.class);
+ }
+
+ /**
+ *
+ * query times.
+ *
+ *
+ * int32 seq_no = 1;
+ *
+ * @return The seqNo.
+ */
+ @java.lang.Override
+ public int getSeqNo() {
+ return seqNo_;
+ }
+
+ /**
+ *
+ * true=no more data
+ *
+ *
+ * bool over = 2;
+ *
+ * @return The over.
+ */
+ @java.lang.Override
+ public boolean getOver() {
+ return over_;
+ }
+
+ /**
+ * uint32 version = 4;
+ *
+ * @return The version.
+ */
+ @java.lang.Override
+ public int getVersion() {
+ return version_;
+ }
+
+ /**
+ * bytes stream = 5;
+ *
+ * @return The stream.
+ */
+ @java.lang.Override
+ public ByteBuffer getStream() {
+ return stream_;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @return The enum numeric value on the wire for type.
+ */
+ @java.lang.Override
+ public int getTypeValue() {
+ return type_;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @return The type.
+ */
+ @java.lang.Override
+ public org.apache.hugegraph.store.grpc.stream.KvStreamType getType() {
+ @SuppressWarnings("deprecation")
+ org.apache.hugegraph.store.grpc.stream.KvStreamType result =
+ org.apache.hugegraph.store.grpc.stream.KvStreamType.valueOf(type_);
+ return result == null ? org.apache.hugegraph.store.grpc.stream.KvStreamType.UNRECOGNIZED :
+ result;
+ }
+
+ @java.lang.Override
+ public boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (seqNo_ != 0) {
+ output.writeInt32(1, seqNo_);
+ }
+ if (over_) {
+ output.writeBool(2, over_);
+ }
+ if (version_ != 0) {
+ output.writeUInt32(4, version_);
+ }
+ if (stream_.limit() > 0) {
+ output.writeByteArray(5, stream_.array(), 0, stream_.limit());
+ }
+ if (type_ !=
+ org.apache.hugegraph.store.grpc.stream.KvStreamType.STREAM_TYPE_NONE.getNumber()) {
+ output.writeEnum(6, type_);
+ }
+ unknownFields.writeTo(output);
+ if (complete_ != null) {
+ complete_.accept(this);
+ }
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (seqNo_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeInt32Size(1, seqNo_);
+ }
+ if (over_) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(2, over_);
+ }
+ if (version_ != 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt32Size(4, version_);
+ }
+ if (stream_.limit() > 0) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeTagSize(5) +
+ com.google.protobuf.CodedOutputStream
+ .computeUInt32SizeNoTag(stream_.limit())
+ + stream_.limit();
+ }
+ if (type_ !=
+ org.apache.hugegraph.store.grpc.stream.KvStreamType.STREAM_TYPE_NONE.getNumber()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeEnumSize(6, type_);
+ }
+ size += unknownFields.getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof KvStream)) {
+ return super.equals(obj);
+ }
+ KvStream other = (KvStream) obj;
+
+ if (getSeqNo()
+ != other.getSeqNo()) {
+ return false;
+ }
+ if (getOver()
+ != other.getOver()) {
+ return false;
+ }
+ if (getVersion()
+ != other.getVersion()) {
+ return false;
+ }
+ if (!getStream()
+ .equals(other.getStream())) {
+ return false;
+ }
+ return unknownFields.equals(other.unknownFields);
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + SEQ_NO_FIELD_NUMBER;
+ hash = (53 * hash) + getSeqNo();
+ hash = (37 * hash) + OVER_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
+ getOver());
+ hash = (37 * hash) + VERSION_FIELD_NUMBER;
+ hash = (53 * hash) + getVersion();
+ hash = (37 * hash) + STREAM_FIELD_NUMBER;
+ hash = (53 * hash) + getStream().hashCode();
+ hash = (29 * hash) + unknownFields.hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() {
+ return newBuilder();
+ }
+
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public KvStream getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ /**
+ * Protobuf type {@code KvStream}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:KvStream)
+ KvStreamOrBuilder {
+ private int seqNo_;
+ private boolean over_;
+ private int version_;
+ private ByteBuffer stream_ = ByteBuffer.allocate(0);
+ private int type_ = 0;
+ private Consumer complete_;
+
+ // Construct using org.apache.hugegraph.store.grpc.stream.KvStream.newBuilder()
+ private Builder() {
+ maybeForceBuilderInitialization();
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+ maybeForceBuilderInitialization();
+ }
+
+ public static com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return HgStoreStreamProto.internal_static_KvStream_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return HgStoreStreamProto.internal_static_KvStream_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ KvStream.class, KvStream.Builder.class);
+ }
+
+ private void maybeForceBuilderInitialization() {
+ if (com.google.protobuf.GeneratedMessageV3
+ .alwaysUseFieldBuilders) {
+ }
+ }
+
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ seqNo_ = 0;
+
+ over_ = false;
+
+ version_ = 0;
+
+ stream_ = ByteBuffer.allocate(0);
+
+ complete_ = null;
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return HgStoreStreamProto.internal_static_KvStream_descriptor;
+ }
+
+ @java.lang.Override
+ public KvStream getDefaultInstanceForType() {
+ return KvStream.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public KvStream build() {
+ KvStream result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public KvStream buildPartial() {
+ KvStream result = new KvStream(this);
+ result.seqNo_ = seqNo_;
+ result.over_ = over_;
+ result.version_ = version_;
+ result.stream_ = stream_;
+ result.complete_ = complete_;
+ onBuilt();
+ // d���
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof KvStream) {
+ return mergeFrom((KvStream) other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(KvStream other) {
+ if (other == KvStream.getDefaultInstance()) return this;
+ if (other.getSeqNo() != 0) {
+ setSeqNo(other.getSeqNo());
+ }
+ if (other.getOver()) {
+ setOver(other.getOver());
+ }
+ if (other.getVersion() != 0) {
+ setVersion(other.getVersion());
+ }
+ if (other.getStream() != ByteBuffer.allocate(0)) {
+ setStream(other.getStream());
+ }
+ this.mergeUnknownFields(other.unknownFields);
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ KvStream parsedMessage = null;
+ try {
+ parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ parsedMessage = (KvStream) e.getUnfinishedMessage();
+ throw e.unwrapIOException();
+ } finally {
+ if (parsedMessage != null) {
+ mergeFrom(parsedMessage);
+ }
+ }
+ return this;
+ }
+
+ /**
+ *
+ * query times.
+ *
+ *
+ * int32 seq_no = 1;
+ *
+ * @return The seqNo.
+ */
+ @java.lang.Override
+ public int getSeqNo() {
+ return seqNo_;
+ }
+
+ /**
+ *
+ * query times.
+ *
+ *
+ * int32 seq_no = 1;
+ *
+ * @param value The seqNo to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSeqNo(int value) {
+
+ seqNo_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ *
+ * query times.
+ *
+ *
+ * int32 seq_no = 1;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearSeqNo() {
+
+ seqNo_ = 0;
+ onChanged();
+ return this;
+ }
+
+ /**
+ *
+ * true=no more data
+ *
+ *
+ * bool over = 2;
+ *
+ * @return The over.
+ */
+ @java.lang.Override
+ public boolean getOver() {
+ return over_;
+ }
+
+ /**
+ *
+ * true=no more data
+ *
+ *
+ * bool over = 2;
+ *
+ * @param value The over to set.
+ * @return This builder for chaining.
+ */
+ public Builder setOver(boolean value) {
+
+ over_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ *
+ * true=no more data
+ *
+ *
+ * bool over = 2;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearOver() {
+
+ over_ = false;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * uint32 version = 4;
+ *
+ * @return The version.
+ */
+ @java.lang.Override
+ public int getVersion() {
+ return version_;
+ }
+
+ /**
+ * uint32 version = 4;
+ *
+ * @param value The version to set.
+ * @return This builder for chaining.
+ */
+ public Builder setVersion(int value) {
+
+ version_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * uint32 version = 4;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearVersion() {
+
+ version_ = 0;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * bytes stream = 5;
+ *
+ * @return The stream.
+ */
+ @java.lang.Override
+ public ByteBuffer getStream() {
+ return stream_;
+ }
+
+ /**
+ * bytes stream = 5;
+ *
+ * @param value The stream to set.
+ * @return This builder for chaining.
+ */
+ public Builder setStream(ByteBuffer value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ stream_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * bytes stream = 5;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearStream() {
+
+ stream_ = getDefaultInstance().getStream();
+ onChanged();
+ return this;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @return The enum numeric value on the wire for type.
+ */
+ @java.lang.Override
+ public int getTypeValue() {
+ return type_;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @param value The enum numeric value on the wire for type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setTypeValue(int value) {
+
+ type_ = value;
+ onChanged();
+ return this;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @return The type.
+ */
+ @java.lang.Override
+ public org.apache.hugegraph.store.grpc.stream.KvStreamType getType() {
+ @SuppressWarnings("deprecation")
+ org.apache.hugegraph.store.grpc.stream.KvStreamType result =
+ org.apache.hugegraph.store.grpc.stream.KvStreamType.valueOf(type_);
+ return result == null ?
+ org.apache.hugegraph.store.grpc.stream.KvStreamType.UNRECOGNIZED : result;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @param value The type to set.
+ * @return This builder for chaining.
+ */
+ public Builder setType(org.apache.hugegraph.store.grpc.stream.KvStreamType value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ type_ = value.getNumber();
+ onChanged();
+ return this;
+ }
+
+ /**
+ * .KvStreamType type = 6;
+ *
+ * @return This builder for chaining.
+ */
+ public Builder clearType() {
+
+ type_ = 0;
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+ public void complete(Consumer consumer) {
+ this.complete_ = consumer;
+ }
+
+ // @@protoc_insertion_point(builder_scope:KvStream)
+ }
+
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java
new file mode 100644
index 000000000..b84899643
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/KvStreamOrBuilder.java
@@ -0,0 +1,70 @@
+/*
+ * 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 org.apache.hugegraph.store.grpc.stream;
+
+import java.nio.ByteBuffer;
+
+public interface KvStreamOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:KvStream)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ *query times.
+ *
+ *
+ * int32 seq_no = 1;
+ * @return The seqNo.
+ */
+ int getSeqNo();
+
+ /**
+ *
+ *true=no more data
+ *
+ *
+ * bool over = 2;
+ * @return The over.
+ */
+ boolean getOver();
+
+ /**
+ * uint32 version = 4;
+ * @return The version.
+ */
+ int getVersion();
+
+ /**
+ * bytes stream = 5;
+ * @return The stream.
+ */
+ ByteBuffer getStream();
+ /**
+ * .KvStreamType type = 6;
+ * @return The enum numeric value on the wire for type.
+ */
+ int getTypeValue();
+ /**
+ * .KvStreamType type = 6;
+ * @return The type.
+ */
+ org.apache.hugegraph.store.grpc.stream.KvStreamType getType();
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/store_stream.proto b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/store_stream.proto
new file mode 100644
index 000000000..7ea840d9f
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/dev/org/apache/hugegraph/store/grpc/stream/store_stream.proto
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+import "store_common.proto";
+import "store_stream_meta.proto";
+option java_multiple_files = true;
+option java_package = "org.apache.hugegraph.store.grpc.stream";
+option java_outer_classname = "HgStoreStreamProto";
+
+/**
+ In order to improve performance, reuse memory, and reduce gc recycling, the KvStream.writeTo method needs to be overwrite.
+ */
+service HgStoreStream {
+
+ rpc Scan(stream ScanStreamReq) returns (stream KvPageRes) {}
+ rpc ScanOneShot(ScanStreamReq) returns (KvPageRes) {}
+ rpc ScanBatch(stream ScanStreamBatchReq) returns (stream KvPageRes) {}
+ rpc ScanBatch2(stream ScanStreamBatchReq) returns (stream KvStream) {}
+ rpc ScanBatchOneShot(ScanStreamBatchReq) returns (KvPageRes) {}
+}
+
+
+message KvStream {
+ int32 seq_no = 1; //query times.
+ bool over = 2; //true=no more data
+ uint32 version = 4;
+ bytes stream = 5;
+ KvStreamType type = 6;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/graphpb.proto b/hugegraph-store/hg-store-grpc/src/main/proto/graphpb.proto
new file mode 100644
index 000000000..a245002f8
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/graphpb.proto
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+package graph_pb;
+
+option java_package = "org.apache.hugegraph.store.grpc";
+
+service GraphStore {
+ rpc ScanPartition(stream ScanPartitionRequest) returns (stream ScanResponse){}
+}
+
+message ScanPartitionRequest{
+ enum ScanType{
+ SCAN_UNKNOWN = 0;
+ SCAN_VERTEX = 1;
+ SCAN_EDGE = 2;
+ }
+ // 请求参数
+ message Request{
+ ScanType scan_type = 1;
+ string graph_name = 2;
+ uint32 partition_id = 3;
+ uint32 start_code = 4;
+ uint32 end_code = 5;
+ // 过滤条件
+ string condition = 6;
+ string table = 7;
+ int64 limit = 8;
+ int32 boundary = 9;
+ bytes position = 10;
+ // 返回条件
+ repeated int64 properties = 11;
+ }
+
+
+ message Reply{
+ int32 seq_no = 1;
+ }
+ RequestHeader header = 1;
+ oneof request {
+ Request scan_request = 2;
+ // 每消费一个数据包,通知服务端一次,返回消息序号
+ Reply reply_request = 4;
+ }
+}
+
+message ScanResponse{
+ ResponseHeader header = 1;
+ // 消息序号
+ int32 seq_no = 2;
+ repeated Vertex vertex = 3;
+ repeated Edge edge = 4;
+}
+
+
+message Property{
+ uint64 label = 1;
+ Variant value = 2;
+}
+
+message Vertex{
+ int64 label = 1; // 点类型
+ Variant id = 2; // 点ID
+ repeated Property properties = 3; //点属性
+}
+
+message Edge{
+ int64 label = 1; // 边类型
+ int64 sourceLabel = 2;
+ int64 targetLabel = 3;
+ Variant source_id = 4; // 源点ID
+ Variant target_id = 5; // 目标点ID
+
+ repeated Property properties = 6; //边属性
+}
+
+message Variant {
+ optional VariantType type = 1;
+ optional int32 value_int32 = 2;
+ optional int64 value_int64 = 3;
+ optional float value_float = 4;
+ optional double value_double = 5;
+ optional string value_string = 6;
+ optional bytes value_bytes = 7;
+ optional string value_datetime = 8;
+ optional bool value_boolean = 9;
+}
+
+enum VariantType {
+ VT_UNKNOWN = 0;
+ VT_BOOLEAN = 1;
+ VT_INT = 2;
+ VT_LONG = 3;
+ VT_FLOAT = 4;
+ VT_DOUBLE = 7;
+ VT_STRING = 8;
+ VT_BYTES = 9;
+ VT_DATETIME = 10;
+}
+
+
+
+message RequestHeader {
+ // 发送者 ID.
+ uint64 sender_id = 2;
+}
+
+message ResponseHeader {
+ uint64 sender_id = 1;
+ Error error = 2;
+}
+
+
+enum ErrorType {
+ OK = 0;
+ UNKNOWN = 1;
+}
+
+message Error {
+ ErrorType type = 1;
+ string message = 2;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/healthy.proto b/hugegraph-store/hg-store-grpc/src/main/proto/healthy.proto
new file mode 100644
index 000000000..ca6ba06bb
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/healthy.proto
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+option java_package = "org.apache.hugegraph.store.grpc";
+
+import "google/protobuf/empty.proto";
+
+service Healthy {
+ rpc IsOk(google.protobuf.Empty) returns (StringReply) {}
+}
+
+message StringReply {
+ string message = 1;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/store_common.proto b/hugegraph-store/hg-store-grpc/src/main/proto/store_common.proto
new file mode 100644
index 000000000..fc9934dec
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/store_common.proto
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "org.apache.hugegraph.store.grpc.common";
+option java_outer_classname = "HgStoreCommonProto";
+
+message Header {
+ string graph = 1;
+}
+message Tkv {
+ string table = 1;
+ bytes key = 2;
+ bytes value = 3;
+ int32 code = 9;
+
+}
+
+message Tk {
+ string table = 1;
+ bytes key = 2;
+ int32 code = 9;
+}
+
+message Tp {
+ string table = 1;
+ bytes prefix = 2;
+ int32 code = 9;
+}
+
+message Tse {
+ string table = 1;
+ Key start = 2;
+ Key end = 3;
+}
+
+message Key {
+ bytes key = 1;
+ int32 code = 9;
+}
+
+message Kv {
+ bytes key = 1;
+ bytes value = 2;
+ int32 code = 9;
+}
+
+message ResStatus {
+ ResCode code = 1;
+ string msg = 2;
+}
+
+/*--- enum ---*/
+enum ResCode {
+ RES_CODE_OK = 0;
+ RES_CODE_FAIL = 1;
+ RES_CODE_NOT_EXIST = 2;
+ RES_CODE_EXCESS = 3;
+}
+
+enum ScanMethod {
+ UNKNOWN_SCAN_TYPE = 0;
+ ALL = 1;
+ PREFIX = 2;
+ RANGE = 3;
+}
+
+enum ScanOrderType{
+ // 批量接口下,返回顺序的要求
+ ORDER_NONE = 0; // 允许无序
+ ORDER_WITHIN_VERTEX = 1; // 一个点内的边不会被打断,单不同点之间为无序
+ ORDER_STRICT = 2; // 保证原始的输入点顺序
+}
+
+enum OpType {
+ OP_TYPE_UNKNOWN = 0;
+ OP_TYPE_PUT = 1;
+ OP_TYPE_DEL = 2;
+ OP_TYPE_DEL_SINGLE = 3;
+ OP_TYPE_DEL_PREFIX = 4;
+ OP_TYPE_DEL_RANGE = 5;
+ OP_TYPE_MERGE = 6;
+}
+
+enum TableMethod{
+ TABLE_METHOD_UNKNOWN = 0;
+ TABLE_METHOD_EXISTS = 1;
+ TABLE_METHOD_CREATE = 2;
+ TABLE_METHOD_DELETE = 3;
+ TABLE_METHOD_DROP = 4;
+ TABLE_METHOD_TRUNCATE = 5;
+}
+
+enum GraphMethod{
+ GRAPH_METHOD_UNKNOWN = 0;
+ GRAPH_METHOD_DELETE = 3;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/store_session.proto b/hugegraph-store/hg-store-grpc/src/main/proto/store_session.proto
new file mode 100644
index 000000000..b659645a6
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/store_session.proto
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "org.apache.hugegraph.store.grpc.session";
+option java_outer_classname = "HgStoreSessionProto";
+
+import "store_common.proto";
+import "store_stream_meta.proto";
+
+service HgStoreSession {
+ rpc Get2(GetReq) returns (FeedbackRes) {}
+ rpc BatchGet2(BatchGetReq) returns (FeedbackRes) {}
+ rpc Batch(BatchReq) returns (FeedbackRes){}
+ rpc Table(TableReq) returns (FeedbackRes){};
+ rpc Graph(GraphReq) returns (FeedbackRes){};
+ rpc Clean(CleanReq) returns (FeedbackRes) {}
+ rpc Count(ScanStreamReq) returns (Agg) {}
+}
+
+message TableReq{
+ Header header = 1;
+ TableMethod method = 2;
+ string table_name = 3;
+}
+
+message GraphReq{
+ Header header = 1;
+ GraphMethod method = 2;
+ string graph_name = 3;
+}
+
+message BatchReq{
+ Header header = 1;
+ string batch_id = 2;
+ oneof requests{
+ BatchWriteReq write_req = 10;
+ BatchCommitReq commit_req = 11;
+ BatchRollbackReq rollback_req = 12;
+ }
+}
+
+message BatchWriteReq{
+ repeated BatchEntry entry = 1;
+}
+
+message BatchCommitReq{}
+
+message BatchRollbackReq{}
+
+message BatchEntry{
+ OpType op_type = 1;
+ int32 table = 2;
+ Key start_key = 3;
+ Key end_key = 4;
+ bytes value = 5;
+}
+
+message BatchGetReq {
+ Header header = 1;
+ string table = 2;
+ repeated Key key = 3;
+ int32 partition = 9;
+}
+
+message GetReq {
+ Header header = 1;
+ Tk tk = 2;
+}
+
+message CleanReq{
+ Header header = 1;
+ int32 partition = 2;
+}
+
+
+message FeedbackRes {
+ ResStatus status = 1;
+
+ oneof responses{
+ PartitionFaultResponse partition_fault_response = 10;
+ ValueResponse value_response = 11;
+ KeyValueResponse key_value_response = 12;
+ }
+
+}
+
+message ValueResponse {
+ bytes value = 1;
+}
+
+message KeyValueResponse {
+ repeated Kv kv = 1;
+}
+
+message PartitionFaultResponse{
+ PartitionFaultType fault_type = 1;
+ repeated PartitionLeader partition_leaders = 2;
+ repeated int32 partition_ids = 3;
+}
+
+message PartitionLeader {
+ int32 partitionId = 2;
+ int64 leaderId = 3;
+}
+
+enum PartitionFaultType{
+ PARTITION_FAULT_TYPE_UNKNOWN = 0;
+ // 当前不是Leader,返回Leader所在store
+ PARTITION_FAULT_TYPE_NOT_LEADER = 1;
+ // 等待Leader超时,可能raft group创建失败
+ PARTITION_FAULT_TYPE_WAIT_LEADER_TIMEOUT = 2;
+ // 分区不属于本机
+ PARTITION_FAULT_TYPE_NOT_LOCAL = 3;
+
+}
+message Agg {
+ Header header = 1;
+ int64 count = 2;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/store_state.proto b/hugegraph-store/hg-store-grpc/src/main/proto/store_state.proto
new file mode 100644
index 000000000..d2b0aa361
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/store_state.proto
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+import "google/protobuf/empty.proto";
+import "store_common.proto";
+
+option java_multiple_files = true;
+option java_package = "org.apache.hugegraph.store.grpc.state";
+option java_outer_classname = "HgStoreStateProto";
+
+service HgStoreState {
+
+ // Subscribe Store Node state publishing.
+ rpc SubState(SubStateReq) returns (stream NodeStateRes) {}
+
+ // Unsubscribe Store Node state publishing.
+ rpc UnsubState(SubStateReq) returns (google.protobuf.Empty){}
+ rpc getScanState(SubStateReq) returns (ScanState){}
+
+}
+
+message SubStateReq{
+ string subId = 1;
+}
+
+message NodeStateRes {
+ NodeStateType state = 1;
+}
+
+message ScanState{
+ string address = 1;
+ uint64 taskCount = 2;
+ uint64 completedTaskCount = 3;
+ uint32 activeCount = 4;
+ uint32 largestPoolSize = 5;
+ uint32 poolSize = 6;
+ int32 maximumPoolSize = 7;
+ int32 queueSize = 8;
+ int32 queueRemainingCapacity = 9;
+}
+
+enum NodeStateType {
+ UNKNOWN_STATE_TYPE = 0;
+ STARTING = 10;
+ STANDBY = 20;
+ ONLINE = 30;
+ PAUSE = 40;
+ PENDING = 50;
+ STOPPING = 60;
+ HALTED = 70;
+ ERROR = 90;
+ ZOMBIE = 99;
+}
+
+message QuotaRequest {
+ map limits = 1;
+}
diff --git a/hugegraph-store/hg-store-grpc/src/main/proto/store_stream_meta.proto b/hugegraph-store/hg-store-grpc/src/main/proto/store_stream_meta.proto
new file mode 100644
index 000000000..7c2211cab
--- /dev/null
+++ b/hugegraph-store/hg-store-grpc/src/main/proto/store_stream_meta.proto
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+syntax = "proto3";
+
+import "store_common.proto";
+
+option java_multiple_files = true;
+option java_package = "org.apache.hugegraph.store.grpc.stream";
+option java_outer_classname = "HgStoreStreamMetaProto";
+
+
+message ScanStreamBatchReq {
+ Header header = 1;
+ oneof query {
+ ScanQueryRequest query_request = 10;
+ ScanPagingRequest paging_request = 11;
+ ScanPauseRequest pause_request = 12;
+ ScanCancelRequest cancel_request = 13;
+ ScanReceiptRequest receipt_request = 14;
+ }
+ int64 logId = 15;
+}
+
+message ScanQueryRequest {
+ ScanMethod method = 2;
+ string table = 3;
+ int64 limit = 4;
+ int64 pageSize = 5;
+ int32 scanType = 6;
+ bytes query = 7;
+ bytes position = 8;
+ repeated ScanCondition condition = 9;
+ int64 perKeyLimit = 10;
+ int64 skipDegree = 11;
+ ScanOrderType orderType = 12;
+ int64 perKeyMax = 13;
+}
+
+message ScanPagingRequest {
+ int64 pageSize = 1;
+}
+message ScanPauseRequest {}
+message ScanCancelRequest {}
+message ScanReceiptRequest {
+ uint32 times = 1;
+}
+
+message ScanCondition {
+ int32 code = 1; // owner key hashcode
+ bytes prefix = 2; // key prefix
+ bytes start = 3; // start key
+ bytes end = 4; // end key
+ int32 serialNo = 5; // serial no
+}
+
+message ScanStreamReq {
+ Header header = 1;
+ ScanMethod method = 2;
+ string table = 3;
+ int32 code = 4; // partitionId
+ bytes prefix = 5; // key prefix
+ bytes start = 6; //start key
+ bytes end = 7; //end key
+ int64 limit = 8;
+ int32 scanType = 9;
+ bytes query = 10;
+ int32 pageSize = 11;
+ bytes position = 12;
+ uint32 closeFlag = 13;
+ SelectParam selects = 14;
+}
+
+message SelectParam {
+ bytes filter = 1;
+ bool withNoProperties = 2;
+ repeated int32 properties = 3;
+}
+
+message KvPageRes {
+ int32 times = 1; //query times.
+ bool over = 2; //true=no more data
+ repeated Kv data = 3;
+ uint32 version = 4;
+ bytes stream = 5;
+}
+
+enum KvStreamType {
+ STREAM_TYPE_NONE = 0;
+ STREAM_TYPE_KV = 1;
+ STREAM_TYPE_K = 2;
+ STREAM_TYPE_SKV = 3;
+ STREAM_TYPE_SK = 4;
+}