Package org.bdware.bdledger.api.grpc
Class Client
java.lang.Object
org.bdware.bdledger.api.grpc.Client
事务账本客户端
如有更灵活的需求可直接使用LedgerGrpc
类。
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<NodeProto.ClientVersionResponse>
查询BDLedger节点版本 (非阻塞)查询BDLedger节点版本 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.CountBlocksResponse>
countBlocks
(String ledger) 返回账本中的区块数量 (非阻塞)countBlocksSync
(String ledger) 返回账本中的区块数量 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.CountTransactionsResponse>
countTransactions
(String ledger) 返回账本中的事务数量 (非阻塞)countTransactionsSync
(String ledger) 返回账本中的事务数量 (阻塞)com.google.common.util.concurrent.ListenableFuture<LedgerProto.CreateLedgerResponse>
createLedger
(String name) 创建账本 (非阻塞)createLedgerSync
(String name) 创建账本 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlockByHashResponse>
getBlockByHash
(String ledger, String hash, boolean fullTransactions) 返回哈希所指定的区块 (非阻塞)getBlockByHashSync
(String ledger, String hash, boolean fullTransactions) 返回哈希所指定的区块 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse>
getBlocks
(String ledger, long startUnixTime, long endUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse>
getBlocks
(String ledger, long startUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse>
getBlocks
(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse>
getBlocks
(String ledger, ZonedDateTime startDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞)getBlocksSync
(String ledger, long startUnixTime, long endUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞)getBlocksSync
(String ledger, long startUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞)getBlocksSync
(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞)getBlocksSync
(String ledger, ZonedDateTime startDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞)com.google.common.util.concurrent.ListenableFuture<LedgerProto.GetLedgersResponse>
返回账本列表 (非阻塞)返回账本列表 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse>
getRecentBlocks
(String ledger, int count, QueryProto.IncludeTransactions includeTransactions) 返回时间戳最新的若干区块 (非阻塞)getRecentBlocksSync
(String ledger, int count, QueryProto.IncludeTransactions includeTransactions) 返回时间戳最新的若干区块 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionByBlockHashAndIndexResponse>
getTransactionByBlockHashAndIndex
(String ledger, String blockHash, int index) 返回区块的哈希与事务的index所指定的事务 (非阻塞)getTransactionByBlockHashAndIndexSync
(String ledger, String blockHash, int index) com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionByHashResponse>
getTransactionByHash
(String ledger, String hash) 返回哈希所指定的事务 (非阻塞)getTransactionByHashSync
(String ledger, String hash) 返回哈希所指定的事务 (阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse>
getTransactions
(String ledger, long startUnixTime) 返回时间范围内的事务 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse>
getTransactions
(String ledger, long startUnixTime, long endUnixTime) 返回时间范围内的事务 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse>
getTransactions
(String ledger, ZonedDateTime startDateTime) 返回时间范围内的事务 (非阻塞)com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse>
getTransactions
(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime) 返回时间范围内的事务 (非阻塞)getTransactionsSync
(String ledger, long startUnixTime) 返回时间范围内的事务 (阻塞)getTransactionsSync
(String ledger, long startUnixTime, long endUnixTime) 返回时间范围内的事务 (阻塞)getTransactionsSync
(String ledger, ZonedDateTime startDateTime) 返回时间范围内的事务 (阻塞)getTransactionsSync
(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime) 返回时间范围内的事务 (阻塞)com.google.common.util.concurrent.ListenableFuture<LedgerProto.SendTransactionResponse>
sendTransaction
(String ledger, CommonProto.TransactionType type, String from, long nonce, String to, byte[] data) 发送新事务 (非阻塞)sendTransactionSync
(String ledger, CommonProto.TransactionType type, String from, long nonce, String to, byte[] data) 发送新事务 (阻塞)void
shutdown()
关闭客户端的网络连接。
-
Constructor Details
-
Client
构造客户端来向host:port
BDLedger节点发请求。 -
Client
构造客户端,使用token
作access token来向host:port
BDLedger节点发请求。 -
Client
用已有的Channel
对象构造客户端来向BDLedger节点发请求。
-
-
Method Details
-
shutdown
关闭客户端的网络连接。- Throws:
InterruptedException
-
clientVersion
public com.google.common.util.concurrent.ListenableFuture<NodeProto.ClientVersionResponse> clientVersion()查询BDLedger节点版本 (非阻塞) -
clientVersionSync
查询BDLedger节点版本 (阻塞) -
createLedger
public com.google.common.util.concurrent.ListenableFuture<LedgerProto.CreateLedgerResponse> createLedger(String name) 创建账本 (非阻塞) -
createLedgerSync
创建账本 (阻塞) -
getLedgers
public com.google.common.util.concurrent.ListenableFuture<LedgerProto.GetLedgersResponse> getLedgers()返回账本列表 (非阻塞) -
getLedgersSync
返回账本列表 (阻塞) -
sendTransaction
public com.google.common.util.concurrent.ListenableFuture<LedgerProto.SendTransactionResponse> sendTransaction(String ledger, CommonProto.TransactionType type, String from, long nonce, String to, byte[] data) 发送新事务 (非阻塞) -
sendTransactionSync
public LedgerProto.SendTransactionResponse sendTransactionSync(String ledger, CommonProto.TransactionType type, String from, long nonce, String to, byte[] data) 发送新事务 (阻塞) -
getBlockByHash
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlockByHashResponse> getBlockByHash(String ledger, String hash, boolean fullTransactions) 返回哈希所指定的区块 (非阻塞) -
getBlockByHashSync
public QueryProto.GetBlockByHashResponse getBlockByHashSync(String ledger, String hash, boolean fullTransactions) 返回哈希所指定的区块 (阻塞) -
getBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse> getBlocks(String ledger, ZonedDateTime startDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞) -
getBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse> getBlocks(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞) -
getBlocksSync
public QueryProto.GetBlocksResponse getBlocksSync(String ledger, ZonedDateTime startDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞) -
getBlocksSync
public QueryProto.GetBlocksResponse getBlocksSync(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞) -
getBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse> getBlocks(String ledger, long startUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞) -
getBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse> getBlocks(String ledger, long startUnixTime, long endUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (非阻塞) -
getBlocksSync
public QueryProto.GetBlocksResponse getBlocksSync(String ledger, long startUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞) -
getBlocksSync
public QueryProto.GetBlocksResponse getBlocksSync(String ledger, long startUnixTime, long endUnixTime, QueryProto.IncludeTransactions includeTransactions) 返回时间范围内的区块 (阻塞) -
countBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.CountBlocksResponse> countBlocks(String ledger) 返回账本中的区块数量 (非阻塞) -
countBlocksSync
返回账本中的区块数量 (阻塞) -
getRecentBlocks
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetBlocksResponse> getRecentBlocks(String ledger, int count, QueryProto.IncludeTransactions includeTransactions) 返回时间戳最新的若干区块 (非阻塞) -
getRecentBlocksSync
public QueryProto.GetBlocksResponse getRecentBlocksSync(String ledger, int count, QueryProto.IncludeTransactions includeTransactions) 返回时间戳最新的若干区块 (阻塞) -
getTransactionByHash
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionByHashResponse> getTransactionByHash(String ledger, String hash) 返回哈希所指定的事务 (非阻塞) -
getTransactionByHashSync
返回哈希所指定的事务 (阻塞) -
getTransactionByBlockHashAndIndex
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionByBlockHashAndIndexResponse> getTransactionByBlockHashAndIndex(String ledger, String blockHash, int index) 返回区块的哈希与事务的index所指定的事务 (非阻塞) -
getTransactionByBlockHashAndIndexSync
public QueryProto.GetTransactionByBlockHashAndIndexResponse getTransactionByBlockHashAndIndexSync(String ledger, String blockHash, int index) -
getTransactions
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse> getTransactions(String ledger, ZonedDateTime startDateTime) 返回时间范围内的事务 (非阻塞) -
getTransactions
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse> getTransactions(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime) 返回时间范围内的事务 (非阻塞) -
getTransactionsSync
public QueryProto.GetTransactionsResponse getTransactionsSync(String ledger, ZonedDateTime startDateTime) 返回时间范围内的事务 (阻塞) -
getTransactionsSync
public QueryProto.GetTransactionsResponse getTransactionsSync(String ledger, ZonedDateTime startDateTime, ZonedDateTime endDateTime) 返回时间范围内的事务 (阻塞) -
getTransactions
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse> getTransactions(String ledger, long startUnixTime) 返回时间范围内的事务 (非阻塞) -
getTransactions
public com.google.common.util.concurrent.ListenableFuture<QueryProto.GetTransactionsResponse> getTransactions(String ledger, long startUnixTime, long endUnixTime) 返回时间范围内的事务 (非阻塞) -
getTransactionsSync
返回时间范围内的事务 (阻塞) -
getTransactionsSync
public QueryProto.GetTransactionsResponse getTransactionsSync(String ledger, long startUnixTime, long endUnixTime) 返回时间范围内的事务 (阻塞) -
countTransactions
public com.google.common.util.concurrent.ListenableFuture<QueryProto.CountTransactionsResponse> countTransactions(String ledger) 返回账本中的事务数量 (非阻塞) -
countTransactionsSync
返回账本中的事务数量 (阻塞)
-