change go_package path

Summary: change go_package path

Test Plan: none

Reviewers: nex, wuyi

Reviewed By: nex

Differential Revision: https://phabricator.internetapi.cn/D29
This commit is contained in:
huyingcong 2020-01-08 10:03:39 +08:00
parent c8ff7cd6f7
commit 08f427899c
12 changed files with 103 additions and 103 deletions

View File

@ -1,15 +1,13 @@
syntax = "proto3";
package bdledger.api.common;
package bdledger.api;
option go_package = "bdware.org/bdledger/sdk/api/grpc/common";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.common";
option java_outer_classname = "CommonProto";
option java_multiple_files = true;
message ClientVersionResponse {
string version = 1; //
}
/* 事务类型 */
enum TransactionType {
@ -24,7 +22,7 @@ message Transaction {
bytes block_hash = 1; // `null`
uint32 index = 2; // index`null`
bytes hash = 3; //
common.TransactionType type = 4; //
TransactionType type = 4; //
bytes from = 5; //
uint64 nonce = 6; //
bytes to = 7; // `null`

View File

@ -1,8 +1,8 @@
syntax = "proto3";
package bdledger.api.common;
package bdledger.api;
option go_package = "bdware.org/bdledger/sdk/api/grpc/errdetails";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.common";
option java_outer_classname = "ErrorDetailsProto";
option java_multiple_files = true;

42
bdledger/api/ledger.proto Normal file
View File

@ -0,0 +1,42 @@
syntax = "proto3";
package bdledger.api;
import "google/protobuf/empty.proto";
import "bdledger/api/common.proto";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.ledger";
option java_outer_classname = "LedgerProto";
option java_multiple_files = true;
service TransactionLedger {
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse);
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
}
message CreateLedgerRequest {
string name = 1;
}
message CreateLedgerResponse {
bool ok = 1;
}
message GetLedgersResponse {
repeated string ledgers = 1;
}
message SendTransactionRequest {
string ledger = 1;
message Transaction {
TransactionType type = 1;
bytes from = 2;
bytes to = 3;
bytes data = 4;
}
Transaction transaction = 2;
}
message SendTransactionResponse {
bytes hash = 1;
}

18
bdledger/api/node.proto Normal file
View File

@ -0,0 +1,18 @@
syntax = "proto3";
package bdledger.api;
import "google/protobuf/empty.proto";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.node";
option java_outer_classname = "NodeProto";
option java_multiple_files = true;
service Node {
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
}
message ClientVersionResponse {
string version = 1; //
}

View File

@ -1,12 +1,12 @@
syntax = "proto3";
package bdledger.api.queryservice;
package bdledger.api;
import "bdledger/api/common.proto";
option go_package = "bdware.org/bdledger/sdk/api/grpc/queryservice";
option java_package = "bdledger.api.grpc.queryservice";
option java_outer_classname = "QueryServiceProto";
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
option java_package = "bdledger.api.grpc.query";
option java_outer_classname = "QueryProto";
option java_multiple_files = true;
service Query {
@ -39,7 +39,7 @@ message BlocksRequest {
int64 end_timestamp = 4;
}
message GetBlocksResponse {
repeated common.Block blocks= 1;
repeated Block blocks= 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
@ -54,7 +54,7 @@ message TransactionsRequest {
int64 end_timestamp = 4;
}
message GetTransactionsResponse {
repeated common.Transaction Transactions = 1;
repeated Transaction transactions = 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
@ -68,7 +68,7 @@ message GetBlockByHashRequest {
bool full_transaction = 3;
}
message GetBlockByHashResponse {
common.Block block = 1;
Block block = 1;
}
message GetTransactionByHashRequest {
@ -76,7 +76,7 @@ message GetTransactionByHashRequest {
bytes hash = 2;
}
message GetTransactionByHashResponse {
common.Transaction transaction = 1;
Transaction transaction = 1;
}
message GetTransactionByBlockHashAndIndexRequest {
@ -85,5 +85,5 @@ message GetTransactionByBlockHashAndIndexRequest {
uint32 index = 3;
}
message GetTransactionByBlockHashAndIndexResponse {
common.Transaction transaction = 1;
Transaction transaction = 1;
}

View File

@ -1,62 +0,0 @@
syntax = "proto3";
package bdledger.api.txledger;
import "google/protobuf/empty.proto";
import "bdledger/api/common.proto";
option go_package = "bdware.org/bdledger/sdk/api/grpc/txledger";
option java_package = "bdledger.api.grpc.txledger";
option java_outer_classname = "TransactionLedgerProto";
option java_multiple_files = true;
service TransactionLedger {
rpc ClientVersion (google.protobuf.Empty) returns (common.ClientVersionResponse);
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse);
rpc BlockCount (BlockCountRequest) returns (BlockCountResponse);
rpc GetBlocks (GetBlocksRequest) returns (GetBlocksResponse);
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
}
message CreateLedgerRequest {
string name = 1;
}
message CreateLedgerResponse {
bool ok = 1;
}
message GetLedgersResponse {
repeated string ledgers = 1;
}
message BlockCountRequest {
string ledger = 1;
}
message BlockCountResponse {
uint64 block_count = 1;
}
message GetBlocksRequest {
string ledger = 1;
uint64 from_index = 2;
uint32 count = 3; // Optional, default to 10, max value is 10
bool full_transaction = 4;
}
message GetBlocksResponse {
repeated common.Block blocks = 1;
}
message SendTransactionRequest {
string ledger = 1;
message Transaction {
common.TransactionType type = 1;
bytes from = 2;
bytes to = 3;
bytes data = 4;
}
Transaction transaction = 2;
}
message SendTransactionResponse {
bytes hash = 1;
}

View File

@ -8,7 +8,7 @@ message ClientVersionResponse {
}
```
### common.TransactionType 事务类型
### TransactionType 事务类型
```
enum TransactionType {
@ -30,7 +30,7 @@ message Transaction {
bytes block_hash = 2; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 3; // 事务在区块中的位置index当事务处于待确认状态时为`null`
bytes hash = 4; // 事务的哈希
common.TransactionType type = 5; // 事务类型
TransactionType type = 5; // 事务类型
bytes from = 6; // 发送账户地址
uint64 nonce = 7; // 这条事务之前发送者所发送的事务数量
bytes to = 8; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
@ -186,7 +186,7 @@ message GetLedgersResponse {
message SendTransactionRequest {
string ledger = 1;
message Transaction {
common.TransactionType type = 1;
TransactionType type = 1;
bytes from = 2;
bytes to = 3;
bytes data = 4;

View File

@ -11,7 +11,8 @@ where /q %gen% || echo missing %gen% && exit /B
if not exist %dir% mkdir %dir%
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/common.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/error_details.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/tx_ledger.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/query_service.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/ledger.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/query.proto
%exe% -I . --go_out=plugins=grpc:%dir% bdledger/api/node.proto
echo all done

View File

@ -2,5 +2,6 @@
mkdir -p gen/go
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/common.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/error_details.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/tx_ledger.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/query_service.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/ledger.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/query.proto
protoc -I . --go_out=plugins=grpc:gen/go bdledger/api/node.proto

View File

@ -9,7 +9,8 @@ where /q %gen% || echo missing %gen% && exit /B
if not exist %dir% mkdir %dir%
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/common.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/error_details.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/tx_ledger.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/query_service.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/ledger.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/query.proto
%exe% -I . --js_out=import_style=commonjs:%dir% --grpc-web_out=import_style=commonjs,mode=grpcwebtext:%dir% bdledger/api/node.proto
echo all done

View File

@ -3,5 +3,6 @@ dir=gen/web
mkdir -p $dir
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/common.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/error_details.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/tx_ledger.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/query_service.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/ledger.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/query.proto
protoc -I . --js_out=import_style=commonjs:$dir --grpc-web_out=import_style=commonjs,mode=grpcwebtext:$dir bdledger/api/node.proto

26
test.md
View File

@ -10,7 +10,7 @@ message ClientVersionResponse {
}
```
### common.TransactionType
### TransactionType
```proto
enum TransactionType {
@ -29,7 +29,7 @@ message Transaction {
bytes block_hash = 1; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 2; // 事务在区块中的位置 index当事务处于待确认状态时为`null`
bytes hash = 3; // 事务的哈希
common.TransactionType type = 4; // 事务类型
TransactionType type = 4; // 事务类型
bytes from = 5; // 发送账户地址
uint64 nonce = 6; // 这条事务之前发送者所发送的事务数量
bytes to = 7; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
@ -48,7 +48,7 @@ message Transaction {
bytes block_hash = 2; // 事务所在的区块的哈希,当事务处于待确认状态时为`null`
uint32 index = 3; // 事务在区块中的位置index当事务处于待确认状态时为`null`
bytes hash = 4; // 事务的哈希
common.TransactionType type = 5; // 事务类型
TransactionType type = 5; // 事务类型
bytes from = 6; // 发送账户地址
uint64 nonce = 7; // 这条事务之前发送者所发送的事务数量
bytes to = 8; // 接收账户地址,或者调用的合约地址,或者`null`如为合约创建
@ -339,7 +339,7 @@ blocks:
- block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 0
hash: 0x0404040404040404040404040404040404040404 (in bytes)
type: common.TransactionType.RECORD
type: TransactionType.RECORD
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2018
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
@ -350,7 +350,7 @@ blocks:
- block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 1
hash: 0x1313131313131313131313131313131313131313 (in bytes)
type: common.TransactionType.MESSAGE
type: TransactionType.MESSAGE
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2019
to: 0xfeedbabefeedbabefeedbabefeedbabefeedbabe (in bytes)
@ -556,7 +556,7 @@ blocks:
message SendTransactionRequest {
string ledger = 1;
message Transaction {
common.TransactionType type = 1;
TransactionType type = 1;
bytes from = 2;
bytes to = 3;
bytes data = 4;
@ -582,7 +582,7 @@ message SendTransactionResponse {
```yaml
ledger: 'test'
transaction:
type: common.TransactionType.MESSAGE
type: TransactionType.MESSAGE
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
to: 0xfeedbabefeedbabefeedbabefeedbabefeedbabe (in bytes)
data: 0xdeadbeef (in bytes)
@ -601,7 +601,7 @@ hash: 0xd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5edd15ea5ed (in byt
```yaml
ledger: 'test'
transaction:
type: common.TransactionType.MESSAGE
type: TransactionType.MESSAGE
from: null (in bytes)
to: 0x50bada55 (in bytes)
data: null (in bytes)
@ -764,7 +764,7 @@ transactions:
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 0
hash: 0x0404040404040404040404040404040404040404 (in bytes)
type: common.TransactionType.RECORD
type: TransactionType.RECORD
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2018
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
@ -776,7 +776,7 @@ transactions:
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 1
hash: 0x1313131313131313131313131313131313131313 (in bytes)
type: common.TransactionType.MESSAGE
type: TransactionType.MESSAGE
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2019
to: 0xfeedbabefeedbabefeedbabefeedbabefeedbabe (in bytes)
@ -914,7 +914,7 @@ block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 0
hash: 0x0404040404040404040404040404040404040404 (in bytes)
type: common.TransactionType.RECORD
type: TransactionType.RECORD
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2018
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
@ -963,7 +963,7 @@ block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 0
hash: 0x0404040404040404040404040404040404040404 (in bytes)
type: common.TransactionType.RECORD
type: TransactionType.RECORD
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2018
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
@ -1012,7 +1012,7 @@ block_number: 2018
block_hash: 0xdeadc0dedeadc0dedeadc0dedeadc0dedeadc0de (in bytes)
index: 0
hash: 0x0404040404040404040404040404040404040404 (in bytes)
type: common.TransactionType.RECORD
type: TransactionType.RECORD
from: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)
nonce: 2018
to: 0xf00dcafef00dcafef00dcafef00dcafef00dcafe (in bytes)