diff --git a/src/main/java/bdledger/api/Client.java b/src/main/java/bdledger/api/Client.java index 764d193..74979ca 100644 --- a/src/main/java/bdledger/api/Client.java +++ b/src/main/java/bdledger/api/Client.java @@ -2,7 +2,7 @@ package bdledger.api; import bdledger.api.grpc.common.Block; import bdledger.api.grpc.common.Transaction; -import bdledger.api.grpc.node .ClientVersionResponse; +import bdledger.api.grpc.node.ClientVersionResponse; import bdledger.api.grpc.common.TransactionType; import bdledger.api.grpc.ledger.*; import bdledger.api.grpc.node.NodeGrpc; @@ -23,8 +23,8 @@ import java.util.logging.Logger; * *

如有更灵活的需求可直接使用{@link bdledger.api.grpc.ledger.TransactionLedgerGrpc}类。 * - * @see 事务账本API * @author nex + * @see 事务账本API */ public class Client { @@ -38,12 +38,16 @@ public class Client { private final QueryGrpc.QueryFutureStub queryFutureStub; private final QueryGrpc.QueryBlockingStub queryBlockingStub; - /** 构造客户端来访问{@code host:port}的事务账本服务。 */ + /** + * 构造客户端来访问{@code host:port}的事务账本服务。 + */ public Client(String host, int port) { this(ManagedChannelBuilder.forAddress(host, port).usePlaintext()); } - /** 用已有的{@link io.grpc.Channel}对象构造客户端来访问事务账本服务。 */ + /** + * 用已有的{@link io.grpc.Channel}对象构造客户端来访问事务账本服务。 + */ public Client(ManagedChannelBuilder channelBuilder) { channel = channelBuilder.build(); nodeFutureStub = NodeGrpc.newFutureStub(channel); @@ -54,14 +58,16 @@ public class Client { queryBlockingStub = QueryGrpc.newBlockingStub(channel); } - /** 关闭客户端的网络连接。 */ + /** + * 关闭客户端的网络连接。 + */ public void shutdown() throws InterruptedException { channel.shutdown().awaitTermination(5, TimeUnit.SECONDS); } /** * 查询节点客户端版本 + * href="#">查询BDLedger节点版本 * (非阻塞) */ public ListenableFuture clientVersion() { @@ -78,7 +84,7 @@ public class Client { /** * 查询节点客户端版本 + * href="#">查询BDLedger节点版本 * (阻塞) */ public ClientVersionResponse clientVersionSync() { @@ -94,7 +100,7 @@ public class Client { } /** - * 创建账本 + * 创建账本 * (非阻塞) */ public ListenableFuture createLedger(String name) { @@ -110,7 +116,7 @@ public class Client { } /** - * 创建账本 + * 创建账本 * (阻塞) */ public CreateLedgerResponse createLedgerSync(String name) { @@ -130,7 +136,7 @@ public class Client { } /** - * 返回账本列表 + * 返回账本列表 * (非阻塞) */ public ListenableFuture getLedgers() { @@ -146,7 +152,7 @@ public class Client { } /** - * 返回账本列表 + * 返回账本列表 * (阻塞) */ public GetLedgersResponse getLedgersSync() { @@ -163,11 +169,11 @@ public class Client { /** * 发送新事务 + * href="#">发送新事务 * (非阻塞) */ public ListenableFuture sendTransaction( - String ledger, TransactionType type, String from, String to, byte[] data) { + String ledger, TransactionType type, String from, String to, byte[] data) { info( "*** sendTransaction: ledger={0} type={1} from={2} to={3} data={4}", @@ -183,7 +189,7 @@ public class Client { /** * 发送新事务 + * href="#">发送新事务 * (阻塞) */ public SendTransactionResponse sendTransactionSync( @@ -221,10 +227,61 @@ public class Client { /** * 返回最新区块的区块号 + * href="#">返回哈希所指定区块的信息 * (非阻塞) */ - public ListenableFuture blockNumber(String ledger) { + public ListenableFuture getBlockByHash( + String ledger, String hash, boolean fullTransactions) { + + info( + "*** getBlockByHash: ledger={0} hash={1} fullTransactions={2}", + ledger, hash, fullTransactions); + + try { + return queryFutureStub.getBlockByHash(getBlockByHashRequest(ledger, hash, fullTransactions)); + } catch (StatusRuntimeException e) { + warning("RPC failed: {0}", e.getStatus()); + return null; + } + } + + /** + * 返回哈希所指定区块的信息 + * (阻塞) + */ + public GetBlockByHashResponse getBlockByHashSync(String ledger, String hash, boolean fullTransactions) { + + info( + "*** getBlockByHashSync: ledger={0} hash={1} fullTransactions={2}", + ledger, hash, fullTransactions); + + try { + return queryBlockingStub.getBlockByHash(getBlockByHashRequest(ledger, hash, fullTransactions)); + } catch (StatusRuntimeException e) { + warning("RPC failed: {0}", e.getStatus()); + return null; + } + } + + private GetBlockByHashRequest getBlockByHashRequest( + String ledger, String hash, boolean fullTransactions) { + + GetBlockByHashRequest.Builder reqBuilder = + GetBlockByHashRequest.newBuilder().setLedger(ledger).setFullTransactions(fullTransactions); + if (hash != null) { + reqBuilder.setHash(ByteString.copyFrom(Utils.hexStringToByteArray(hash))); + } + + return reqBuilder.build(); + } + + /** + * 返回全网区块的数量 + * (非阻塞) + */ + public ListenableFuture countBlocks(String ledger) { info("*** blockNumber: ledger={0}", ledger); @@ -238,10 +295,10 @@ public class Client { /** * 返回最新区块的区块号 + * href="#">返回全网区块的数量 * (阻塞) */ - public CountBlocksResponse blockNumberSync(String ledger) { + public CountBlocksResponse countBlocksSync(String ledger) { info("*** blockNumberSync: ledger={0}", ledger); @@ -259,58 +316,7 @@ public class Client { /** * 返回哈希所指定区块的信息 - * (非阻塞) - */ - public ListenableFuture getBlockByHash( - String ledger, String hash, boolean fullTransaction) { - - info( - "*** getBlockByHash: ledger={0} hash={1} fullTransaction={2}", - ledger, hash, fullTransaction); - - try { - return queryFutureStub.getBlockByHash(getBlockByHashRequest(ledger, hash, fullTransaction)); - } catch (StatusRuntimeException e) { - warning("RPC failed: {0}", e.getStatus()); - return null; - } - } - - /** - * 返回哈希所指定区块的信息 - * (阻塞) - */ - public GetBlockByHashResponse getBlockByHashSync(String ledger, String hash, boolean fullTransaction) { - - info( - "*** getBlockByHashSync: ledger={0} hash={1} fullTransaction={2}", - ledger, hash, fullTransaction); - - try { - return queryBlockingStub.getBlockByHash(getBlockByHashRequest(ledger, hash, fullTransaction)); - } catch (StatusRuntimeException e) { - warning("RPC failed: {0}", e.getStatus()); - return null; - } - } - - private GetBlockByHashRequest getBlockByHashRequest( - String ledger, String hash, boolean fullTransaction) { - - GetBlockByHashRequest.Builder reqBuilder = - GetBlockByHashRequest.newBuilder().setLedger(ledger).setFullTransaction(fullTransaction); - if (hash != null) { - reqBuilder.setHash(ByteString.copyFrom(Utils.hexStringToByteArray(hash))); - } - - return reqBuilder.build(); - } - - /** - * 返回哈希所指定事务的信息 + * href="#">返回哈希所指定事务的信息 * (非阻塞) */ public ListenableFuture getTransactionByHash(String ledger, String hash) { @@ -327,7 +333,7 @@ public class Client { /** * 返回哈希所指定事务的信息 + * href="#">返回哈希所指定事务的信息 * (阻塞) */ public GetTransactionByHashResponse getTransactionByHashSync(String ledger, String hash) { @@ -345,7 +351,7 @@ public class Client { private GetTransactionByHashRequest getTransactionByHashRequest(String ledger, String hash) { GetTransactionByHashRequest.Builder reqBuilder = - GetTransactionByHashRequest.newBuilder().setLedger(ledger); + GetTransactionByHashRequest.newBuilder().setLedger(ledger); if (hash != null) { reqBuilder.setHash(ByteString.copyFrom(Utils.hexStringToByteArray(hash))); } @@ -355,19 +361,19 @@ public class Client { /** * 返回区块的哈希与事务的index所指定事务的信息 + * href="#">返回区块的哈希与事务的index所指定事务的信息 * (非阻塞) */ public ListenableFuture getTransactionByBlockHashAndIndex( - String ledger, String block_hash, int index) { + String ledger, String blockHash, int index) { info( - "*** getTransactionByBlockHashAndIndex: ledger={0} block_hash={1} index={2}", - ledger, block_hash, index); + "*** getTransactionByBlockHashAndIndex: ledger={0} blockHash={1} index={2}", + ledger, blockHash, index); try { return queryFutureStub.getTransactionByBlockHashAndIndex( - getTransactionByBlockHashAndIndexRequest(ledger, block_hash, index)); + getTransactionByBlockHashAndIndexRequest(ledger, blockHash, index)); } catch (StatusRuntimeException e) { warning("RPC failed: {0}", e.getStatus()); return null; @@ -376,19 +382,19 @@ public class Client { /** * 返回区块的哈希与事务的index所指定事务的信息 + * href="#">返回区块的哈希与事务的index所指定事务的信息 * (阻塞) */ public GetTransactionByBlockHashAndIndexResponse getTransactionByBlockHashAndIndexSync( - String ledger, String block_hash, int index) { + String ledger, String blockHash, int index) { info( - "*** getTransactionByBlockHashAndIndexSync: ledger={0} block_hash={1} index={2}", - ledger, block_hash, index); + "*** getTransactionByBlockHashAndIndexSync: ledger={0} blockHash={1} index={2}", + ledger, blockHash, index); try { return queryBlockingStub.getTransactionByBlockHashAndIndex( - getTransactionByBlockHashAndIndexRequest(ledger, block_hash, index)); + getTransactionByBlockHashAndIndexRequest(ledger, blockHash, index)); } catch (StatusRuntimeException e) { warning("RPC failed: {0}", e.getStatus()); return null; @@ -396,13 +402,13 @@ public class Client { } private GetTransactionByBlockHashAndIndexRequest getTransactionByBlockHashAndIndexRequest( - String ledger, String block_hash, int index) { + String ledger, String blockHash, int index) { GetTransactionByBlockHashAndIndexRequest.Builder reqBuilder = - GetTransactionByBlockHashAndIndexRequest.newBuilder().setLedger(ledger).setIndex(index); + GetTransactionByBlockHashAndIndexRequest.newBuilder().setLedger(ledger).setIndex(index); - if (block_hash != null) { - reqBuilder.setBlockHash(ByteString.copyFrom(Utils.hexStringToByteArray(block_hash))); + if (blockHash != null) { + reqBuilder.setBlockHash(ByteString.copyFrom(Utils.hexStringToByteArray(blockHash))); } return reqBuilder.build(); diff --git a/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequest.java b/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequest.java index 7ac0d7d..7cf0f50 100644 --- a/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequest.java +++ b/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequest.java @@ -63,7 +63,7 @@ private static final long serialVersionUID = 0L; } case 24: { - fullTransaction_ = input.readBool(); + fullTransactions_ = input.readBool(); break; } default: { @@ -144,14 +144,14 @@ private static final long serialVersionUID = 0L; return hash_; } - public static final int FULL_TRANSACTION_FIELD_NUMBER = 3; - private boolean fullTransaction_; + public static final int FULL_TRANSACTIONS_FIELD_NUMBER = 3; + private boolean fullTransactions_; /** - * bool full_transaction = 3; - * @return The fullTransaction. + * bool full_transactions = 3; + * @return The fullTransactions. */ - public boolean getFullTransaction() { - return fullTransaction_; + public boolean getFullTransactions() { + return fullTransactions_; } private byte memoizedIsInitialized = -1; @@ -174,8 +174,8 @@ private static final long serialVersionUID = 0L; if (!hash_.isEmpty()) { output.writeBytes(2, hash_); } - if (fullTransaction_ != false) { - output.writeBool(3, fullTransaction_); + if (fullTransactions_ != false) { + output.writeBool(3, fullTransactions_); } unknownFields.writeTo(output); } @@ -193,9 +193,9 @@ private static final long serialVersionUID = 0L; size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, hash_); } - if (fullTransaction_ != false) { + if (fullTransactions_ != false) { size += com.google.protobuf.CodedOutputStream - .computeBoolSize(3, fullTransaction_); + .computeBoolSize(3, fullTransactions_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -216,8 +216,8 @@ private static final long serialVersionUID = 0L; .equals(other.getLedger())) return false; if (!getHash() .equals(other.getHash())) return false; - if (getFullTransaction() - != other.getFullTransaction()) return false; + if (getFullTransactions() + != other.getFullTransactions()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -233,9 +233,9 @@ private static final long serialVersionUID = 0L; hash = (53 * hash) + getLedger().hashCode(); hash = (37 * hash) + HASH_FIELD_NUMBER; hash = (53 * hash) + getHash().hashCode(); - hash = (37 * hash) + FULL_TRANSACTION_FIELD_NUMBER; + hash = (37 * hash) + FULL_TRANSACTIONS_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( - getFullTransaction()); + getFullTransactions()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -373,7 +373,7 @@ private static final long serialVersionUID = 0L; hash_ = com.google.protobuf.ByteString.EMPTY; - fullTransaction_ = false; + fullTransactions_ = false; return this; } @@ -403,7 +403,7 @@ private static final long serialVersionUID = 0L; bdledger.api.grpc.query.GetBlockByHashRequest result = new bdledger.api.grpc.query.GetBlockByHashRequest(this); result.ledger_ = ledger_; result.hash_ = hash_; - result.fullTransaction_ = fullTransaction_; + result.fullTransactions_ = fullTransactions_; onBuilt(); return result; } @@ -459,8 +459,8 @@ private static final long serialVersionUID = 0L; if (other.getHash() != com.google.protobuf.ByteString.EMPTY) { setHash(other.getHash()); } - if (other.getFullTransaction() != false) { - setFullTransaction(other.getFullTransaction()); + if (other.getFullTransactions() != false) { + setFullTransactions(other.getFullTransactions()); } this.mergeUnknownFields(other.unknownFields); onChanged(); @@ -600,32 +600,32 @@ private static final long serialVersionUID = 0L; return this; } - private boolean fullTransaction_ ; + private boolean fullTransactions_ ; /** - * bool full_transaction = 3; - * @return The fullTransaction. + * bool full_transactions = 3; + * @return The fullTransactions. */ - public boolean getFullTransaction() { - return fullTransaction_; + public boolean getFullTransactions() { + return fullTransactions_; } /** - * bool full_transaction = 3; - * @param value The fullTransaction to set. + * bool full_transactions = 3; + * @param value The fullTransactions to set. * @return This builder for chaining. */ - public Builder setFullTransaction(boolean value) { + public Builder setFullTransactions(boolean value) { - fullTransaction_ = value; + fullTransactions_ = value; onChanged(); return this; } /** - * bool full_transaction = 3; + * bool full_transactions = 3; * @return This builder for chaining. */ - public Builder clearFullTransaction() { + public Builder clearFullTransactions() { - fullTransaction_ = false; + fullTransactions_ = false; onChanged(); return this; } diff --git a/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequestOrBuilder.java b/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequestOrBuilder.java index 49d6924..38cdb13 100644 --- a/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequestOrBuilder.java +++ b/src/main/java/bdledger/api/grpc/query/GetBlockByHashRequestOrBuilder.java @@ -26,8 +26,8 @@ public interface GetBlockByHashRequestOrBuilder extends com.google.protobuf.ByteString getHash(); /** - * bool full_transaction = 3; - * @return The fullTransaction. + * bool full_transactions = 3; + * @return The fullTransactions. */ - boolean getFullTransaction(); + boolean getFullTransactions(); } diff --git a/src/main/java/bdledger/api/grpc/query/QueryGrpc.java b/src/main/java/bdledger/api/grpc/query/QueryGrpc.java index 0ffde6e..05a1074 100644 --- a/src/main/java/bdledger/api/grpc/query/QueryGrpc.java +++ b/src/main/java/bdledger/api/grpc/query/QueryGrpc.java @@ -27,6 +27,37 @@ public final class QueryGrpc { public static final String SERVICE_NAME = "bdledger.api.Query"; // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor getGetBlockByHashMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetBlockByHash", + requestType = bdledger.api.grpc.query.GetBlockByHashRequest.class, + responseType = bdledger.api.grpc.query.GetBlockByHashResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetBlockByHashMethod() { + io.grpc.MethodDescriptor getGetBlockByHashMethod; + if ((getGetBlockByHashMethod = QueryGrpc.getGetBlockByHashMethod) == null) { + synchronized (QueryGrpc.class) { + if ((getGetBlockByHashMethod = QueryGrpc.getGetBlockByHashMethod) == null) { + QueryGrpc.getGetBlockByHashMethod = getGetBlockByHashMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBlockByHash")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.GetBlockByHashRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.GetBlockByHashResponse.getDefaultInstance())) + .setSchemaDescriptor(new QueryMethodDescriptorSupplier("GetBlockByHash")) + .build(); + } + } + } + return getGetBlockByHashMethod; + } + private static volatile io.grpc.MethodDescriptor getGetBlocksMethod; @@ -89,99 +120,6 @@ public final class QueryGrpc { return getCountBlocksMethod; } - private static volatile io.grpc.MethodDescriptor getGetTransactionsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "GetTransactions", - requestType = bdledger.api.grpc.query.TransactionsRequest.class, - responseType = bdledger.api.grpc.query.GetTransactionsResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetTransactionsMethod() { - io.grpc.MethodDescriptor getGetTransactionsMethod; - if ((getGetTransactionsMethod = QueryGrpc.getGetTransactionsMethod) == null) { - synchronized (QueryGrpc.class) { - if ((getGetTransactionsMethod = QueryGrpc.getGetTransactionsMethod) == null) { - QueryGrpc.getGetTransactionsMethod = getGetTransactionsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTransactions")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.TransactionsRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.GetTransactionsResponse.getDefaultInstance())) - .setSchemaDescriptor(new QueryMethodDescriptorSupplier("GetTransactions")) - .build(); - } - } - } - return getGetTransactionsMethod; - } - - private static volatile io.grpc.MethodDescriptor getCountTransactionsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "CountTransactions", - requestType = bdledger.api.grpc.query.TransactionsRequest.class, - responseType = bdledger.api.grpc.query.CountTransactionsResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getCountTransactionsMethod() { - io.grpc.MethodDescriptor getCountTransactionsMethod; - if ((getCountTransactionsMethod = QueryGrpc.getCountTransactionsMethod) == null) { - synchronized (QueryGrpc.class) { - if ((getCountTransactionsMethod = QueryGrpc.getCountTransactionsMethod) == null) { - QueryGrpc.getCountTransactionsMethod = getCountTransactionsMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CountTransactions")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.TransactionsRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.CountTransactionsResponse.getDefaultInstance())) - .setSchemaDescriptor(new QueryMethodDescriptorSupplier("CountTransactions")) - .build(); - } - } - } - return getCountTransactionsMethod; - } - - private static volatile io.grpc.MethodDescriptor getGetBlockByHashMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "GetBlockByHash", - requestType = bdledger.api.grpc.query.GetBlockByHashRequest.class, - responseType = bdledger.api.grpc.query.GetBlockByHashResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor getGetBlockByHashMethod() { - io.grpc.MethodDescriptor getGetBlockByHashMethod; - if ((getGetBlockByHashMethod = QueryGrpc.getGetBlockByHashMethod) == null) { - synchronized (QueryGrpc.class) { - if ((getGetBlockByHashMethod = QueryGrpc.getGetBlockByHashMethod) == null) { - QueryGrpc.getGetBlockByHashMethod = getGetBlockByHashMethod = - io.grpc.MethodDescriptor.newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBlockByHash")) - .setSampledToLocalTracing(true) - .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.GetBlockByHashRequest.getDefaultInstance())) - .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( - bdledger.api.grpc.query.GetBlockByHashResponse.getDefaultInstance())) - .setSchemaDescriptor(new QueryMethodDescriptorSupplier("GetBlockByHash")) - .build(); - } - } - } - return getGetBlockByHashMethod; - } - private static volatile io.grpc.MethodDescriptor getGetTransactionByHashMethod; @@ -244,6 +182,68 @@ public final class QueryGrpc { return getGetTransactionByBlockHashAndIndexMethod; } + private static volatile io.grpc.MethodDescriptor getGetTransactionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTransactions", + requestType = bdledger.api.grpc.query.TransactionsRequest.class, + responseType = bdledger.api.grpc.query.GetTransactionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getGetTransactionsMethod() { + io.grpc.MethodDescriptor getGetTransactionsMethod; + if ((getGetTransactionsMethod = QueryGrpc.getGetTransactionsMethod) == null) { + synchronized (QueryGrpc.class) { + if ((getGetTransactionsMethod = QueryGrpc.getGetTransactionsMethod) == null) { + QueryGrpc.getGetTransactionsMethod = getGetTransactionsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTransactions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.TransactionsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.GetTransactionsResponse.getDefaultInstance())) + .setSchemaDescriptor(new QueryMethodDescriptorSupplier("GetTransactions")) + .build(); + } + } + } + return getGetTransactionsMethod; + } + + private static volatile io.grpc.MethodDescriptor getCountTransactionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CountTransactions", + requestType = bdledger.api.grpc.query.TransactionsRequest.class, + responseType = bdledger.api.grpc.query.CountTransactionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor getCountTransactionsMethod() { + io.grpc.MethodDescriptor getCountTransactionsMethod; + if ((getCountTransactionsMethod = QueryGrpc.getCountTransactionsMethod) == null) { + synchronized (QueryGrpc.class) { + if ((getCountTransactionsMethod = QueryGrpc.getCountTransactionsMethod) == null) { + QueryGrpc.getCountTransactionsMethod = getCountTransactionsMethod = + io.grpc.MethodDescriptor.newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CountTransactions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.TransactionsRequest.getDefaultInstance())) + .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( + bdledger.api.grpc.query.CountTransactionsResponse.getDefaultInstance())) + .setSchemaDescriptor(new QueryMethodDescriptorSupplier("CountTransactions")) + .build(); + } + } + } + return getCountTransactionsMethod; + } + /** * Creates a new async stub that supports all call types for the service */ @@ -292,6 +292,13 @@ public final class QueryGrpc { */ public static abstract class QueryImplBase implements io.grpc.BindableService { + /** + */ + public void getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetBlockByHashMethod(), responseObserver); + } + /** */ public void getBlocks(bdledger.api.grpc.query.BlocksRequest request, @@ -306,27 +313,6 @@ public final class QueryGrpc { asyncUnimplementedUnaryCall(getCountBlocksMethod(), responseObserver); } - /** - */ - public void getTransactions(bdledger.api.grpc.query.TransactionsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetTransactionsMethod(), responseObserver); - } - - /** - */ - public void countTransactions(bdledger.api.grpc.query.TransactionsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getCountTransactionsMethod(), responseObserver); - } - - /** - */ - public void getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnimplementedUnaryCall(getGetBlockByHashMethod(), responseObserver); - } - /** */ public void getTransactionByHash(bdledger.api.grpc.query.GetTransactionByHashRequest request, @@ -341,8 +327,29 @@ public final class QueryGrpc { asyncUnimplementedUnaryCall(getGetTransactionByBlockHashAndIndexMethod(), responseObserver); } + /** + */ + public void getTransactions(bdledger.api.grpc.query.TransactionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetTransactionsMethod(), responseObserver); + } + + /** + */ + public void countTransactions(bdledger.api.grpc.query.TransactionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCountTransactionsMethod(), responseObserver); + } + @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetBlockByHashMethod(), + asyncUnaryCall( + new MethodHandlers< + bdledger.api.grpc.query.GetBlockByHashRequest, + bdledger.api.grpc.query.GetBlockByHashResponse>( + this, METHODID_GET_BLOCK_BY_HASH))) .addMethod( getGetBlocksMethod(), asyncUnaryCall( @@ -357,27 +364,6 @@ public final class QueryGrpc { bdledger.api.grpc.query.BlocksRequest, bdledger.api.grpc.query.CountBlocksResponse>( this, METHODID_COUNT_BLOCKS))) - .addMethod( - getGetTransactionsMethod(), - asyncUnaryCall( - new MethodHandlers< - bdledger.api.grpc.query.TransactionsRequest, - bdledger.api.grpc.query.GetTransactionsResponse>( - this, METHODID_GET_TRANSACTIONS))) - .addMethod( - getCountTransactionsMethod(), - asyncUnaryCall( - new MethodHandlers< - bdledger.api.grpc.query.TransactionsRequest, - bdledger.api.grpc.query.CountTransactionsResponse>( - this, METHODID_COUNT_TRANSACTIONS))) - .addMethod( - getGetBlockByHashMethod(), - asyncUnaryCall( - new MethodHandlers< - bdledger.api.grpc.query.GetBlockByHashRequest, - bdledger.api.grpc.query.GetBlockByHashResponse>( - this, METHODID_GET_BLOCK_BY_HASH))) .addMethod( getGetTransactionByHashMethod(), asyncUnaryCall( @@ -392,6 +378,20 @@ public final class QueryGrpc { bdledger.api.grpc.query.GetTransactionByBlockHashAndIndexRequest, bdledger.api.grpc.query.GetTransactionByBlockHashAndIndexResponse>( this, METHODID_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX))) + .addMethod( + getGetTransactionsMethod(), + asyncUnaryCall( + new MethodHandlers< + bdledger.api.grpc.query.TransactionsRequest, + bdledger.api.grpc.query.GetTransactionsResponse>( + this, METHODID_GET_TRANSACTIONS))) + .addMethod( + getCountTransactionsMethod(), + asyncUnaryCall( + new MethodHandlers< + bdledger.api.grpc.query.TransactionsRequest, + bdledger.api.grpc.query.CountTransactionsResponse>( + this, METHODID_COUNT_TRANSACTIONS))) .build(); } } @@ -410,6 +410,14 @@ public final class QueryGrpc { return new QueryStub(channel, callOptions); } + /** + */ + public void getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetBlockByHashMethod(), getCallOptions()), request, responseObserver); + } + /** */ public void getBlocks(bdledger.api.grpc.query.BlocksRequest request, @@ -426,30 +434,6 @@ public final class QueryGrpc { getChannel().newCall(getCountBlocksMethod(), getCallOptions()), request, responseObserver); } - /** - */ - public void getTransactions(bdledger.api.grpc.query.TransactionsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( - getChannel().newCall(getGetTransactionsMethod(), getCallOptions()), request, responseObserver); - } - - /** - */ - public void countTransactions(bdledger.api.grpc.query.TransactionsRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( - getChannel().newCall(getCountTransactionsMethod(), getCallOptions()), request, responseObserver); - } - - /** - */ - public void getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request, - io.grpc.stub.StreamObserver responseObserver) { - asyncUnaryCall( - getChannel().newCall(getGetBlockByHashMethod(), getCallOptions()), request, responseObserver); - } - /** */ public void getTransactionByHash(bdledger.api.grpc.query.GetTransactionByHashRequest request, @@ -465,6 +449,22 @@ public final class QueryGrpc { asyncUnaryCall( getChannel().newCall(getGetTransactionByBlockHashAndIndexMethod(), getCallOptions()), request, responseObserver); } + + /** + */ + public void getTransactions(bdledger.api.grpc.query.TransactionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetTransactionsMethod(), getCallOptions()), request, responseObserver); + } + + /** + */ + public void countTransactions(bdledger.api.grpc.query.TransactionsRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCountTransactionsMethod(), getCallOptions()), request, responseObserver); + } } /** @@ -481,6 +481,13 @@ public final class QueryGrpc { return new QueryBlockingStub(channel, callOptions); } + /** + */ + public bdledger.api.grpc.query.GetBlockByHashResponse getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request) { + return blockingUnaryCall( + getChannel(), getGetBlockByHashMethod(), getCallOptions(), request); + } + /** */ public bdledger.api.grpc.query.GetBlocksResponse getBlocks(bdledger.api.grpc.query.BlocksRequest request) { @@ -495,27 +502,6 @@ public final class QueryGrpc { getChannel(), getCountBlocksMethod(), getCallOptions(), request); } - /** - */ - public bdledger.api.grpc.query.GetTransactionsResponse getTransactions(bdledger.api.grpc.query.TransactionsRequest request) { - return blockingUnaryCall( - getChannel(), getGetTransactionsMethod(), getCallOptions(), request); - } - - /** - */ - public bdledger.api.grpc.query.CountTransactionsResponse countTransactions(bdledger.api.grpc.query.TransactionsRequest request) { - return blockingUnaryCall( - getChannel(), getCountTransactionsMethod(), getCallOptions(), request); - } - - /** - */ - public bdledger.api.grpc.query.GetBlockByHashResponse getBlockByHash(bdledger.api.grpc.query.GetBlockByHashRequest request) { - return blockingUnaryCall( - getChannel(), getGetBlockByHashMethod(), getCallOptions(), request); - } - /** */ public bdledger.api.grpc.query.GetTransactionByHashResponse getTransactionByHash(bdledger.api.grpc.query.GetTransactionByHashRequest request) { @@ -529,6 +515,20 @@ public final class QueryGrpc { return blockingUnaryCall( getChannel(), getGetTransactionByBlockHashAndIndexMethod(), getCallOptions(), request); } + + /** + */ + public bdledger.api.grpc.query.GetTransactionsResponse getTransactions(bdledger.api.grpc.query.TransactionsRequest request) { + return blockingUnaryCall( + getChannel(), getGetTransactionsMethod(), getCallOptions(), request); + } + + /** + */ + public bdledger.api.grpc.query.CountTransactionsResponse countTransactions(bdledger.api.grpc.query.TransactionsRequest request) { + return blockingUnaryCall( + getChannel(), getCountTransactionsMethod(), getCallOptions(), request); + } } /** @@ -545,6 +545,14 @@ public final class QueryGrpc { return new QueryFutureStub(channel, callOptions); } + /** + */ + public com.google.common.util.concurrent.ListenableFuture getBlockByHash( + bdledger.api.grpc.query.GetBlockByHashRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetBlockByHashMethod(), getCallOptions()), request); + } + /** */ public com.google.common.util.concurrent.ListenableFuture getBlocks( @@ -561,30 +569,6 @@ public final class QueryGrpc { getChannel().newCall(getCountBlocksMethod(), getCallOptions()), request); } - /** - */ - public com.google.common.util.concurrent.ListenableFuture getTransactions( - bdledger.api.grpc.query.TransactionsRequest request) { - return futureUnaryCall( - getChannel().newCall(getGetTransactionsMethod(), getCallOptions()), request); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture countTransactions( - bdledger.api.grpc.query.TransactionsRequest request) { - return futureUnaryCall( - getChannel().newCall(getCountTransactionsMethod(), getCallOptions()), request); - } - - /** - */ - public com.google.common.util.concurrent.ListenableFuture getBlockByHash( - bdledger.api.grpc.query.GetBlockByHashRequest request) { - return futureUnaryCall( - getChannel().newCall(getGetBlockByHashMethod(), getCallOptions()), request); - } - /** */ public com.google.common.util.concurrent.ListenableFuture getTransactionByHash( @@ -600,15 +584,31 @@ public final class QueryGrpc { return futureUnaryCall( getChannel().newCall(getGetTransactionByBlockHashAndIndexMethod(), getCallOptions()), request); } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture getTransactions( + bdledger.api.grpc.query.TransactionsRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetTransactionsMethod(), getCallOptions()), request); + } + + /** + */ + public com.google.common.util.concurrent.ListenableFuture countTransactions( + bdledger.api.grpc.query.TransactionsRequest request) { + return futureUnaryCall( + getChannel().newCall(getCountTransactionsMethod(), getCallOptions()), request); + } } - private static final int METHODID_GET_BLOCKS = 0; - private static final int METHODID_COUNT_BLOCKS = 1; - private static final int METHODID_GET_TRANSACTIONS = 2; - private static final int METHODID_COUNT_TRANSACTIONS = 3; - private static final int METHODID_GET_BLOCK_BY_HASH = 4; - private static final int METHODID_GET_TRANSACTION_BY_HASH = 5; - private static final int METHODID_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX = 6; + private static final int METHODID_GET_BLOCK_BY_HASH = 0; + private static final int METHODID_GET_BLOCKS = 1; + private static final int METHODID_COUNT_BLOCKS = 2; + private static final int METHODID_GET_TRANSACTION_BY_HASH = 3; + private static final int METHODID_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX = 4; + private static final int METHODID_GET_TRANSACTIONS = 5; + private static final int METHODID_COUNT_TRANSACTIONS = 6; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -627,6 +627,10 @@ public final class QueryGrpc { @java.lang.SuppressWarnings("unchecked") public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { switch (methodId) { + case METHODID_GET_BLOCK_BY_HASH: + serviceImpl.getBlockByHash((bdledger.api.grpc.query.GetBlockByHashRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; case METHODID_GET_BLOCKS: serviceImpl.getBlocks((bdledger.api.grpc.query.BlocksRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -635,18 +639,6 @@ public final class QueryGrpc { serviceImpl.countBlocks((bdledger.api.grpc.query.BlocksRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; - case METHODID_GET_TRANSACTIONS: - serviceImpl.getTransactions((bdledger.api.grpc.query.TransactionsRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_COUNT_TRANSACTIONS: - serviceImpl.countTransactions((bdledger.api.grpc.query.TransactionsRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_GET_BLOCK_BY_HASH: - serviceImpl.getBlockByHash((bdledger.api.grpc.query.GetBlockByHashRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; case METHODID_GET_TRANSACTION_BY_HASH: serviceImpl.getTransactionByHash((bdledger.api.grpc.query.GetTransactionByHashRequest) request, (io.grpc.stub.StreamObserver) responseObserver); @@ -655,6 +647,14 @@ public final class QueryGrpc { serviceImpl.getTransactionByBlockHashAndIndex((bdledger.api.grpc.query.GetTransactionByBlockHashAndIndexRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_TRANSACTIONS: + serviceImpl.getTransactions((bdledger.api.grpc.query.TransactionsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_COUNT_TRANSACTIONS: + serviceImpl.countTransactions((bdledger.api.grpc.query.TransactionsRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; default: throw new AssertionError(); } @@ -716,13 +716,13 @@ public final class QueryGrpc { if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) .setSchemaDescriptor(new QueryFileDescriptorSupplier()) + .addMethod(getGetBlockByHashMethod()) .addMethod(getGetBlocksMethod()) .addMethod(getCountBlocksMethod()) - .addMethod(getGetTransactionsMethod()) - .addMethod(getCountTransactionsMethod()) - .addMethod(getGetBlockByHashMethod()) .addMethod(getGetTransactionByHashMethod()) .addMethod(getGetTransactionByBlockHashAndIndexMethod()) + .addMethod(getGetTransactionsMethod()) + .addMethod(getCountTransactionsMethod()) .build(); } } diff --git a/src/main/java/bdledger/api/grpc/query/QueryProto.java b/src/main/java/bdledger/api/grpc/query/QueryProto.java index 8834822..c689d2a 100644 --- a/src/main/java/bdledger/api/grpc/query/QueryProto.java +++ b/src/main/java/bdledger/api/grpc/query/QueryProto.java @@ -14,16 +14,26 @@ public final class QueryProto { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_bdledger_api_BlockFilter_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_bdledger_api_BlockFilter_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_bdledger_api_TransactionFilter_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_bdledger_api_TransactionFilter_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_BlockFilter_descriptor; + internal_static_bdledger_api_GetBlockByHashRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_BlockFilter_fieldAccessorTable; + internal_static_bdledger_api_GetBlockByHashRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_bdledger_api_GetBlockByHashResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_bdledger_api_GetBlockByHashResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_bdledger_api_BlocksRequest_descriptor; static final @@ -39,31 +49,6 @@ public final class QueryProto { static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_bdledger_api_CountBlocksResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_TransactionsRequest_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_TransactionsRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_GetTransactionsResponse_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_GetTransactionsResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_CountTransactionsResponse_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_CountTransactionsResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_GetBlockByHashRequest_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_GetBlockByHashRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_bdledger_api_GetBlockByHashResponse_descriptor; - static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_bdledger_api_GetBlockByHashResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_bdledger_api_GetTransactionByHashRequest_descriptor; static final @@ -84,6 +69,21 @@ public final class QueryProto { static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_bdledger_api_GetTransactionByBlockHashAndIndexResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_bdledger_api_TransactionsRequest_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_bdledger_api_TransactionsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_bdledger_api_GetTransactionsResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_bdledger_api_GetTransactionsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_bdledger_api_CountTransactionsResponse_descriptor; + static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_bdledger_api_CountTransactionsResponse_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -94,146 +94,147 @@ public final class QueryProto { static { java.lang.String[] descriptorData = { "\n\030bdledger/api/query.proto\022\014bdledger.api" + - "\032\031bdledger/api/common.proto\"N\n\021Transacti" + - "onFilter\022\014\n\004hash\030\001 \001(\014\022\014\n\004from\030\002 \001(\014\022\n\n\002" + - "to\030\003 \001(\014\022\021\n\ttimestamp\030\004 \001(\014\".\n\013BlockFilt" + - "er\022\014\n\004hash\030\001 \001(\014\022\021\n\ttimestamp\030\002 \001(\003\"{\n\rB" + - "locksRequest\022\016\n\006ledger\030\001 \001(\t\022*\n\007filters\030" + - "\002 \003(\0132\031.bdledger.api.BlockFilter\022\027\n\017star" + - "t_timestamp\030\003 \001(\003\022\025\n\rend_timestamp\030\004 \001(\003" + - "\"h\n\021GetBlocksResponse\022#\n\006blocks\030\001 \003(\0132\023." + - "bdledger.api.Block\022\027\n\017start_timestamp\030\002 " + - "\001(\003\022\025\n\rend_timestamp\030\003 \001(\003\"$\n\023CountBlock" + - "sResponse\022\r\n\005count\030\001 \001(\004\"\207\001\n\023Transaction" + - "sRequest\022\016\n\006ledger\030\001 \001(\t\0220\n\007filters\030\002 \003(" + - "\0132\037.bdledger.api.TransactionFilter\022\027\n\017st" + - "art_timestamp\030\003 \001(\003\022\025\n\rend_timestamp\030\004 \001" + - "(\003\"z\n\027GetTransactionsResponse\022/\n\014transac" + - "tions\030\001 \003(\0132\031.bdledger.api.Transaction\022\027" + - "\n\017start_timestamp\030\002 \001(\003\022\025\n\rend_timestamp" + - "\030\003 \001(\003\"*\n\031CountTransactionsResponse\022\r\n\005c" + - "ount\030\001 \001(\004\"O\n\025GetBlockByHashRequest\022\016\n\006l" + - "edger\030\001 \001(\t\022\014\n\004hash\030\002 \001(\014\022\030\n\020full_transa" + - "ction\030\003 \001(\010\"<\n\026GetBlockByHashResponse\022\"\n" + - "\005block\030\001 \001(\0132\023.bdledger.api.Block\";\n\033Get" + - "TransactionByHashRequest\022\016\n\006ledger\030\001 \001(\t" + - "\022\014\n\004hash\030\002 \001(\014\"N\n\034GetTransactionByHashRe" + - "sponse\022.\n\013transaction\030\001 \001(\0132\031.bdledger.a" + - "pi.Transaction\"]\n(GetTransactionByBlockH" + - "ashAndIndexRequest\022\016\n\006ledger\030\001 \001(\t\022\022\n\nbl" + - "ock_hash\030\002 \001(\014\022\r\n\005index\030\003 \001(\r\"[\n)GetTran" + - "sactionByBlockHashAndIndexResponse\022.\n\013tr" + - "ansaction\030\001 \001(\0132\031.bdledger.api.Transacti" + - "on2\302\005\n\005Query\022I\n\tGetBlocks\022\033.bdledger.api" + - ".BlocksRequest\032\037.bdledger.api.GetBlocksR" + - "esponse\022M\n\013CountBlocks\022\033.bdledger.api.Bl" + - "ocksRequest\032!.bdledger.api.CountBlocksRe" + - "sponse\022[\n\017GetTransactions\022!.bdledger.api" + - ".TransactionsRequest\032%.bdledger.api.GetT" + - "ransactionsResponse\022_\n\021CountTransactions" + - "\022!.bdledger.api.TransactionsRequest\032\'.bd" + - "ledger.api.CountTransactionsResponse\022[\n\016" + - "GetBlockByHash\022#.bdledger.api.GetBlockBy" + - "HashRequest\032$.bdledger.api.GetBlockByHas" + - "hResponse\022m\n\024GetTransactionByHash\022).bdle" + - "dger.api.GetTransactionByHashRequest\032*.b" + - "dledger.api.GetTransactionByHashResponse" + - "\022\224\001\n!GetTransactionByBlockHashAndIndex\0226" + - ".bdledger.api.GetTransactionByBlockHashA" + - "ndIndexRequest\0327.bdledger.api.GetTransac" + - "tionByBlockHashAndIndexResponseBO\n\027bdled" + - "ger.api.grpc.queryB\nQueryProtoP\001Z&bdware" + - ".org/bdledger/pkg/api/grpc/protob\006proto3" + "\032\031bdledger/api/common.proto\".\n\013BlockFilt" + + "er\022\014\n\004hash\030\001 \001(\014\022\021\n\ttimestamp\030\002 \001(\003\"N\n\021T" + + "ransactionFilter\022\014\n\004hash\030\001 \001(\014\022\014\n\004from\030\002" + + " \001(\014\022\n\n\002to\030\003 \001(\014\022\021\n\ttimestamp\030\004 \001(\014\"P\n\025G" + + "etBlockByHashRequest\022\016\n\006ledger\030\001 \001(\t\022\014\n\004" + + "hash\030\002 \001(\014\022\031\n\021full_transactions\030\003 \001(\010\"<\n" + + "\026GetBlockByHashResponse\022\"\n\005block\030\001 \001(\0132\023" + + ".bdledger.api.Block\"{\n\rBlocksRequest\022\016\n\006" + + "ledger\030\001 \001(\t\022*\n\007filters\030\002 \003(\0132\031.bdledger" + + ".api.BlockFilter\022\027\n\017start_timestamp\030\003 \001(" + + "\003\022\025\n\rend_timestamp\030\004 \001(\003\"h\n\021GetBlocksRes" + + "ponse\022#\n\006blocks\030\001 \003(\0132\023.bdledger.api.Blo" + + "ck\022\027\n\017start_timestamp\030\002 \001(\003\022\025\n\rend_times" + + "tamp\030\003 \001(\003\"$\n\023CountBlocksResponse\022\r\n\005cou" + + "nt\030\001 \001(\004\";\n\033GetTransactionByHashRequest\022" + + "\016\n\006ledger\030\001 \001(\t\022\014\n\004hash\030\002 \001(\014\"N\n\034GetTran" + + "sactionByHashResponse\022.\n\013transaction\030\001 \001" + + "(\0132\031.bdledger.api.Transaction\"]\n(GetTran" + + "sactionByBlockHashAndIndexRequest\022\016\n\006led" + + "ger\030\001 \001(\t\022\022\n\nblock_hash\030\002 \001(\014\022\r\n\005index\030\003" + + " \001(\r\"[\n)GetTransactionByBlockHashAndInde" + + "xResponse\022.\n\013transaction\030\001 \001(\0132\031.bdledge" + + "r.api.Transaction\"\207\001\n\023TransactionsReques" + + "t\022\016\n\006ledger\030\001 \001(\t\0220\n\007filters\030\002 \003(\0132\037.bdl" + + "edger.api.TransactionFilter\022\027\n\017start_tim" + + "estamp\030\003 \001(\003\022\025\n\rend_timestamp\030\004 \001(\003\"z\n\027G" + + "etTransactionsResponse\022/\n\014transactions\030\001" + + " \003(\0132\031.bdledger.api.Transaction\022\027\n\017start" + + "_timestamp\030\002 \001(\003\022\025\n\rend_timestamp\030\003 \001(\003\"" + + "*\n\031CountTransactionsResponse\022\r\n\005count\030\001 " + + "\001(\0042\302\005\n\005Query\022[\n\016GetBlockByHash\022#.bdledg" + + "er.api.GetBlockByHashRequest\032$.bdledger." + + "api.GetBlockByHashResponse\022I\n\tGetBlocks\022" + + "\033.bdledger.api.BlocksRequest\032\037.bdledger." + + "api.GetBlocksResponse\022M\n\013CountBlocks\022\033.b" + + "dledger.api.BlocksRequest\032!.bdledger.api" + + ".CountBlocksResponse\022m\n\024GetTransactionBy" + + "Hash\022).bdledger.api.GetTransactionByHash" + + "Request\032*.bdledger.api.GetTransactionByH" + + "ashResponse\022\224\001\n!GetTransactionByBlockHas" + + "hAndIndex\0226.bdledger.api.GetTransactionB" + + "yBlockHashAndIndexRequest\0327.bdledger.api" + + ".GetTransactionByBlockHashAndIndexRespon" + + "se\022[\n\017GetTransactions\022!.bdledger.api.Tra" + + "nsactionsRequest\032%.bdledger.api.GetTrans" + + "actionsResponse\022_\n\021CountTransactions\022!.b" + + "dledger.api.TransactionsRequest\032\'.bdledg" + + "er.api.CountTransactionsResponseBO\n\027bdle" + + "dger.api.grpc.queryB\nQueryProtoP\001Z&bdwar" + + "e.org/bdledger/pkg/api/grpc/protob\006proto" + + "3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { bdledger.api.grpc.common.CommonProto.getDescriptor(), }); - internal_static_bdledger_api_TransactionFilter_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_bdledger_api_TransactionFilter_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_TransactionFilter_descriptor, - new java.lang.String[] { "Hash", "From", "To", "Timestamp", }); internal_static_bdledger_api_BlockFilter_descriptor = - getDescriptor().getMessageTypes().get(1); + getDescriptor().getMessageTypes().get(0); internal_static_bdledger_api_BlockFilter_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_BlockFilter_descriptor, new java.lang.String[] { "Hash", "Timestamp", }); - internal_static_bdledger_api_BlocksRequest_descriptor = + internal_static_bdledger_api_TransactionFilter_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_bdledger_api_TransactionFilter_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_TransactionFilter_descriptor, + new java.lang.String[] { "Hash", "From", "To", "Timestamp", }); + internal_static_bdledger_api_GetBlockByHashRequest_descriptor = getDescriptor().getMessageTypes().get(2); + internal_static_bdledger_api_GetBlockByHashRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_GetBlockByHashRequest_descriptor, + new java.lang.String[] { "Ledger", "Hash", "FullTransactions", }); + internal_static_bdledger_api_GetBlockByHashResponse_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_bdledger_api_GetBlockByHashResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_GetBlockByHashResponse_descriptor, + new java.lang.String[] { "Block", }); + internal_static_bdledger_api_BlocksRequest_descriptor = + getDescriptor().getMessageTypes().get(4); internal_static_bdledger_api_BlocksRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_BlocksRequest_descriptor, new java.lang.String[] { "Ledger", "Filters", "StartTimestamp", "EndTimestamp", }); internal_static_bdledger_api_GetBlocksResponse_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageTypes().get(5); internal_static_bdledger_api_GetBlocksResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_GetBlocksResponse_descriptor, new java.lang.String[] { "Blocks", "StartTimestamp", "EndTimestamp", }); internal_static_bdledger_api_CountBlocksResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(6); internal_static_bdledger_api_CountBlocksResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_CountBlocksResponse_descriptor, new java.lang.String[] { "Count", }); - internal_static_bdledger_api_TransactionsRequest_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_bdledger_api_TransactionsRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_TransactionsRequest_descriptor, - new java.lang.String[] { "Ledger", "Filters", "StartTimestamp", "EndTimestamp", }); - internal_static_bdledger_api_GetTransactionsResponse_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_bdledger_api_GetTransactionsResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_GetTransactionsResponse_descriptor, - new java.lang.String[] { "Transactions", "StartTimestamp", "EndTimestamp", }); - internal_static_bdledger_api_CountTransactionsResponse_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_bdledger_api_CountTransactionsResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_CountTransactionsResponse_descriptor, - new java.lang.String[] { "Count", }); - internal_static_bdledger_api_GetBlockByHashRequest_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_bdledger_api_GetBlockByHashRequest_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_GetBlockByHashRequest_descriptor, - new java.lang.String[] { "Ledger", "Hash", "FullTransaction", }); - internal_static_bdledger_api_GetBlockByHashResponse_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_bdledger_api_GetBlockByHashResponse_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_bdledger_api_GetBlockByHashResponse_descriptor, - new java.lang.String[] { "Block", }); internal_static_bdledger_api_GetTransactionByHashRequest_descriptor = - getDescriptor().getMessageTypes().get(10); + getDescriptor().getMessageTypes().get(7); internal_static_bdledger_api_GetTransactionByHashRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_GetTransactionByHashRequest_descriptor, new java.lang.String[] { "Ledger", "Hash", }); internal_static_bdledger_api_GetTransactionByHashResponse_descriptor = - getDescriptor().getMessageTypes().get(11); + getDescriptor().getMessageTypes().get(8); internal_static_bdledger_api_GetTransactionByHashResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_GetTransactionByHashResponse_descriptor, new java.lang.String[] { "Transaction", }); internal_static_bdledger_api_GetTransactionByBlockHashAndIndexRequest_descriptor = - getDescriptor().getMessageTypes().get(12); + getDescriptor().getMessageTypes().get(9); internal_static_bdledger_api_GetTransactionByBlockHashAndIndexRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_GetTransactionByBlockHashAndIndexRequest_descriptor, new java.lang.String[] { "Ledger", "BlockHash", "Index", }); internal_static_bdledger_api_GetTransactionByBlockHashAndIndexResponse_descriptor = - getDescriptor().getMessageTypes().get(13); + getDescriptor().getMessageTypes().get(10); internal_static_bdledger_api_GetTransactionByBlockHashAndIndexResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_GetTransactionByBlockHashAndIndexResponse_descriptor, new java.lang.String[] { "Transaction", }); + internal_static_bdledger_api_TransactionsRequest_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_bdledger_api_TransactionsRequest_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_TransactionsRequest_descriptor, + new java.lang.String[] { "Ledger", "Filters", "StartTimestamp", "EndTimestamp", }); + internal_static_bdledger_api_GetTransactionsResponse_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_bdledger_api_GetTransactionsResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_GetTransactionsResponse_descriptor, + new java.lang.String[] { "Transactions", "StartTimestamp", "EndTimestamp", }); + internal_static_bdledger_api_CountTransactionsResponse_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_bdledger_api_CountTransactionsResponse_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_bdledger_api_CountTransactionsResponse_descriptor, + new java.lang.String[] { "Count", }); bdledger.api.grpc.common.CommonProto.getDescriptor(); } diff --git a/src/main/proto b/src/main/proto index 08f4278..bbe9b21 160000 --- a/src/main/proto +++ b/src/main/proto @@ -1 +1 @@ -Subproject commit 08f427899ce6a20196b2969d09d152c1b6051306 +Subproject commit bbe9b2123d74617b82f51a2016d8578cb3e4e8da