Refactor structure
This commit is contained in:
parent
7c0258f895
commit
f5b60712a9
@ -1,69 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bdledger.api;
|
package bdware.bdledger.api;
|
||||||
|
|
||||||
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
||||||
option java_package = "bdledger.api.grpc.common";
|
option java_package = "org.bdware.bdledger.api.grpc.pb";
|
||||||
option java_outer_classname = "CommonProto";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 事务类型 */
|
/* 事务类型 */
|
||||||
enum TransactionType {
|
enum TransactionType {
|
||||||
@ -32,14 +28,26 @@ message Transaction {
|
|||||||
bytes s = 11; // ECDSA signature s
|
bytes s = 11; // ECDSA signature s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message Block {
|
||||||
|
bytes hash = 1; // 区块的哈希,当区块处于待确认状态时为`null`
|
||||||
|
repeated bytes parent_hashes = 2; // 父区块的哈希
|
||||||
|
repeated bytes witnesses = 3; // 见证者账户地址
|
||||||
|
int64 timestamp = 4; // 区块产生时的 UNIX 时间戳,单位为秒
|
||||||
|
uint64 size = 5; // 区块大小的字节数
|
||||||
|
uint32 transaction_count = 6; // 区块包含的事务数量
|
||||||
|
bytes transactions_root = 7; // 区块的事务默克尔树根
|
||||||
|
repeated Transaction transactions = 8; // 事务对象的数组,或为空
|
||||||
|
repeated bytes transaction_hashes = 9; // 20字节的交易哈希的数组,或为空
|
||||||
|
}
|
||||||
|
|
||||||
message Contract {
|
message Contract {
|
||||||
bytes contractName = 1; //合约名称
|
bytes contractName = 1; //合约名称
|
||||||
uint32 randomNum =2; //合约执行的节点数量
|
uint32 randomNum = 2; //合约执行的节点数量
|
||||||
bytes operation = 3; //合约方法
|
bytes operation = 3; //合约方法
|
||||||
bytes arg = 4; //合约方法参数
|
bytes arg = 4; //合约方法参数
|
||||||
bytes path = 5; //合约文件路径(合约在IDE工程的相对路径)
|
bytes path = 5; //合约文件路径(合约在IDE工程的相对路径)
|
||||||
bytes content = 6; //合约内容(可为合约文件相对路径/合约脚本)
|
bytes content = 6; //合约内容(可为合约文件相对路径/合约脚本)
|
||||||
bytes pubkey = 7; //用户公钥
|
bytes pubkey = 7; //用户公钥
|
||||||
|
|
||||||
enum ContractUnitRequestType{
|
enum ContractUnitRequestType{
|
||||||
START = 0;
|
START = 0;
|
||||||
@ -55,15 +63,3 @@ message Contract {
|
|||||||
STATESYNC = 10;
|
STATESYNC = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message Block {
|
|
||||||
bytes hash = 1; // 区块的哈希,当区块处于待确认状态时为`null`
|
|
||||||
repeated bytes parent_hashes = 2; // 父区块的哈希
|
|
||||||
repeated bytes witnesses = 3; // 见证者账户地址
|
|
||||||
int64 timestamp = 4; // 区块产生时的 UNIX 时间戳,单位为秒
|
|
||||||
uint64 size = 5; // 区块大小的字节数
|
|
||||||
uint32 transaction_count = 6; // 区块包含的事务数量
|
|
||||||
bytes transactions_root = 7; // 区块的事务默克尔树根
|
|
||||||
repeated Transaction transactions = 8; // 事务对象的数组,或为空
|
|
||||||
repeated bytes transaction_hashes = 9; // 20字节的交易哈希的数组,或为空
|
|
||||||
}
|
|
@ -1,11 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bdledger.api;
|
package bdware.bdledger.api;
|
||||||
|
|
||||||
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
||||||
option java_package = "bdledger.api.grpc.common";
|
option java_package = "org.bdware.bdledger.api.grpc.pb";
|
||||||
option java_outer_classname = "ErrorDetailsProto";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
// InvalidArgument indicates client specified an invalid argument.
|
// InvalidArgument indicates client specified an invalid argument.
|
||||||
// Note that this differs from FailedPrecondition. It indicates arguments
|
// Note that this differs from FailedPrecondition. It indicates arguments
|
@ -1,14 +1,12 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bdledger.api;
|
package bdware.bdledger.api;
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
import "google/protobuf/empty.proto";
|
||||||
import "bdledger/api/common.proto";
|
import "bdware/bdledger/api/common.proto";
|
||||||
|
|
||||||
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
||||||
option java_package = "bdledger.api.grpc.ledger";
|
option java_package = "org.bdware.bdledger.api.grpc.pb";
|
||||||
option java_outer_classname = "LedgerProto";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
service Ledger {
|
service Ledger {
|
||||||
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
|
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
|
@ -1,13 +1,11 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bdledger.api;
|
package bdware.bdledger.api;
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
import "google/protobuf/empty.proto";
|
||||||
|
|
||||||
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
||||||
option java_package = "bdledger.api.grpc.node";
|
option java_package = "org.bdware.bdledger.api.grpc.pb";
|
||||||
option java_outer_classname = "NodeProto";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
service Node {
|
service Node {
|
||||||
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
|
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
|
@ -1,13 +1,11 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bdledger.api;
|
package bdware.bdledger.api;
|
||||||
|
|
||||||
import "bdledger/api/common.proto";
|
import "bdware/bdledger/api/common.proto";
|
||||||
|
|
||||||
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
||||||
option java_package = "bdledger.api.grpc.query";
|
option java_package = "org.bdware.bdledger.api.grpc.pb";
|
||||||
option java_outer_classname = "QueryProto";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
service Query {
|
service Query {
|
||||||
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
|
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
|
Loading…
x
Reference in New Issue
Block a user