syntax = "proto3"; //protoc --plugin=protoc-gen-grpc-java=/Users/oliveds/docs/grpc/grpc-java/compiler/build/exe/java_plugin/protoc-gen-grpc-java --grpc-java_out=./out --proto_path=./out Go2JavaService.proto //protoc --java_out=./out --proto_path=./out Go2JavaService.proto ///:. 生成的文件到当前目录 //protoc -I /Users/oliveds/docs/grpc/out --go_out=plugins=grpc:. /Users/oliveds/docs/grpc/out/Go2JavaService.proto option go_package = "bdware.org/bdledger/pkg/api/grpc/proto"; option java_package = "com.bdware.units.grpc"; option java_outer_classname = "GRPCGo2JavaService"; option objc_class_prefix = "RTG"; package com.bdware.units.grpc; // Interface exported by the server. service Go2JavaService { rpc Go2JavaStream(stream Go2JavaMessage) returns (stream Go2JavaMessage){} } message Go2JavaMessage { Go2JavaMessageType msgType=1; string myPeerID = 2; repeated string peerID = 3; ContractUnitRequestType cuType = 4; StatusType statusType = 5; bytes content = 6; string requestID = 7; repeated string contractID = 8; int32 num = 9; string signature = 10; enum Go2JavaMessageType{ ContractUnitRequest = 0; ContractUnitResponse = 1; GetMyPeerID = 2; MyPeerIDResponse = 3; ContractStatusRequest = 4; ContractStatusResponse = 5; GetRandomPeers = 6; GetAllPeers = 7; RandomPeersResponse = 8; AllPeersResponse = 9; } enum StatusType{ SUCCESS = 0; FAIL = 1; } enum ContractUnitRequestType{ START = 0; STOP = 1; EXECUTE = 2; REPLY = 3; REQUEST = 4; PREPREPARE = 5; PREPARE = 6; COMMIT = 7; ADDPEER = 8; DROPPEER = 9; STATESYNC = 10; } }