From f2c14d9bd6867406aa32d79a4a56a8f8d7630ebd Mon Sep 17 00:00:00 2001 From: huangsimin <474420502@qq.com> Date: Fri, 5 Aug 2022 17:56:22 +0800 Subject: [PATCH] proto --- .../dataflow/controller/MasterProcessor.java | 166 +- .../dataflow/controller/PacketsProcessor.java | 95 +- .../yuandian/dataflow/proto/Processor.java | 1946 +++++++++++++++++ .../dataflow/proto/ProcessorServerGrpc.java | 288 +++ 4 files changed, 2373 insertions(+), 122 deletions(-) create mode 100644 src/main/java/com/yuandian/dataflow/proto/Processor.java create mode 100644 src/main/java/com/yuandian/dataflow/proto/ProcessorServerGrpc.java diff --git a/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java b/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java index ccdbaf9..110ca05 100644 --- a/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java +++ b/src/main/java/com/yuandian/dataflow/controller/MasterProcessor.java @@ -14,7 +14,7 @@ import com.alipay.sofa.jraft.entity.PeerId; import com.alipay.sofa.jraft.error.RemotingException; import com.alipay.sofa.jraft.rpc.InvokeCallback; import com.google.protobuf.Any; -import com.yuandian.dataflow.controller.PacketsProcessor.PacketsRequest; +// import com.yuandian.dataflow.controller.PacketsProcessor.PacketsRequest; import com.yuandian.dataflow.proto.msgtype.BacktrackingFlowOuterClass; import com.yuandian.dataflow.statemachine_old.StateFactory; import com.yuandian.dataflow.statemachine_old.annotations.MasterRegister; @@ -32,104 +32,108 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @MasterRegister -public class MasterProcessor implements MasterExecute { +public class MasterProcessor implements MasterExecute {@Override + public void loop(MasterContext cxt) { + // TODO Auto-generated method stub + + } - /** - * 最大任务数限制 - */ - private final int MAX_TASKS = 1000; - private final int DEFAULT_ASYNC_TIMEOUT = 5000; + // /** + // * 最大任务数限制 + // */ + // private final int MAX_TASKS = 1000; + // private final int DEFAULT_ASYNC_TIMEOUT = 5000; - @Override - public void loop(MasterContext cxt) { + // @Override + // public void loop(MasterContext cxt) { - // ArrayList packets = new ArrayList<>(); - // 模拟发送包的数据到该节点上 + // // ArrayList packets = new ArrayList<>(); + // // 模拟发送包的数据到该节点上 - for (int i = 0; i < ThreadLocalRandom.current().nextLong(50, 100); i++) { - var p = Any.pack(BacktrackingFlowOuterClass.BacktrackingFlow - .newBuilder() - .setTableId(10086) - .build()); - Operate.packetsManager.addPacket(p); - // packets.add(p); - } + // for (int i = 0; i < ThreadLocalRandom.current().nextLong(50, 100); i++) { + // var p = Any.pack(BacktrackingFlowOuterClass.BacktrackingFlow + // .newBuilder() + // .setTableId(10086) + // .build()); + // Operate.packetsManager.addPacket(p); + // // packets.add(p); + // } - // 必须复制. raft有一直使用该list - var alivePeers = List.copyOf(StateFactory.getRaftNode().listAlivePeers()); + // // 必须复制. raft有一直使用该list + // var alivePeers = List.copyOf(StateFactory.getRaftNode().listAlivePeers()); - if ( Operate.packetsManager.size() >= 100000) { - log.error("告警 数据流无法正常消耗: 缓冲packets:{} 直接放弃一部分数据", Operate.packetsManager.size()); - Operate.packetsManager.discardPackets(50000); - log.debug("master({}) execute {} packets: {}", StateFactory.getServerId(), alivePeers, - Operate.packetsManager.size()); - cxt.sleep(5000); - } else { - // log.debug("master({}) execute {} packets: {}", StateFactory.getServerId(), - // alivePeers, Operate.packetsManager.size()); - } + // if ( Operate.packetsManager.size() >= 100000) { + // log.error("告警 数据流无法正常消耗: 缓冲packets:{} 直接放弃一部分数据", Operate.packetsManager.size()); + // Operate.packetsManager.discardPackets(50000); + // log.debug("master({}) execute {} packets: {}", StateFactory.getServerId(), alivePeers, + // Operate.packetsManager.size()); + // cxt.sleep(5000); + // } else { + // // log.debug("master({}) execute {} packets: {}", StateFactory.getServerId(), + // // alivePeers, Operate.packetsManager.size()); + // } - if (alivePeers == null) { - cxt.sleep(100); // 休眠100毫秒. - return; - } + // if (alivePeers == null) { + // cxt.sleep(100); // 休眠100毫秒. + // return; + // } - PeerId[] peers = new PeerId[alivePeers.size()]; - alivePeers.toArray(peers); - // 等待全部反馈后才能进入下次循环 + // PeerId[] peers = new PeerId[alivePeers.size()]; + // alivePeers.toArray(peers); + // // 等待全部反馈后才能进入下次循环 - Operate.CallOperate(new Operate(OperateType.ALLOCATE_PACKETS, alivePeers), new GenericClosure() { + // Operate.CallOperate(new Operate(OperateType.ALLOCATE_PACKETS, alivePeers), new GenericClosure() { - @Override - public void run(Status status) { - int[] allocTasks = this.getValue(); + // @Override + // public void run(Status status) { + // int[] allocTasks = this.getValue(); - if(allocTasks == null) { - cxt.sleep(5000);; - return; - } + // if(allocTasks == null) { + // cxt.sleep(5000);; + // return; + // } - var all = 0; - for(var i : allocTasks) { - all += i; - } - if(all != 0) { - log.info("需要处理的任务数量[{}] :{}", StateFactory.getLeaderId(), allocTasks); - } - for (int i = 0; i < peers.length; i++) { + // var all = 0; + // for(var i : allocTasks) { + // all += i; + // } + // if(all != 0) { + // log.info("需要处理的任务数量[{}] :{}", StateFactory.getLeaderId(), allocTasks); + // } + // for (int i = 0; i < peers.length; i++) { - var peer = peers[i]; - if (allocTasks[i] <= 0) { - continue; - } - var packets = Operate.packetsManager.popPackets(allocTasks[i]); - // 先提交 节点的 剩余能处理的任务数量. 然后再处理 - var request = new PacketsRequest(); // 数据包切片 - request.setPackets(packets); + // var peer = peers[i]; + // if (allocTasks[i] <= 0) { + // continue; + // } + // var packets = Operate.packetsManager.popPackets(allocTasks[i]); + // // 先提交 节点的 剩余能处理的任务数量. 然后再处理 + // var request = new PacketsRequest(); // 数据包切片 + // request.setPackets(packets); - try { - StateFactory.rpcClientInvokeAsync(peer.getEndpoint(), request, - new InvokeCallback() { - @Override - public void complete(Object result, Throwable err) { + // try { + // StateFactory.rpcClientInvokeAsync(peer.getEndpoint(), request, + // new InvokeCallback() { + // @Override + // public void complete(Object result, Throwable err) { - if (err != null) { - // TODO: 如果错误, 需要让节点恢复任务处理的状态 - log.debug("{}", err); - } - // log.debug("PacketsRequest: {}", result); - } - }, DEFAULT_ASYNC_TIMEOUT); - } catch (InterruptedException | RemotingException e) { - log.info("error send packets {}", e.toString()); - } - } - } - }); + // if (err != null) { + // // TODO: 如果错误, 需要让节点恢复任务处理的状态 + // log.debug("{}", err); + // } + // // log.debug("PacketsRequest: {}", result); + // } + // }, DEFAULT_ASYNC_TIMEOUT); + // } catch (InterruptedException | RemotingException e) { + // log.info("error send packets {}", e.toString()); + // } + // } + // } + // }); - } + // } } diff --git a/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java b/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java index 638101b..48bc43e 100644 --- a/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java +++ b/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java @@ -17,6 +17,9 @@ import com.alipay.sofa.jraft.Status; import com.alipay.sofa.jraft.rpc.RpcContext; import com.alipay.sofa.jraft.rpc.RpcProcessor; import com.google.protobuf.Any; +import com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest; +import com.yuandian.dataflow.proto.Processor.ProcessResponse; +import com.yuandian.dataflow.proto.ProcessorServerGrpc.ProcessorServerImplBase; import com.yuandian.dataflow.statemachine_old.StateFactory; import com.yuandian.dataflow.statemachine_old.annotations.WorkerRegister; import com.yuandian.dataflow.statemachine_old.closure.GenericClosure; @@ -25,6 +28,7 @@ import com.yuandian.dataflow.statemachine_old.operate.Operate.OperateType; import com.yuandian.dataflow.statemachine_old.rpc.RaftResponse; import com.yuandian.dataflow.statemachine_old.state.State; +import io.grpc.stub.StreamObserver; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -38,62 +42,71 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @WorkerRegister -public class PacketsProcessor implements RpcProcessor { +public class PacketsProcessor extends ProcessorServerImplBase {@Override + public void getPackets(PacketsProcessorRequest request, StreamObserver responseObserver) { + // TODO Auto-generated method stub - @Setter - @Getter - public static class PacketsRequest implements Serializable { - private ArrayList packets = new ArrayList<>(); + request.getPacketsList(); + + super.getPackets(request, responseObserver); } + + + // @Setter + // @Getter + // public static class PacketsRequest implements Serializable { + // private ArrayList packets = new ArrayList<>(); + // } + - @Override - public void handleRequest(RpcContext rpcCtx, PacketsRequest request) { - log.debug("{} handler request.packets.size(): {}", StateFactory.getServerId(), request.packets.size()); + // @Override + // public void handleRequest(RpcContext rpcCtx, PacketsRequest request) { + // log.debug("{} handler request.packets.size(): {}", StateFactory.getServerId(), request.packets.size()); - var now = Instant.now(); - var resp = new RaftResponse(); - resp.setSuccess(true); - rpcCtx.sendResponse(resp); // 因为jraft是异步. 收到数据直接返回 + // var now = Instant.now(); + // var resp = new RaftResponse(); + // resp.setSuccess(true); + // rpcCtx.sendResponse(resp); // 因为jraft是异步. 收到数据直接返回 - try { - // log.info("response {} ms", Duration.between(now, Instant.now()).toMillis()); // 返回response的时间 + // try { + // // log.info("response {} ms", Duration.between(now, Instant.now()).toMillis()); // 返回response的时间 - // TODO: request.packets 入库,回填, 告警 等操作 + // // TODO: request.packets 入库,回填, 告警 等操作 - Thread.sleep(ThreadLocalRandom.current().nextLong(10, 100)); + // Thread.sleep(ThreadLocalRandom.current().nextLong(10, 100)); - } catch (InterruptedException e) { - log.info(e.toString()); - } finally { // 确保 更新 最终的任务状态给master. + // } catch (InterruptedException e) { + // log.info(e.toString()); + // } finally { // 确保 更新 最终的任务状态给master. - // 读状态 Closure 里的 getValue为 State的状态 - var state = StateFactory.getStateServer().getFsm().getState() ; // 获取返回的状态 + // // 读状态 Closure 里的 getValue为 State的状态 + // var state = StateFactory.getStateServer().getFsm().getState() ; // 获取返回的状态 - var ws = state.getWorkers().get(StateFactory.getServerId()); - ws.setTaskQueueSize(ws.getTaskQueueSize() - request.packets.size()); // 减少 现有的任务数量 - ws.setUpdateAt(Instant.now()); // 设置更新时间 + // var ws = state.getWorkers().get(StateFactory.getServerId()); + // ws.setTaskQueueSize(ws.getTaskQueueSize() - request.packets.size()); // 减少 现有的任务数量 + // ws.setUpdateAt(Instant.now()); // 设置更新时间 - Operate.CallOperate(new Operate(OperateType.PUT_WORKERSTATE, ws), - new GenericClosure() { - @Override - public void run(Status status) { - // 处理完数据 更新工作状态的时间 - log.info("update workerstate {} ms", Duration.between(now, Instant.now()).toMillis()); - if (!status.isOk()) { - log.error("CallOperate [{}] {}", StateFactory.getServerId(), resp); + // Operate.CallOperate(new Operate(OperateType.PUT_WORKERSTATE, ws), + // new GenericClosure() { + // @Override + // public void run(Status status) { + // // 处理完数据 更新工作状态的时间 + // log.info("update workerstate {} ms", Duration.between(now, Instant.now()).toMillis()); + // if (!status.isOk()) { + // log.error("CallOperate [{}] {}", StateFactory.getServerId(), resp); - } - } - }); + // } + // } + // }); - } ; - } + // } ; + // } - @Override - public String interest() { - return PacketsRequest.class.getName(); - } + // @Override + // public String interest() { + // return PacketsRequest.class.getName(); + // } } diff --git a/src/main/java/com/yuandian/dataflow/proto/Processor.java b/src/main/java/com/yuandian/dataflow/proto/Processor.java new file mode 100644 index 0000000..42465a0 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/proto/Processor.java @@ -0,0 +1,1946 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Processor.proto + +package com.yuandian.dataflow.proto; + +public final class Processor { + private Processor() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface ProcessResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:dataflow.ProcessResponse) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 返回的状态码
+     * 
+ * + * int32 code = 1; + * @return The code. + */ + int getCode(); + + /** + *
+     * 消息
+     * 
+ * + * string message = 2; + * @return The message. + */ + java.lang.String getMessage(); + /** + *
+     * 消息
+     * 
+ * + * string message = 2; + * @return The bytes for message. + */ + com.google.protobuf.ByteString + getMessageBytes(); + } + /** + * Protobuf type {@code dataflow.ProcessResponse} + */ + public static final class ProcessResponse extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:dataflow.ProcessResponse) + ProcessResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProcessResponse.newBuilder() to construct. + private ProcessResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private ProcessResponse() { + message_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new ProcessResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private ProcessResponse( + 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: { + + code_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + message_ = s; + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_ProcessResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_ProcessResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.proto.Processor.ProcessResponse.class, com.yuandian.dataflow.proto.Processor.ProcessResponse.Builder.class); + } + + public static final int CODE_FIELD_NUMBER = 1; + private int code_; + /** + *
+     * 返回的状态码
+     * 
+ * + * int32 code = 1; + * @return The code. + */ + @java.lang.Override + public int getCode() { + return code_; + } + + public static final int MESSAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object message_; + /** + *
+     * 消息
+     * 
+ * + * string message = 2; + * @return The message. + */ + @java.lang.Override + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } + } + /** + *
+     * 消息
+     * 
+ * + * string message = 2; + * @return The bytes for message. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final 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 (code_ != 0) { + output.writeInt32(1, code_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (code_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, code_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); + } + 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 com.yuandian.dataflow.proto.Processor.ProcessResponse)) { + return super.equals(obj); + } + com.yuandian.dataflow.proto.Processor.ProcessResponse other = (com.yuandian.dataflow.proto.Processor.ProcessResponse) obj; + + if (getCode() + != other.getCode()) return false; + if (!getMessage() + .equals(other.getMessage())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + CODE_FIELD_NUMBER; + hash = (53 * hash) + getCode(); + hash = (37 * hash) + MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getMessage().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse 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.yuandian.dataflow.proto.Processor.ProcessResponse parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse 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.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.ProcessResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.yuandian.dataflow.proto.Processor.ProcessResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @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; + } + /** + * Protobuf type {@code dataflow.ProcessResponse} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:dataflow.ProcessResponse) + com.yuandian.dataflow.proto.Processor.ProcessResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_ProcessResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_ProcessResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.proto.Processor.ProcessResponse.class, com.yuandian.dataflow.proto.Processor.ProcessResponse.Builder.class); + } + + // Construct using com.yuandian.dataflow.proto.Processor.ProcessResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + code_ = 0; + + message_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_ProcessResponse_descriptor; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.ProcessResponse getDefaultInstanceForType() { + return com.yuandian.dataflow.proto.Processor.ProcessResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.ProcessResponse build() { + com.yuandian.dataflow.proto.Processor.ProcessResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.ProcessResponse buildPartial() { + com.yuandian.dataflow.proto.Processor.ProcessResponse result = new com.yuandian.dataflow.proto.Processor.ProcessResponse(this); + result.code_ = code_; + result.message_ = message_; + onBuilt(); + 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 com.yuandian.dataflow.proto.Processor.ProcessResponse) { + return mergeFrom((com.yuandian.dataflow.proto.Processor.ProcessResponse)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.yuandian.dataflow.proto.Processor.ProcessResponse other) { + if (other == com.yuandian.dataflow.proto.Processor.ProcessResponse.getDefaultInstance()) return this; + if (other.getCode() != 0) { + setCode(other.getCode()); + } + if (!other.getMessage().isEmpty()) { + message_ = other.message_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.yuandian.dataflow.proto.Processor.ProcessResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.yuandian.dataflow.proto.Processor.ProcessResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int code_ ; + /** + *
+       * 返回的状态码
+       * 
+ * + * int32 code = 1; + * @return The code. + */ + @java.lang.Override + public int getCode() { + return code_; + } + /** + *
+       * 返回的状态码
+       * 
+ * + * int32 code = 1; + * @param value The code to set. + * @return This builder for chaining. + */ + public Builder setCode(int value) { + + code_ = value; + onChanged(); + return this; + } + /** + *
+       * 返回的状态码
+       * 
+ * + * int32 code = 1; + * @return This builder for chaining. + */ + public Builder clearCode() { + + code_ = 0; + onChanged(); + return this; + } + + private java.lang.Object message_ = ""; + /** + *
+       * 消息
+       * 
+ * + * string message = 2; + * @return The message. + */ + public java.lang.String getMessage() { + java.lang.Object ref = message_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + message_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * 消息
+       * 
+ * + * string message = 2; + * @return The bytes for message. + */ + public com.google.protobuf.ByteString + getMessageBytes() { + java.lang.Object ref = message_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + message_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * 消息
+       * 
+ * + * string message = 2; + * @param value The message to set. + * @return This builder for chaining. + */ + public Builder setMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + message_ = value; + onChanged(); + return this; + } + /** + *
+       * 消息
+       * 
+ * + * string message = 2; + * @return This builder for chaining. + */ + public Builder clearMessage() { + + message_ = getDefaultInstance().getMessage(); + onChanged(); + return this; + } + /** + *
+       * 消息
+       * 
+ * + * string message = 2; + * @param value The bytes for message to set. + * @return This builder for chaining. + */ + public Builder setMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + message_ = value; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:dataflow.ProcessResponse) + } + + // @@protoc_insertion_point(class_scope:dataflow.ProcessResponse) + private static final com.yuandian.dataflow.proto.Processor.ProcessResponse DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.yuandian.dataflow.proto.Processor.ProcessResponse(); + } + + public static com.yuandian.dataflow.proto.Processor.ProcessResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProcessResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProcessResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.ProcessResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface PacketsProcessorRequestOrBuilder extends + // @@protoc_insertion_point(interface_extends:dataflow.PacketsProcessorRequest) + com.google.protobuf.MessageOrBuilder { + + /** + *
+     * 请求类型.  默认 为 1.  暂无意义
+     * 
+ * + * int32 type = 1; + * @return The type. + */ + int getType(); + + /** + *
+     * 请求版本.  区分版本. 非必要时不使用 
+     * 
+ * + * string version = 2; + * @return The version. + */ + java.lang.String getVersion(); + /** + *
+     * 请求版本.  区分版本. 非必要时不使用 
+     * 
+ * + * string version = 2; + * @return The bytes for version. + */ + com.google.protobuf.ByteString + getVersionBytes(); + + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + java.util.List + getPacketsList(); + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + com.google.protobuf.Any getPackets(int index); + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + int getPacketsCount(); + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + java.util.List + getPacketsOrBuilderList(); + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + com.google.protobuf.AnyOrBuilder getPacketsOrBuilder( + int index); + } + /** + * Protobuf type {@code dataflow.PacketsProcessorRequest} + */ + public static final class PacketsProcessorRequest extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:dataflow.PacketsProcessorRequest) + PacketsProcessorRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use PacketsProcessorRequest.newBuilder() to construct. + private PacketsProcessorRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private PacketsProcessorRequest() { + version_ = ""; + packets_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new PacketsProcessorRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private PacketsProcessorRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + + type_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + version_ = s; + break; + } + case 26: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + packets_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + packets_.add( + input.readMessage(com.google.protobuf.Any.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + packets_ = java.util.Collections.unmodifiableList(packets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_PacketsProcessorRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_PacketsProcessorRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.class, com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.Builder.class); + } + + public static final int TYPE_FIELD_NUMBER = 1; + private int type_; + /** + *
+     * 请求类型.  默认 为 1.  暂无意义
+     * 
+ * + * int32 type = 1; + * @return The type. + */ + @java.lang.Override + public int getType() { + return type_; + } + + public static final int VERSION_FIELD_NUMBER = 2; + private volatile java.lang.Object version_; + /** + *
+     * 请求版本.  区分版本. 非必要时不使用 
+     * 
+ * + * string version = 2; + * @return The version. + */ + @java.lang.Override + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } + } + /** + *
+     * 请求版本.  区分版本. 非必要时不使用 
+     * 
+ * + * string version = 2; + * @return The bytes for version. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PACKETS_FIELD_NUMBER = 3; + private java.util.List packets_; + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + @java.lang.Override + public java.util.List getPacketsList() { + return packets_; + } + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + @java.lang.Override + public java.util.List + getPacketsOrBuilderList() { + return packets_; + } + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + @java.lang.Override + public int getPacketsCount() { + return packets_.size(); + } + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + @java.lang.Override + public com.google.protobuf.Any getPackets(int index) { + return packets_.get(index); + } + /** + *
+     * 请求的可变参数. 暂不使用
+     * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + @java.lang.Override + public com.google.protobuf.AnyOrBuilder getPacketsOrBuilder( + int index) { + return packets_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final 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 (type_ != 0) { + output.writeInt32(1, type_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(version_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, version_); + } + for (int i = 0; i < packets_.size(); i++) { + output.writeMessage(3, packets_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (type_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, type_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(version_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, version_); + } + for (int i = 0; i < packets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, packets_.get(i)); + } + 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 com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest)) { + return super.equals(obj); + } + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest other = (com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest) obj; + + if (getType() + != other.getType()) return false; + if (!getVersion() + .equals(other.getVersion())) return false; + if (!getPacketsList() + .equals(other.getPacketsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + getType(); + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion().hashCode(); + if (getPacketsCount() > 0) { + hash = (37 * hash) + PACKETS_FIELD_NUMBER; + hash = (53 * hash) + getPacketsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest 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.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest 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.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @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; + } + /** + * Protobuf type {@code dataflow.PacketsProcessorRequest} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:dataflow.PacketsProcessorRequest) + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_PacketsProcessorRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_PacketsProcessorRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.class, com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.Builder.class); + } + + // Construct using com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getPacketsFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + type_ = 0; + + version_ = ""; + + if (packetsBuilder_ == null) { + packets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + packetsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.yuandian.dataflow.proto.Processor.internal_static_dataflow_PacketsProcessorRequest_descriptor; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest getDefaultInstanceForType() { + return com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest build() { + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest buildPartial() { + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest result = new com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest(this); + int from_bitField0_ = bitField0_; + result.type_ = type_; + result.version_ = version_; + if (packetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + packets_ = java.util.Collections.unmodifiableList(packets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.packets_ = packets_; + } else { + result.packets_ = packetsBuilder_.build(); + } + onBuilt(); + 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 com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest) { + return mergeFrom((com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest other) { + if (other == com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.getDefaultInstance()) return this; + if (other.getType() != 0) { + setType(other.getType()); + } + if (!other.getVersion().isEmpty()) { + version_ = other.version_; + onChanged(); + } + if (packetsBuilder_ == null) { + if (!other.packets_.isEmpty()) { + if (packets_.isEmpty()) { + packets_ = other.packets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensurePacketsIsMutable(); + packets_.addAll(other.packets_); + } + onChanged(); + } + } else { + if (!other.packets_.isEmpty()) { + if (packetsBuilder_.isEmpty()) { + packetsBuilder_.dispose(); + packetsBuilder_ = null; + packets_ = other.packets_; + bitField0_ = (bitField0_ & ~0x00000001); + packetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getPacketsFieldBuilder() : null; + } else { + packetsBuilder_.addAllMessages(other.packets_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private int type_ ; + /** + *
+       * 请求类型.  默认 为 1.  暂无意义
+       * 
+ * + * int32 type = 1; + * @return The type. + */ + @java.lang.Override + public int getType() { + return type_; + } + /** + *
+       * 请求类型.  默认 为 1.  暂无意义
+       * 
+ * + * int32 type = 1; + * @param value The type to set. + * @return This builder for chaining. + */ + public Builder setType(int value) { + + type_ = value; + onChanged(); + return this; + } + /** + *
+       * 请求类型.  默认 为 1.  暂无意义
+       * 
+ * + * int32 type = 1; + * @return This builder for chaining. + */ + public Builder clearType() { + + type_ = 0; + onChanged(); + return this; + } + + private java.lang.Object version_ = ""; + /** + *
+       * 请求版本.  区分版本. 非必要时不使用 
+       * 
+ * + * string version = 2; + * @return The version. + */ + public java.lang.String getVersion() { + java.lang.Object ref = version_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + version_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + *
+       * 请求版本.  区分版本. 非必要时不使用 
+       * 
+ * + * string version = 2; + * @return The bytes for version. + */ + public com.google.protobuf.ByteString + getVersionBytes() { + java.lang.Object ref = version_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + version_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + *
+       * 请求版本.  区分版本. 非必要时不使用 
+       * 
+ * + * string version = 2; + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + version_ = value; + onChanged(); + return this; + } + /** + *
+       * 请求版本.  区分版本. 非必要时不使用 
+       * 
+ * + * string version = 2; + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = getDefaultInstance().getVersion(); + onChanged(); + return this; + } + /** + *
+       * 请求版本.  区分版本. 非必要时不使用 
+       * 
+ * + * string version = 2; + * @param value The bytes for version to set. + * @return This builder for chaining. + */ + public Builder setVersionBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + version_ = value; + onChanged(); + return this; + } + + private java.util.List packets_ = + java.util.Collections.emptyList(); + private void ensurePacketsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + packets_ = new java.util.ArrayList(packets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> packetsBuilder_; + + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public java.util.List getPacketsList() { + if (packetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(packets_); + } else { + return packetsBuilder_.getMessageList(); + } + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public int getPacketsCount() { + if (packetsBuilder_ == null) { + return packets_.size(); + } else { + return packetsBuilder_.getCount(); + } + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public com.google.protobuf.Any getPackets(int index) { + if (packetsBuilder_ == null) { + return packets_.get(index); + } else { + return packetsBuilder_.getMessage(index); + } + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder setPackets( + int index, com.google.protobuf.Any value) { + if (packetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePacketsIsMutable(); + packets_.set(index, value); + onChanged(); + } else { + packetsBuilder_.setMessage(index, value); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder setPackets( + int index, com.google.protobuf.Any.Builder builderForValue) { + if (packetsBuilder_ == null) { + ensurePacketsIsMutable(); + packets_.set(index, builderForValue.build()); + onChanged(); + } else { + packetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder addPackets(com.google.protobuf.Any value) { + if (packetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePacketsIsMutable(); + packets_.add(value); + onChanged(); + } else { + packetsBuilder_.addMessage(value); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder addPackets( + int index, com.google.protobuf.Any value) { + if (packetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePacketsIsMutable(); + packets_.add(index, value); + onChanged(); + } else { + packetsBuilder_.addMessage(index, value); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder addPackets( + com.google.protobuf.Any.Builder builderForValue) { + if (packetsBuilder_ == null) { + ensurePacketsIsMutable(); + packets_.add(builderForValue.build()); + onChanged(); + } else { + packetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder addPackets( + int index, com.google.protobuf.Any.Builder builderForValue) { + if (packetsBuilder_ == null) { + ensurePacketsIsMutable(); + packets_.add(index, builderForValue.build()); + onChanged(); + } else { + packetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder addAllPackets( + java.lang.Iterable values) { + if (packetsBuilder_ == null) { + ensurePacketsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, packets_); + onChanged(); + } else { + packetsBuilder_.addAllMessages(values); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder clearPackets() { + if (packetsBuilder_ == null) { + packets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + packetsBuilder_.clear(); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public Builder removePackets(int index) { + if (packetsBuilder_ == null) { + ensurePacketsIsMutable(); + packets_.remove(index); + onChanged(); + } else { + packetsBuilder_.remove(index); + } + return this; + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public com.google.protobuf.Any.Builder getPacketsBuilder( + int index) { + return getPacketsFieldBuilder().getBuilder(index); + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public com.google.protobuf.AnyOrBuilder getPacketsOrBuilder( + int index) { + if (packetsBuilder_ == null) { + return packets_.get(index); } else { + return packetsBuilder_.getMessageOrBuilder(index); + } + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public java.util.List + getPacketsOrBuilderList() { + if (packetsBuilder_ != null) { + return packetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(packets_); + } + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public com.google.protobuf.Any.Builder addPacketsBuilder() { + return getPacketsFieldBuilder().addBuilder( + com.google.protobuf.Any.getDefaultInstance()); + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public com.google.protobuf.Any.Builder addPacketsBuilder( + int index) { + return getPacketsFieldBuilder().addBuilder( + index, com.google.protobuf.Any.getDefaultInstance()); + } + /** + *
+       * 请求的可变参数. 暂不使用
+       * 
+ * + * repeated .google.protobuf.Any packets = 3; + */ + public java.util.List + getPacketsBuilderList() { + return getPacketsFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder> + getPacketsFieldBuilder() { + if (packetsBuilder_ == null) { + packetsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.protobuf.Any, com.google.protobuf.Any.Builder, com.google.protobuf.AnyOrBuilder>( + packets_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + packets_ = null; + } + return packetsBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:dataflow.PacketsProcessorRequest) + } + + // @@protoc_insertion_point(class_scope:dataflow.PacketsProcessorRequest) + private static final com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest(); + } + + public static com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PacketsProcessorRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PacketsProcessorRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_dataflow_ProcessResponse_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_dataflow_ProcessResponse_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_dataflow_PacketsProcessorRequest_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_dataflow_PacketsProcessorRequest_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\017Processor.proto\022\010dataflow\032\031google/prot" + + "obuf/any.proto\"0\n\017ProcessResponse\022\014\n\004cod" + + "e\030\001 \001(\005\022\017\n\007message\030\002 \001(\t\"_\n\027PacketsProce" + + "ssorRequest\022\014\n\004type\030\001 \001(\005\022\017\n\007version\030\002 \001" + + "(\t\022%\n\007packets\030\003 \003(\0132\024.google.protobuf.An" + + "y2]\n\017ProcessorServer\022J\n\nGetPackets\022!.dat" + + "aflow.PacketsProcessorRequest\032\031.dataflow" + + ".ProcessResponseB4\n\033com.yuandian.dataflo" + + "w.protoP\000Z\023../grpc-gen;grpcgenb\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.protobuf.AnyProto.getDescriptor(), + }); + internal_static_dataflow_ProcessResponse_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_dataflow_ProcessResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_dataflow_ProcessResponse_descriptor, + new java.lang.String[] { "Code", "Message", }); + internal_static_dataflow_PacketsProcessorRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_dataflow_PacketsProcessorRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_dataflow_PacketsProcessorRequest_descriptor, + new java.lang.String[] { "Type", "Version", "Packets", }); + com.google.protobuf.AnyProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/yuandian/dataflow/proto/ProcessorServerGrpc.java b/src/main/java/com/yuandian/dataflow/proto/ProcessorServerGrpc.java new file mode 100644 index 0000000..40993e1 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/proto/ProcessorServerGrpc.java @@ -0,0 +1,288 @@ +package com.yuandian.dataflow.proto; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ClientCalls.asyncClientStreamingCall; +import static io.grpc.stub.ClientCalls.asyncServerStreamingCall; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingServerStreamingCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall; +import static io.grpc.stub.ServerCalls.asyncClientStreamingCall; +import static io.grpc.stub.ServerCalls.asyncServerStreamingCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.32.3)", + comments = "Source: Processor.proto") +public final class ProcessorServerGrpc { + + private ProcessorServerGrpc() {} + + public static final String SERVICE_NAME = "dataflow.ProcessorServer"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getGetPacketsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetPackets", + requestType = com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.class, + responseType = com.yuandian.dataflow.proto.Processor.ProcessResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetPacketsMethod() { + io.grpc.MethodDescriptor getGetPacketsMethod; + if ((getGetPacketsMethod = ProcessorServerGrpc.getGetPacketsMethod) == null) { + synchronized (ProcessorServerGrpc.class) { + if ((getGetPacketsMethod = ProcessorServerGrpc.getGetPacketsMethod) == null) { + ProcessorServerGrpc.getGetPacketsMethod = getGetPacketsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetPackets")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + com.yuandian.dataflow.proto.Processor.ProcessResponse.getDefaultInstance())) + .setSchemaDescriptor(new ProcessorServerMethodDescriptorSupplier("GetPackets")) + .build(); + } + } + } + return getGetPacketsMethod; + } + + /** + * Creates a new async stub that supports all call types for the service + */ + public static ProcessorServerStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProcessorServerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerStub(channel, callOptions); + } + }; + return ProcessorServerStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ProcessorServerBlockingStub newBlockingStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProcessorServerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerBlockingStub(channel, callOptions); + } + }; + return ProcessorServerBlockingStub.newStub(factory, channel); + } + + /** + * Creates a new ListenableFuture-style stub that supports unary calls on the service + */ + public static ProcessorServerFutureStub newFutureStub( + io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ProcessorServerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerFutureStub(channel, callOptions); + } + }; + return ProcessorServerFutureStub.newStub(factory, channel); + } + + /** + */ + public static abstract class ProcessorServerImplBase implements io.grpc.BindableService { + + /** + */ + public void getPackets(com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetPacketsMethod(), responseObserver); + } + + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetPacketsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest, + com.yuandian.dataflow.proto.Processor.ProcessResponse>( + this, METHODID_GET_PACKETS))) + .build(); + } + } + + /** + */ + public static final class ProcessorServerStub extends io.grpc.stub.AbstractAsyncStub { + private ProcessorServerStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProcessorServerStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerStub(channel, callOptions); + } + + /** + */ + public void getPackets(com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetPacketsMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + */ + public static final class ProcessorServerBlockingStub extends io.grpc.stub.AbstractBlockingStub { + private ProcessorServerBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProcessorServerBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerBlockingStub(channel, callOptions); + } + + /** + */ + public com.yuandian.dataflow.proto.Processor.ProcessResponse getPackets(com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest request) { + return blockingUnaryCall( + getChannel(), getGetPacketsMethod(), getCallOptions(), request); + } + } + + /** + */ + public static final class ProcessorServerFutureStub extends io.grpc.stub.AbstractFutureStub { + private ProcessorServerFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ProcessorServerFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ProcessorServerFutureStub(channel, callOptions); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getPackets( + com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetPacketsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_PACKETS = 0; + + 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 ProcessorServerImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ProcessorServerImplBase 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_GET_PACKETS: + serviceImpl.getPackets((com.yuandian.dataflow.proto.Processor.PacketsProcessorRequest) 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) { + default: + throw new AssertionError(); + } + } + } + + private static abstract class ProcessorServerBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ProcessorServerBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.yuandian.dataflow.proto.Processor.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ProcessorServer"); + } + } + + private static final class ProcessorServerFileDescriptorSupplier + extends ProcessorServerBaseDescriptorSupplier { + ProcessorServerFileDescriptorSupplier() {} + } + + private static final class ProcessorServerMethodDescriptorSupplier + extends ProcessorServerBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ProcessorServerMethodDescriptorSupplier(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 (ProcessorServerGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ProcessorServerFileDescriptorSupplier()) + .addMethod(getGetPacketsMethod()) + .build(); + } + } + } + return result; + } +}