diff --git a/.gitignore b/.gitignore index aac10b3..674db64 100644 --- a/.gitignore +++ b/.gitignore @@ -199,3 +199,7 @@ README.html *.iml .idea .exercism + + +raftdata +screenlog.* \ No newline at end of file diff --git a/pom.xml b/pom.xml index 196f82c..d04f3e7 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,8 @@ 1.46.0 1.7.36 1.3.10 + 2.7.0 + 2.9.0 @@ -46,47 +48,33 @@ - org.apache.ratis - ratis-common - ${ratis.version} + org.apache.ratis + ratis-common + ${ratis.version} org.apache.ratis ratis-server ${ratis.version} - + + - org.apache.ratis ratis-proto ${ratis.version} - - - + + + org.springframework.boot + spring-boot-starter-web + ${spring.boot.web} + - - com.google.protobuf - protobuf-java - ${protobuf.version} - - - - io.protostuff - protostuff-core - ${protostuff.version} - - - - io.protostuff - protostuff-runtime - ${protostuff.version} - javax.annotation @@ -94,10 +82,15 @@ ${javax.annotation.version} + + com.google.code.gson + gson + ${gson.version} + - + @@ -144,11 +137,11 @@ protobuf-maven-plugin 0.6.1 - + grpc-java com.google.protobuf:protoc:3.13.0:exe:${os.detected.classifier} io.grpc:protoc-gen-grpc-java:1.46.0:exe:${os.detected.classifier} - + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + \ 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 index 054c176..bfd4727 100644 --- a/src/main/java/com/yuandian/dataflow/Server.java +++ b/src/main/java/com/yuandian/dataflow/Server.java @@ -1,14 +1,17 @@ package com.yuandian.dataflow; -import com.yuandian.dataflow.rpc.DataFlowGrpc; -import com.yuandian.dataflow.rpc.DataFlowGrpc.DataFlowImplBase; -import com.yuandian.dataflow.rpc.Scheduler.Response; -import com.yuandian.dataflow.rpc.Scheduler.State; + import com.yuandian.dataflow.statemachine.RaftClosure; import com.yuandian.dataflow.statemachine.StateMachine; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import java.io.File; import java.nio.ByteBuffer; +import com.alipay.remoting.rpc.protocol.RpcResponseProcessor; import com.alipay.sofa.jraft.Closure; import com.alipay.sofa.jraft.Iterator; import com.alipay.sofa.jraft.JRaftUtils; @@ -26,84 +29,73 @@ import com.alipay.sofa.jraft.entity.Task; import com.alipay.sofa.jraft.option.NodeOptions; import com.alipay.sofa.jraft.option.RaftOptions; import com.alipay.sofa.jraft.rpc.CliClientService; +import com.alipay.sofa.jraft.rpc.RpcProcessor; import com.alipay.sofa.jraft.rpc.RaftRpcServerFactory; import com.alipay.sofa.jraft.rpc.RpcClient; +import com.alipay.sofa.jraft.rpc.RpcRequestProcessor; import com.alipay.sofa.jraft.rpc.RpcServer; import com.alipay.sofa.jraft.rpc.impl.BoltRpcServer; import com.alipay.sofa.jraft.rpc.impl.BoltRaftRpcFactory; import com.alipay.sofa.jraft.rpc.impl.BoltRpcClient; import com.alipay.sofa.jraft.util.Endpoint; - + import com.alipay.sofa.jraft.option.ReplicatorGroupOptions; -import io.grpc.stub.StreamObserver; + + /** * Hello world! * */ -public class Server -{ - public class ServerImpl extends DataFlowImplBase { +@SpringBootApplication +public class Server { + + public static void main(String[] args) { - @Override - public void update(State request, StreamObserver responseObserver) { - // TODO Auto-generated method stub - super.update(request, responseObserver); - - - } - - } + String[] peers = new String[]{"localhost:4440","localhost:4441","localhost:4442"}; + String[] sprPeers = new String[]{"3440","3441","3442"}; - public static void main( String[] args ) - { + var peeridstr = peers[ Integer.parseInt(args[0] ) ]; + var sprPort = sprPeers[Integer.parseInt(args[0] )]; String groupId = "jraft"; - // Endpoint addr = new Endpoint("localhost", 8080); - // String s = addr.toString(); // 结果为 localhost:8080 - // PeerId peer = new PeerId(); - // boolean success = peer.parse(s); - Endpoint addr = JRaftUtils.getEndPoint("localhost:8080"); - PeerId serverId = JRaftUtils.getPeerId("localhost:8080"); - Configuration conf = JRaftUtils.getConfiguration("localhost:8081,localhost:8080"); - - // //IteratorImpl it = new IteratorImpl(); - Closure done = new RaftClosure(); - Task task = new Task(); - task.setData(ByteBuffer.wrap("Hello! This is a sample message to test raft..".getBytes())); - task.setDone(done); - - NodeOptions opts = new NodeOptions(); - opts.setElectionTimeoutMs(1000); - opts.setLogUri("logs"); - opts.setRaftMetaUri("raftMeta"); - opts.setSnapshotUri("snapshots"); - opts.setFsm(new StateMachine()); - opts.setInitialConf(conf); - NodeImpl node = (NodeImpl) RaftServiceFactory.createRaftNode(groupId, serverId); - NodeId nodeId = node.getNodeId(); - NodeManager.getInstance().addAddress(serverId.getEndpoint()); - BoltRpcServer rpcServer = (BoltRpcServer) RaftRpcServerFactory.createAndStartRaftRpcServer(serverId.getEndpoint()); - RaftGroupService cluster = new RaftGroupService(groupId, serverId, opts); - //RpcServer rpcServer2 = cluster.getRpcServer(); - //Node node2 = cluster.start(); - - BoltRaftRpcFactory boltRaftRpcFactory = new BoltRaftRpcFactory(); - RpcClient boltRpcClient = boltRaftRpcFactory.createRpcClient(); - //boltRpcClient.registerConnectEventListener(null); - //boltRpcClient.invokeSync(addr, s, 0) - ReplicatorGroupOptions replicatorGroupOptions = new ReplicatorGroupOptions(); - RaftOptions raftOptions = new RaftOptions(); - replicatorGroupOptions.setRaftOptions(raftOptions); - replicatorGroupOptions.setNode(node); - - ReplicatorGroupImpl replicatorGroupImpl = new ReplicatorGroupImpl(); - replicatorGroupImpl.init(nodeId, replicatorGroupOptions); - - boltRpcClient.registerConnectEventListener(replicatorGroupImpl); - - - } + + + Configuration conf = JRaftUtils.getConfiguration("localhost:4440,localhost:4441,localhost:4442"); + + PeerId serverId = JRaftUtils.getPeerId(peeridstr); + int port = serverId.getPort(); + + NodeOptions nodeOptions = new NodeOptions(); + nodeOptions.setElectionTimeoutMs(1000); + nodeOptions.setSnapshotLogIndexMargin(3600); + nodeOptions.setInitialConf(conf); + + File RaftDataFile = new File(String.format("./raftdata/%d", port) ); + System.out.print(RaftDataFile.mkdirs()); + + nodeOptions.setLogUri( String.format("./raftdata/%d/logs", port) ); + nodeOptions.setRaftMetaUri(String.format("./raftdata/%d/rafts", port)); + nodeOptions.setSnapshotUri(String.format("./raftdata/%d/snaps", port)); + nodeOptions.setFsm(new StateMachine()); + + RaftGroupService cluster = new RaftGroupService(groupId, serverId, nodeOptions); + Node node = cluster.start(); + + Closure done = new RaftClosure(); + Task task = new Task(); + task.setData(ByteBuffer.wrap("hello".getBytes())); + task.setDone(done); + node.apply(task); + + + System.setProperty("server.port", sprPort); + SpringApplication.run(Server.class, args); + + + + node.shutdown(done); + } } diff --git a/src/main/java/com/yuandian/dataflow/controller/TaskLog.java b/src/main/java/com/yuandian/dataflow/controller/TaskLog.java new file mode 100644 index 0000000..7390aa4 --- /dev/null +++ b/src/main/java/com/yuandian/dataflow/controller/TaskLog.java @@ -0,0 +1,25 @@ +package com.yuandian.dataflow.controller; + +import com.google.gson.JsonObject; + +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@Controller +public class TaskLog { + + @PostMapping(path = "/test", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity greeting(@RequestBody JsonObject input) { + + String message = (String) input.get("message").getAsString(); + System.out.println(message); + JsonObject response = new JsonObject(); + + response.addProperty("status", "success"); + return new ResponseEntity(response, HttpStatus.OK); + } +} diff --git a/src/main/java/com/yuandian/dataflow/rpc/DataFlowGrpc.java b/src/main/java/com/yuandian/dataflow/rpc/DataFlowGrpc.java deleted file mode 100644 index 52926d0..0000000 --- a/src/main/java/com/yuandian/dataflow/rpc/DataFlowGrpc.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.yuandian.dataflow.rpc; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - */ -@javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.46.0)", - comments = "Source: scheduler.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class DataFlowGrpc { - - private DataFlowGrpc() {} - - public static final String SERVICE_NAME = "com.yuandian.dataflow.rpc.DataFlow"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor getUpdateMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "Update", - requestType = com.yuandian.dataflow.rpc.Scheduler.State.class, - responseType = com.yuandian.dataflow.rpc.Scheduler.Response.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getUpdateMethod() { - io.grpc.MethodDescriptor getUpdateMethod; - if ((getUpdateMethod = DataFlowGrpc.getUpdateMethod) == null) { - synchronized (DataFlowGrpc.class) { - if ((getUpdateMethod = DataFlowGrpc.getUpdateMethod) == null) { - DataFlowGrpc.getUpdateMethod = getUpdateMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "Update")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.yuandian.dataflow.rpc.Scheduler.State.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - com.yuandian.dataflow.rpc.Scheduler.Response.getDefaultInstance())) - .setSchemaDescriptor(new DataFlowMethodDescriptorSupplier("Update")) - .build(); - } - } - } - return getUpdateMethod; - } - - /** - * Creates a new async stub that supports all call types for the service - */ - public static DataFlowStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DataFlowStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowStub(channel, callOptions); - } - }; - return DataFlowStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static DataFlowBlockingStub newBlockingStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DataFlowBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowBlockingStub(channel, callOptions); - } - }; - return DataFlowBlockingStub.newStub(factory, channel); - } - - /** - * Creates a new ListenableFuture-style stub that supports unary calls on the service - */ - public static DataFlowFutureStub newFutureStub( - io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DataFlowFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowFutureStub(channel, callOptions); - } - }; - return DataFlowFutureStub.newStub(factory, channel); - } - - /** - */ - public static abstract class DataFlowImplBase implements io.grpc.BindableService { - - /** - */ - public void update(com.yuandian.dataflow.rpc.Scheduler.State request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateMethod(), responseObserver); - } - - @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getUpdateMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.yuandian.dataflow.rpc.Scheduler.State, - com.yuandian.dataflow.rpc.Scheduler.Response>( - this, METHODID_UPDATE))) - .build(); - } - } - - /** - */ - public static final class DataFlowStub extends io.grpc.stub.AbstractAsyncStub { - private DataFlowStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DataFlowStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowStub(channel, callOptions); - } - - /** - */ - public void update(com.yuandian.dataflow.rpc.Scheduler.State request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getUpdateMethod(), getCallOptions()), request, responseObserver); - } - } - - /** - */ - public static final class DataFlowBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private DataFlowBlockingStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DataFlowBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowBlockingStub(channel, callOptions); - } - - /** - */ - public com.yuandian.dataflow.rpc.Scheduler.Response update(com.yuandian.dataflow.rpc.Scheduler.State request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getUpdateMethod(), getCallOptions(), request); - } - } - - /** - */ - public static final class DataFlowFutureStub extends io.grpc.stub.AbstractFutureStub { - private DataFlowFutureStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DataFlowFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DataFlowFutureStub(channel, callOptions); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture update( - com.yuandian.dataflow.rpc.Scheduler.State request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getUpdateMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_UPDATE = 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 DataFlowImplBase serviceImpl; - private final int methodId; - - MethodHandlers(DataFlowImplBase 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_UPDATE: - serviceImpl.update((com.yuandian.dataflow.rpc.Scheduler.State) 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 DataFlowBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - DataFlowBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.yuandian.dataflow.rpc.Scheduler.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("DataFlow"); - } - } - - private static final class DataFlowFileDescriptorSupplier - extends DataFlowBaseDescriptorSupplier { - DataFlowFileDescriptorSupplier() {} - } - - private static final class DataFlowMethodDescriptorSupplier - extends DataFlowBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - DataFlowMethodDescriptorSupplier(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 (DataFlowGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new DataFlowFileDescriptorSupplier()) - .addMethod(getUpdateMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java b/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java deleted file mode 100644 index 3d926ad..0000000 --- a/src/main/java/com/yuandian/dataflow/rpc/Scheduler.java +++ /dev/null @@ -1,2026 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: 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 - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new 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) != 0)) { - 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 (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static 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; - */ - - @java.lang.Override - public boolean containsQueueMap( - int key) { - - return internalGetQueueMap().getMap().containsKey(key); - } - /** - * Use {@link #getQueueMapMap()} instead. - */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getQueueMap() { - return getQueueMapMap(); - } - /** - * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; - */ - @java.lang.Override - - public java.util.Map getQueueMapMap() { - return internalGetQueueMap().getMap(); - } - /** - * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; - */ - @java.lang.Override - - 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; - */ - @java.lang.Override - - 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; - - if (!internalGetQueueMap().equals( - other.internalGetQueueMap())) 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(); - 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 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.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; - */ - - @java.lang.Override - public boolean containsQueueMap( - int key) { - - return internalGetQueueMap().getMap().containsKey(key); - } - /** - * Use {@link #getQueueMapMap()} instead. - */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getQueueMap() { - return getQueueMapMap(); - } - /** - * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; - */ - @java.lang.Override - - public java.util.Map getQueueMapMap() { - return internalGetQueueMap().getMap(); - } - /** - * map<int32, .com.yuandian.dataflow.rpc.QueueState> QueueMap = 1; - */ - @java.lang.Override - - 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; - */ - @java.lang.Override - - 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.setUnknownFields(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; - * @return The size. - */ - 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() { - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new QueueState(); - } - - @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(); - } - 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 (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static 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; - * @return The size. - */ - @java.lang.Override - 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; - - if (getSize() - != other.getSize()) 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) + 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 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.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; - * @return The size. - */ - @java.lang.Override - public int getSize() { - return size_; - } - /** - * int32 Size = 1; - * @param value The size to set. - * @return This builder for chaining. - */ - public Builder setSize(int value) { - - size_ = value; - onChanged(); - return this; - } - /** - * int32 Size = 1; - * @return This builder for chaining. - */ - public Builder clearSize() { - - size_ = 0; - 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: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; - * @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(); - - /** - * bytes Data = 3; - * @return The data. - */ - 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() { - message_ = ""; - data_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance( - UnusedPrivateParameter unused) { - return new Response(); - } - - @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(); - } - 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 (!parseUnknownField( - input, unknownFields, extensionRegistry, tag)) { - done = true; - } - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static 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; - * @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; - } - } - - public static final int DATA_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString data_; - /** - * bytes Data = 3; - * @return The data. - */ - @java.lang.Override - 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; - - if (getCode() - != other.getCode()) return false; - if (!getMessage() - .equals(other.getMessage())) return false; - if (!getData() - .equals(other.getData())) 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 = (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 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.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; - * @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; - } - - private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; - /** - * bytes Data = 3; - * @return The data. - */ - @java.lang.Override - public com.google.protobuf.ByteString getData() { - return data_; - } - /** - * bytes Data = 3; - * @param value The data to set. - * @return This builder for chaining. - */ - public Builder setData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - data_ = value; - onChanged(); - return this; - } - /** - * bytes Data = 3; - * @return This builder for chaining. - */ - public Builder clearData() { - - data_ = getDefaultInstance().getData(); - 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: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 = { - "\n\017scheduler.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\002P\000b\006proto3" - }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }); - 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/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..dba46ff --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=3440 \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..a19f6b2 --- /dev/null +++ b/start.sh @@ -0,0 +1,9 @@ +screen -S raft-0 -X quit +screen -S raft-1 -X quit +screen -S raft-2 -X quit + +sleep 2 + +screen -dmS raft-0 -L java -jar target/dataflow-1.0-SNAPSHOT.jar 0 +screen -dmS raft-1 -L java -jar target/dataflow-1.0-SNAPSHOT.jar 1 +screen -dmS raft-2 -L java -jar target/dataflow-1.0-SNAPSHOT.jar 2