Skip to content

Commit 4dcc6e7

Browse files
committed
add ledger query APIs
This commits adds the following four gRPC APIs rpc GetLedgerInfo(google.protobuf.Empty) returns (common.BlockchainInfo); rpc GetBlockByNumber(BlockNumber) returns (common.Block); rpc GetBlockByTxID(TxID) returns (common.Block); rpc GetTxByID(TxID) returns (common.Envelope); to be exposed by the sidecar to allow endorser/fsc to query block or tx envelope from the ledger store. Signed-off-by: Senthilnathan <cendhu@gmail.com>
1 parent 176bf35 commit 4dcc6e7

File tree

4 files changed

+474
-0
lines changed

4 files changed

+474
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ proto: FORCE $(PROTOS_SENTINEL)
119119
-I="${PROTOS_DIR}" \
120120
--go_opt=Mmsp/msp_config.proto=github.com/hyperledger/fabric-protos-go-apiv2/msp \
121121
--go-grpc_opt=Mmsp/msp_config.proto=github.com/hyperledger/fabric-protos-go-apiv2/msp \
122+
--go_opt=Mcommon/common.proto=github.com/hyperledger/fabric-protos-go-apiv2/common \
123+
--go_opt=Mcommon/ledger.proto=github.com/hyperledger/fabric-protos-go-apiv2/common \
124+
--go-grpc_opt=Mcommon/common.proto=github.com/hyperledger/fabric-protos-go-apiv2/common \
125+
--go-grpc_opt=Mcommon/ledger.proto=github.com/hyperledger/fabric-protos-go-apiv2/common \
122126
--go-grpc_out=. \
123127
--go-grpc_opt=paths=source_relative \
124128
--go_out=paths=source_relative:. \

api/committerpb/ledger.pb.go

Lines changed: 193 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/committerpb/ledger.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
syntax = "proto3";
8+
9+
option go_package = "github.com/hyperledger/fabric-x-common/api/committerpb";
10+
11+
package committerpb;
12+
13+
import "google/protobuf/empty.proto";
14+
import "common/common.proto";
15+
import "common/ledger.proto";
16+
17+
// LedgerService provides read-only access to the block store ledger.
18+
service LedgerService {
19+
rpc GetLedgerInfo(google.protobuf.Empty) returns (common.BlockchainInfo);
20+
rpc GetBlockByNumber(BlockNumber) returns (common.Block);
21+
rpc GetBlockByTxID(TxID) returns (common.Block);
22+
rpc GetTxByID(TxID) returns (common.Envelope);
23+
}
24+
25+
message BlockNumber {
26+
uint64 number = 1;
27+
}
28+
29+
message TxID {
30+
string tx_id = 1;
31+
}

0 commit comments

Comments
 (0)