From 1d95eaa564d7c031508f9825e521874c258586a9 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Tue, 17 May 2022 00:18:26 +0800 Subject: [PATCH] init --- .gitignore | 201 ++ pom.xml | 32 + proto_grpc.sh | 2 + .../java/com/yuandian/dataflow/Server.java | 13 + .../com/yuandian/dataflow/rpc/Scheduler.java | 1974 +++++++++++++++++ .../com/yuandian/dataflow/rpc/scheduler.proto | 26 + .../java/com/yuandian/dataflow/AppTest.java | 38 + 7 files changed, 2286 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100755 proto_grpc.sh create mode 100644 src/main/java/com/yuandian/dataflow/Server.java create mode 100644 src/main/java/com/yuandian/dataflow/rpc/Scheduler.java create mode 100644 src/main/java/com/yuandian/dataflow/rpc/scheduler.proto create mode 100644 src/test/java/com/yuandian/dataflow/AppTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aac10b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,201 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + + +# Created by https://www.gitignore.io/api/git,java,maven,eclipse,windows + +### Eclipse ### + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +.sts4-cache/ + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +.mvn/wrapper/maven-wrapper.jar + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Some additional ignores (sort later) +*.DS_Store +*.sw? +.#* +*# +*~ +.classpath +.project +.settings +bin +build +target +dependency-reduced-pom.xml +*.sublime-* +/scratch +.gradle +README.html +*.iml +.idea +.exercism diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bb544a7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,32 @@ + + 4.0.0 + + com.yuandian.dataflow + dataflow + 1.0-SNAPSHOT + jar + + dataflow + http://maven.apache.org + + + UTF-8 + 11 + + + + + junit + junit + 3.8.1 + test + + + + com.google.protobuf + protobuf-java + 3.20.1 + + + diff --git a/proto_grpc.sh b/proto_grpc.sh new file mode 100755 index 0000000..0e03266 --- /dev/null +++ b/proto_grpc.sh @@ -0,0 +1,2 @@ +#! /bin/bash +protoc src/main/java/com/yuandian/dataflow/rpc/*.proto --java_out=./src/main/java/ \ No newline at end of file diff --git a/src/main/java/com/yuandian/dataflow/Server.java b/src/main/java/com/yuandian/dataflow/Server.java new file mode 100644 index 0000000..e08e165 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/Server.java @@ -0,0 +1,13 @@ +package com.yuandian.dataflow; + +/** + * Hello world! + * + */ +public class Server +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java b/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java new file mode 100644 index 0000000..1439195 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java @@ -0,0 +1,1974 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/main/java/com/yuandian/dataflow/rpc/scheduler.proto + +package com.yuandian.dataflow.rpc; + +public final class Scheduler { + private Scheduler() {} + 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 StateOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.yuandian.dataflow.rpc.State) + com.google.protobuf.MessageOrBuilder { + + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + int getQueueMapCount(); + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + boolean containsQueueMap( + int key); + /** + * Use {@link #getQueueMapMap()} instead. + */ + @java.lang.Deprecated + java.util.Map + getQueueMap(); + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + java.util.Map + getQueueMapMap(); + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrDefault( + int key, + com.yuandian.dataflow.rpc.Scheduler.QueueState defaultValue); + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrThrow( + int key); + } + /** + * Protobuf type {@code com.yuandian.dataflow.rpc.State} + */ + public static final class State extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.State) + StateOrBuilder { + private static final long serialVersionUID = 0L; + // Use State.newBuilder() to construct. + private State(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private State() { + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private State( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + queueMap_ = com.google.protobuf.MapField.newMapField( + QueueMapDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry + queueMap__ = input.readMessage( + QueueMapDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + queueMap_.getMutableMap().put( + queueMap__.getKey(), queueMap__.getValue()); + break; + } + default: { + if (!parseUnknownFieldProto3( + 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 final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 1: + return internalGetQueueMap(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.State.class, com.yuandian.dataflow.rpc.Scheduler.State.Builder.class); + } + + public static final int QUEUEMAP_FIELD_NUMBER = 1; + private static final class QueueMapDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.INT32, + 0, + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.yuandian.dataflow.rpc.Scheduler.QueueState.getDefaultInstance()); + } + private com.google.protobuf.MapField< + java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> queueMap_; + private com.google.protobuf.MapField + internalGetQueueMap() { + if (queueMap_ == null) { + return com.google.protobuf.MapField.emptyMapField( + QueueMapDefaultEntryHolder.defaultEntry); + } + return queueMap_; + } + + public int getQueueMapCount() { + return internalGetQueueMap().getMap().size(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public boolean containsQueueMap( + int key) { + + return internalGetQueueMap().getMap().containsKey(key); + } + /** + * Use {@link #getQueueMapMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getQueueMap() { + return getQueueMapMap(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public java.util.Map getQueueMapMap() { + return internalGetQueueMap().getMap(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrDefault( + int key, + com.yuandian.dataflow.rpc.Scheduler.QueueState defaultValue) { + + java.util.Map map = + internalGetQueueMap().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrThrow( + int key) { + + java.util.Map map = + internalGetQueueMap().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + 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 { + com.google.protobuf.GeneratedMessageV3 + .serializeIntegerMapTo( + output, + internalGetQueueMap(), + QueueMapDefaultEntryHolder.defaultEntry, + 1); + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry entry + : internalGetQueueMap().getMap().entrySet()) { + com.google.protobuf.MapEntry + queueMap__ = QueueMapDefaultEntryHolder.defaultEntry.newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, queueMap__); + } + 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.rpc.Scheduler.State)) { + return super.equals(obj); + } + com.yuandian.dataflow.rpc.Scheduler.State other = (com.yuandian.dataflow.rpc.Scheduler.State) obj; + + boolean result = true; + result = result && internalGetQueueMap().equals( + other.internalGetQueueMap()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetQueueMap().getMap().isEmpty()) { + hash = (37 * hash) + QUEUEMAP_FIELD_NUMBER; + hash = (53 * hash) + internalGetQueueMap().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.yuandian.dataflow.rpc.Scheduler.State parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.State 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.rpc.Scheduler.State parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.State 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.rpc.Scheduler.State parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.State parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.rpc.Scheduler.State parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.State 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.rpc.Scheduler.State parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.State 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.rpc.Scheduler.State parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.State 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.rpc.Scheduler.State 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 com.yuandian.dataflow.rpc.State} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.yuandian.dataflow.rpc.State) + com.yuandian.dataflow.rpc.Scheduler.StateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField( + int number) { + switch (number) { + case 1: + return internalGetQueueMap(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField( + int number) { + switch (number) { + case 1: + return internalGetMutableQueueMap(); + default: + throw new RuntimeException( + "Invalid map field number: " + number); + } + } + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.State.class, com.yuandian.dataflow.rpc.Scheduler.State.Builder.class); + } + + // Construct using com.yuandian.dataflow.rpc.Scheduler.State.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(); + internalGetMutableQueueMap().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_State_descriptor; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.State getDefaultInstanceForType() { + return com.yuandian.dataflow.rpc.Scheduler.State.getDefaultInstance(); + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.State build() { + com.yuandian.dataflow.rpc.Scheduler.State result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.State buildPartial() { + com.yuandian.dataflow.rpc.Scheduler.State result = new com.yuandian.dataflow.rpc.Scheduler.State(this); + int from_bitField0_ = bitField0_; + result.queueMap_ = internalGetQueueMap(); + result.queueMap_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.yuandian.dataflow.rpc.Scheduler.State) { + return mergeFrom((com.yuandian.dataflow.rpc.Scheduler.State)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.yuandian.dataflow.rpc.Scheduler.State other) { + if (other == com.yuandian.dataflow.rpc.Scheduler.State.getDefaultInstance()) return this; + internalGetMutableQueueMap().mergeFrom( + other.internalGetQueueMap()); + 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.rpc.Scheduler.State parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.yuandian.dataflow.rpc.Scheduler.State) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private com.google.protobuf.MapField< + java.lang.Integer, com.yuandian.dataflow.rpc.Scheduler.QueueState> queueMap_; + private com.google.protobuf.MapField + internalGetQueueMap() { + if (queueMap_ == null) { + return com.google.protobuf.MapField.emptyMapField( + QueueMapDefaultEntryHolder.defaultEntry); + } + return queueMap_; + } + private com.google.protobuf.MapField + internalGetMutableQueueMap() { + onChanged();; + if (queueMap_ == null) { + queueMap_ = com.google.protobuf.MapField.newMapField( + QueueMapDefaultEntryHolder.defaultEntry); + } + if (!queueMap_.isMutable()) { + queueMap_ = queueMap_.copy(); + } + return queueMap_; + } + + public int getQueueMapCount() { + return internalGetQueueMap().getMap().size(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public boolean containsQueueMap( + int key) { + + return internalGetQueueMap().getMap().containsKey(key); + } + /** + * Use {@link #getQueueMapMap()} instead. + */ + @java.lang.Deprecated + public java.util.Map getQueueMap() { + return getQueueMapMap(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public java.util.Map getQueueMapMap() { + return internalGetQueueMap().getMap(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrDefault( + int key, + com.yuandian.dataflow.rpc.Scheduler.QueueState defaultValue) { + + java.util.Map map = + internalGetQueueMap().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public com.yuandian.dataflow.rpc.Scheduler.QueueState getQueueMapOrThrow( + int key) { + + java.util.Map map = + internalGetQueueMap().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearQueueMap() { + internalGetMutableQueueMap().getMutableMap() + .clear(); + return this; + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public Builder removeQueueMap( + int key) { + + internalGetMutableQueueMap().getMutableMap() + .remove(key); + return this; + } + /** + * Use alternate mutation accessors instead. + */ + @java.lang.Deprecated + public java.util.Map + getMutableQueueMap() { + return internalGetMutableQueueMap().getMutableMap(); + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + public Builder putQueueMap( + int key, + com.yuandian.dataflow.rpc.Scheduler.QueueState value) { + + if (value == null) { throw new java.lang.NullPointerException(); } + internalGetMutableQueueMap().getMutableMap() + .put(key, value); + return this; + } + /** + * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; + */ + + public Builder putAllQueueMap( + java.util.Map values) { + internalGetMutableQueueMap().getMutableMap() + .putAll(values); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.yuandian.dataflow.rpc.State) + } + + // @@protoc_insertion_point(class_scope:com.yuandian.dataflow.rpc.State) + private static final com.yuandian.dataflow.rpc.Scheduler.State DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.yuandian.dataflow.rpc.Scheduler.State(); + } + + public static com.yuandian.dataflow.rpc.Scheduler.State getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public State parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new State(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.rpc.Scheduler.State getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface QueueStateOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.yuandian.dataflow.rpc.QueueState) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Size = 1; + */ + int getSize(); + } + /** + * Protobuf type {@code com.yuandian.dataflow.rpc.QueueState} + */ + public static final class QueueState extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.QueueState) + QueueStateOrBuilder { + private static final long serialVersionUID = 0L; + // Use QueueState.newBuilder() to construct. + private QueueState(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private QueueState() { + size_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private QueueState( + 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: { + + size_ = input.readInt32(); + break; + } + default: { + if (!parseUnknownFieldProto3( + 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 final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_QueueState_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.QueueState.class, com.yuandian.dataflow.rpc.Scheduler.QueueState.Builder.class); + } + + public static final int SIZE_FIELD_NUMBER = 1; + private int size_; + /** + * int32 Size = 1; + */ + public int getSize() { + return size_; + } + + 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 (size_ != 0) { + output.writeInt32(1, size_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (size_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, size_); + } + 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.rpc.Scheduler.QueueState)) { + return super.equals(obj); + } + com.yuandian.dataflow.rpc.Scheduler.QueueState other = (com.yuandian.dataflow.rpc.Scheduler.QueueState) obj; + + boolean result = true; + result = result && (getSize() + == other.getSize()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SIZE_FIELD_NUMBER; + hash = (53 * hash) + getSize(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.yuandian.dataflow.rpc.Scheduler.QueueState parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState 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.rpc.Scheduler.QueueState parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState 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.rpc.Scheduler.QueueState parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState 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.rpc.Scheduler.QueueState parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState 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.rpc.Scheduler.QueueState parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.QueueState 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.rpc.Scheduler.QueueState 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 com.yuandian.dataflow.rpc.QueueState} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.yuandian.dataflow.rpc.QueueState) + com.yuandian.dataflow.rpc.Scheduler.QueueStateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_QueueState_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.QueueState.class, com.yuandian.dataflow.rpc.Scheduler.QueueState.Builder.class); + } + + // Construct using com.yuandian.dataflow.rpc.Scheduler.QueueState.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(); + size_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.QueueState getDefaultInstanceForType() { + return com.yuandian.dataflow.rpc.Scheduler.QueueState.getDefaultInstance(); + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.QueueState build() { + com.yuandian.dataflow.rpc.Scheduler.QueueState result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.QueueState buildPartial() { + com.yuandian.dataflow.rpc.Scheduler.QueueState result = new com.yuandian.dataflow.rpc.Scheduler.QueueState(this); + result.size_ = size_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.yuandian.dataflow.rpc.Scheduler.QueueState) { + return mergeFrom((com.yuandian.dataflow.rpc.Scheduler.QueueState)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.yuandian.dataflow.rpc.Scheduler.QueueState other) { + if (other == com.yuandian.dataflow.rpc.Scheduler.QueueState.getDefaultInstance()) return this; + if (other.getSize() != 0) { + setSize(other.getSize()); + } + 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.rpc.Scheduler.QueueState parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.yuandian.dataflow.rpc.Scheduler.QueueState) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int size_ ; + /** + * int32 Size = 1; + */ + public int getSize() { + return size_; + } + /** + * int32 Size = 1; + */ + public Builder setSize(int value) { + + size_ = value; + onChanged(); + return this; + } + /** + * int32 Size = 1; + */ + public Builder clearSize() { + + size_ = 0; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.yuandian.dataflow.rpc.QueueState) + } + + // @@protoc_insertion_point(class_scope:com.yuandian.dataflow.rpc.QueueState) + private static final com.yuandian.dataflow.rpc.Scheduler.QueueState DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.yuandian.dataflow.rpc.Scheduler.QueueState(); + } + + public static com.yuandian.dataflow.rpc.Scheduler.QueueState getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public QueueState parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new QueueState(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.rpc.Scheduler.QueueState getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + public interface ResponseOrBuilder extends + // @@protoc_insertion_point(interface_extends:com.yuandian.dataflow.rpc.Response) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 Code = 1; + */ + int getCode(); + + /** + * string Message = 2; + */ + java.lang.String getMessage(); + /** + * string Message = 2; + */ + com.google.protobuf.ByteString + getMessageBytes(); + + /** + * bytes Data = 3; + */ + com.google.protobuf.ByteString getData(); + } + /** + * Protobuf type {@code com.yuandian.dataflow.rpc.Response} + */ + public static final class Response extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:com.yuandian.dataflow.rpc.Response) + ResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use Response.newBuilder() to construct. + private Response(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private Response() { + code_ = 0; + message_ = ""; + data_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private Response( + 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: { + + code_ = input.readInt32(); + break; + } + case 18: { + java.lang.String s = input.readStringRequireUtf8(); + + message_ = s; + break; + } + case 26: { + + data_ = input.readBytes(); + break; + } + default: { + if (!parseUnknownFieldProto3( + 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 final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.Response.class, com.yuandian.dataflow.rpc.Scheduler.Response.Builder.class); + } + + public static final int CODE_FIELD_NUMBER = 1; + private int code_; + /** + * int32 Code = 1; + */ + public int getCode() { + return code_; + } + + public static final int MESSAGE_FIELD_NUMBER = 2; + private volatile java.lang.Object message_; + /** + * string Message = 2; + */ + 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; + */ + 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; + } + } + + public static final int DATA_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString data_; + /** + * bytes Data = 3; + */ + public com.google.protobuf.ByteString getData() { + return data_; + } + + 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 (!getMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_); + } + if (!data_.isEmpty()) { + output.writeBytes(3, data_); + } + 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 (!getMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_); + } + if (!data_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, data_); + } + 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.rpc.Scheduler.Response)) { + return super.equals(obj); + } + com.yuandian.dataflow.rpc.Scheduler.Response other = (com.yuandian.dataflow.rpc.Scheduler.Response) obj; + + boolean result = true; + result = result && (getCode() + == other.getCode()); + result = result && getMessage() + .equals(other.getMessage()); + result = result && getData() + .equals(other.getData()); + result = result && unknownFields.equals(other.unknownFields); + return result; + } + + @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 = (37 * hash) + DATA_FIELD_NUMBER; + hash = (53 * hash) + getData().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.yuandian.dataflow.rpc.Scheduler.Response parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response 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.rpc.Scheduler.Response parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response 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.rpc.Scheduler.Response parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response 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.rpc.Scheduler.Response parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response 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.rpc.Scheduler.Response parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static com.yuandian.dataflow.rpc.Scheduler.Response 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.rpc.Scheduler.Response 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 com.yuandian.dataflow.rpc.Response} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:com.yuandian.dataflow.rpc.Response) + com.yuandian.dataflow.rpc.Scheduler.ResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_Response_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_Response_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.yuandian.dataflow.rpc.Scheduler.Response.class, com.yuandian.dataflow.rpc.Scheduler.Response.Builder.class); + } + + // Construct using com.yuandian.dataflow.rpc.Scheduler.Response.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_ = ""; + + data_ = com.google.protobuf.ByteString.EMPTY; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return com.yuandian.dataflow.rpc.Scheduler.internal_static_com_yuandian_dataflow_rpc_Response_descriptor; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.Response getDefaultInstanceForType() { + return com.yuandian.dataflow.rpc.Scheduler.Response.getDefaultInstance(); + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.Response build() { + com.yuandian.dataflow.rpc.Scheduler.Response result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.yuandian.dataflow.rpc.Scheduler.Response buildPartial() { + com.yuandian.dataflow.rpc.Scheduler.Response result = new com.yuandian.dataflow.rpc.Scheduler.Response(this); + result.code_ = code_; + result.message_ = message_; + result.data_ = data_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return (Builder) super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return (Builder) super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return (Builder) super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return (Builder) super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return (Builder) super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.yuandian.dataflow.rpc.Scheduler.Response) { + return mergeFrom((com.yuandian.dataflow.rpc.Scheduler.Response)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.yuandian.dataflow.rpc.Scheduler.Response other) { + if (other == com.yuandian.dataflow.rpc.Scheduler.Response.getDefaultInstance()) return this; + if (other.getCode() != 0) { + setCode(other.getCode()); + } + if (!other.getMessage().isEmpty()) { + message_ = other.message_; + onChanged(); + } + if (other.getData() != com.google.protobuf.ByteString.EMPTY) { + setData(other.getData()); + } + 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.rpc.Scheduler.Response parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.yuandian.dataflow.rpc.Scheduler.Response) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int code_ ; + /** + * int32 Code = 1; + */ + public int getCode() { + return code_; + } + /** + * int32 Code = 1; + */ + public Builder setCode(int value) { + + code_ = value; + onChanged(); + return this; + } + /** + * int32 Code = 1; + */ + public Builder clearCode() { + + code_ = 0; + onChanged(); + return this; + } + + private java.lang.Object message_ = ""; + /** + * string Message = 2; + */ + 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; + */ + 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; + */ + public Builder setMessage( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + message_ = value; + onChanged(); + return this; + } + /** + * string Message = 2; + */ + public Builder clearMessage() { + + message_ = getDefaultInstance().getMessage(); + onChanged(); + return this; + } + /** + * string Message = 2; + */ + public Builder setMessageBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + message_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; + /** + * bytes Data = 3; + */ + public com.google.protobuf.ByteString getData() { + return data_; + } + /** + * bytes Data = 3; + */ + public Builder setData(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + data_ = value; + onChanged(); + return this; + } + /** + * bytes Data = 3; + */ + public Builder clearData() { + + data_ = getDefaultInstance().getData(); + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFieldsProto3(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:com.yuandian.dataflow.rpc.Response) + } + + // @@protoc_insertion_point(class_scope:com.yuandian.dataflow.rpc.Response) + private static final com.yuandian.dataflow.rpc.Scheduler.Response DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new com.yuandian.dataflow.rpc.Scheduler.Response(); + } + + public static com.yuandian.dataflow.rpc.Scheduler.Response getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Response parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Response(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.rpc.Scheduler.Response getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_yuandian_dataflow_rpc_State_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_yuandian_dataflow_rpc_State_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_yuandian_dataflow_rpc_QueueState_fieldAccessorTable; + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_com_yuandian_dataflow_rpc_Response_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_com_yuandian_dataflow_rpc_Response_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n7src/main/java/com/yuandian/dataflow/rp" + + "c/scheduler.proto\022\031com.yuandian.dataflow" + + ".rpc\"\241\001\n\005State\022@\n\010QueueMap\030\001 \003(\0132..com.y" + + "uandian.dataflow.rpc.State.QueueMapEntry" + + "\032V\n\rQueueMapEntry\022\013\n\003key\030\001 \001(\005\0224\n\005value\030" + + "\002 \001(\0132%.com.yuandian.dataflow.rpc.QueueS" + + "tate:\0028\001\"\032\n\nQueueState\022\014\n\004Size\030\001 \001(\005\"7\n\010" + + "Response\022\014\n\004Code\030\001 \001(\005\022\017\n\007Message\030\002 \001(\t\022" + + "\014\n\004Data\030\003 \001(\0142[\n\010DataFlow\022O\n\006Update\022 .co" + + "m.yuandian.dataflow.rpc.State\032#.com.yuan" + + "dian.dataflow.rpc.Responseb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }, assigner); + internal_static_com_yuandian_dataflow_rpc_State_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_com_yuandian_dataflow_rpc_State_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_yuandian_dataflow_rpc_State_descriptor, + new java.lang.String[] { "QueueMap", }); + internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_descriptor = + internal_static_com_yuandian_dataflow_rpc_State_descriptor.getNestedTypes().get(0); + internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_yuandian_dataflow_rpc_State_QueueMapEntry_descriptor, + new java.lang.String[] { "Key", "Value", }); + internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_com_yuandian_dataflow_rpc_QueueState_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_yuandian_dataflow_rpc_QueueState_descriptor, + new java.lang.String[] { "Size", }); + internal_static_com_yuandian_dataflow_rpc_Response_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_com_yuandian_dataflow_rpc_Response_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_com_yuandian_dataflow_rpc_Response_descriptor, + new java.lang.String[] { "Code", "Message", "Data", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/com/yuandian/dataflow/rpc/scheduler.proto b/src/main/java/com/yuandian/dataflow/rpc/scheduler.proto new file mode 100644 index 0000000..c0d6ef6 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/rpc/scheduler.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; + +package com.yuandian.dataflow.rpc; +// option java_package = "com.yuandian.dataflow.rpc"; + +// option java_outer_classname = "com.yuandian.dataflow.rpc"; + + +service DataFlow { + rpc Update (State) returns (Response); +} + +message State { + map QueueMap = 1; + +} + +message QueueState { + int32 Size = 1; +} + +message Response { + int32 Code = 1; + string Message = 2; + bytes Data = 3; +} \ No newline at end of file diff --git a/src/test/java/com/yuandian/dataflow/AppTest.java b/src/test/java/com/yuandian/dataflow/AppTest.java new file mode 100644 index 0000000..ae1451e --- /dev/null +++ b/src/test/java/com/yuandian/dataflow/AppTest.java @@ -0,0 +1,38 @@ +package com.yuandian.dataflow; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +}