diff --git a/src/main/java/bdledger/api/Client.java b/src/main/java/bdledger/api/Client.java index 74979ca..9f95f32 100644 --- a/src/main/java/bdledger/api/Client.java +++ b/src/main/java/bdledger/api/Client.java @@ -21,7 +21,7 @@ import java.util.logging.Logger; /** * 事务账本客户端 * - *

如有更灵活的需求可直接使用{@link bdledger.api.grpc.ledger.TransactionLedgerGrpc}类。 + *

如有更灵活的需求可直接使用{@link bdledger.api.grpc.ledger.LedgerGrpc}类。 * * @author nex * @see 事务账本API @@ -33,8 +33,8 @@ public class Client { private final ManagedChannel channel; private final NodeGrpc.NodeFutureStub nodeFutureStub; private final NodeGrpc.NodeBlockingStub nodeBlockingStub; - private final TransactionLedgerGrpc.TransactionLedgerFutureStub ledgerFutureStub; - private final TransactionLedgerGrpc.TransactionLedgerBlockingStub ledgerBlockingStub; + private final LedgerGrpc.LedgerFutureStub ledgerFutureStub; + private final LedgerGrpc.LedgerBlockingStub ledgerBlockingStub; private final QueryGrpc.QueryFutureStub queryFutureStub; private final QueryGrpc.QueryBlockingStub queryBlockingStub; @@ -52,8 +52,8 @@ public class Client { channel = channelBuilder.build(); nodeFutureStub = NodeGrpc.newFutureStub(channel); nodeBlockingStub = NodeGrpc.newBlockingStub(channel); - ledgerFutureStub = TransactionLedgerGrpc.newFutureStub(channel); - ledgerBlockingStub = TransactionLedgerGrpc.newBlockingStub(channel); + ledgerFutureStub = LedgerGrpc.newFutureStub(channel); + ledgerBlockingStub = LedgerGrpc.newBlockingStub(channel); queryFutureStub = QueryGrpc.newFutureStub(channel); queryBlockingStub = QueryGrpc.newBlockingStub(channel); } diff --git a/src/main/java/bdledger/api/grpc/common/Block.java b/src/main/java/bdledger/api/grpc/common/Block.java index e5d0ac7..9f2e7db 100644 --- a/src/main/java/bdledger/api/grpc/common/Block.java +++ b/src/main/java/bdledger/api/grpc/common/Block.java @@ -55,17 +55,12 @@ private static final long serialVersionUID = 0L; case 0: done = true; break; - case 8: { - - index_ = input.readUInt64(); - break; - } - case 18: { + case 10: { hash_ = input.readBytes(); break; } - case 26: { + case 18: { if (!((mutable_bitField0_ & 0x00000001) != 0)) { parentHashes_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; @@ -73,7 +68,7 @@ private static final long serialVersionUID = 0L; parentHashes_.add(input.readBytes()); break; } - case 34: { + case 26: { if (!((mutable_bitField0_ & 0x00000002) != 0)) { witnesses_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; @@ -81,16 +76,21 @@ private static final long serialVersionUID = 0L; witnesses_.add(input.readBytes()); break; } - case 40: { + case 32: { timestamp_ = input.readInt64(); break; } - case 48: { + case 40: { size_ = input.readUInt64(); break; } + case 48: { + + transactionCount_ = input.readUInt32(); + break; + } case 58: { transactionsRoot_ = input.readBytes(); @@ -157,42 +157,28 @@ private static final long serialVersionUID = 0L; bdledger.api.grpc.common.Block.class, bdledger.api.grpc.common.Block.Builder.class); } - public static final int INDEX_FIELD_NUMBER = 1; - private long index_; - /** - *

-   * 事务链本地区块索引,当区块处于待确认状态时为`null`
-   * 
- * - * uint64 index = 1; - * @return The index. - */ - public long getIndex() { - return index_; - } - - public static final int HASH_FIELD_NUMBER = 2; + public static final int HASH_FIELD_NUMBER = 1; private com.google.protobuf.ByteString hash_; /** *
    * 区块的哈希,当区块处于待确认状态时为`null`
    * 
* - * bytes hash = 2; + * bytes hash = 1; * @return The hash. */ public com.google.protobuf.ByteString getHash() { return hash_; } - public static final int PARENT_HASHES_FIELD_NUMBER = 3; + public static final int PARENT_HASHES_FIELD_NUMBER = 2; private java.util.List parentHashes_; /** *
    * 父区块的哈希
    * 
* - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return A list containing the parentHashes. */ public java.util.List @@ -204,7 +190,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return The count of parentHashes. */ public int getParentHashesCount() { @@ -215,7 +201,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param index The index of the element to return. * @return The parentHashes at the given index. */ @@ -223,14 +209,14 @@ private static final long serialVersionUID = 0L; return parentHashes_.get(index); } - public static final int WITNESSES_FIELD_NUMBER = 4; + public static final int WITNESSES_FIELD_NUMBER = 3; private java.util.List witnesses_; /** *
    * 见证者账户地址
    * 
* - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return A list containing the witnesses. */ public java.util.List @@ -242,7 +228,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return The count of witnesses. */ public int getWitnessesCount() { @@ -253,7 +239,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param index The index of the element to return. * @return The witnesses at the given index. */ @@ -261,39 +247,53 @@ private static final long serialVersionUID = 0L; return witnesses_.get(index); } - public static final int TIMESTAMP_FIELD_NUMBER = 5; + public static final int TIMESTAMP_FIELD_NUMBER = 4; private long timestamp_; /** *
    * 区块产生时的 UNIX 时间戳,单位为秒
    * 
* - * int64 timestamp = 5; + * int64 timestamp = 4; * @return The timestamp. */ public long getTimestamp() { return timestamp_; } - public static final int SIZE_FIELD_NUMBER = 6; + public static final int SIZE_FIELD_NUMBER = 5; private long size_; /** *
    * 区块大小的字节数
    * 
* - * uint64 size = 6; + * uint64 size = 5; * @return The size. */ public long getSize() { return size_; } + public static final int TRANSACTION_COUNT_FIELD_NUMBER = 6; + private int transactionCount_; + /** + *
+   * 区块包含的事务数量
+   * 
+ * + * uint32 transaction_count = 6; + * @return The transactionCount. + */ + public int getTransactionCount() { + return transactionCount_; + } + public static final int TRANSACTIONS_ROOT_FIELD_NUMBER = 7; private com.google.protobuf.ByteString transactionsRoot_; /** *
-   * 区块的事务树根
+   * 区块的事务默克尔树根
    * 
* * bytes transactions_root = 7; @@ -410,23 +410,23 @@ private static final long serialVersionUID = 0L; @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (index_ != 0L) { - output.writeUInt64(1, index_); - } if (!hash_.isEmpty()) { - output.writeBytes(2, hash_); + output.writeBytes(1, hash_); } for (int i = 0; i < parentHashes_.size(); i++) { - output.writeBytes(3, parentHashes_.get(i)); + output.writeBytes(2, parentHashes_.get(i)); } for (int i = 0; i < witnesses_.size(); i++) { - output.writeBytes(4, witnesses_.get(i)); + output.writeBytes(3, witnesses_.get(i)); } if (timestamp_ != 0L) { - output.writeInt64(5, timestamp_); + output.writeInt64(4, timestamp_); } if (size_ != 0L) { - output.writeUInt64(6, size_); + output.writeUInt64(5, size_); + } + if (transactionCount_ != 0) { + output.writeUInt32(6, transactionCount_); } if (!transactionsRoot_.isEmpty()) { output.writeBytes(7, transactionsRoot_); @@ -446,13 +446,9 @@ private static final long serialVersionUID = 0L; if (size != -1) return size; size = 0; - if (index_ != 0L) { - size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, index_); - } if (!hash_.isEmpty()) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, hash_); + .computeBytesSize(1, hash_); } { int dataSize = 0; @@ -474,11 +470,15 @@ private static final long serialVersionUID = 0L; } if (timestamp_ != 0L) { size += com.google.protobuf.CodedOutputStream - .computeInt64Size(5, timestamp_); + .computeInt64Size(4, timestamp_); } if (size_ != 0L) { size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(6, size_); + .computeUInt64Size(5, size_); + } + if (transactionCount_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(6, transactionCount_); } if (!transactionsRoot_.isEmpty()) { size += com.google.protobuf.CodedOutputStream @@ -512,8 +512,6 @@ private static final long serialVersionUID = 0L; } bdledger.api.grpc.common.Block other = (bdledger.api.grpc.common.Block) obj; - if (getIndex() - != other.getIndex()) return false; if (!getHash() .equals(other.getHash())) return false; if (!getParentHashesList() @@ -524,6 +522,8 @@ private static final long serialVersionUID = 0L; != other.getTimestamp()) return false; if (getSize() != other.getSize()) return false; + if (getTransactionCount() + != other.getTransactionCount()) return false; if (!getTransactionsRoot() .equals(other.getTransactionsRoot())) return false; if (!getTransactionsList() @@ -541,9 +541,6 @@ private static final long serialVersionUID = 0L; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + INDEX_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getIndex()); hash = (37 * hash) + HASH_FIELD_NUMBER; hash = (53 * hash) + getHash().hashCode(); if (getParentHashesCount() > 0) { @@ -560,6 +557,8 @@ private static final long serialVersionUID = 0L; hash = (37 * hash) + SIZE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getSize()); + hash = (37 * hash) + TRANSACTION_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getTransactionCount(); hash = (37 * hash) + TRANSACTIONS_ROOT_FIELD_NUMBER; hash = (53 * hash) + getTransactionsRoot().hashCode(); if (getTransactionsCount() > 0) { @@ -704,8 +703,6 @@ private static final long serialVersionUID = 0L; @java.lang.Override public Builder clear() { super.clear(); - index_ = 0L; - hash_ = com.google.protobuf.ByteString.EMPTY; parentHashes_ = java.util.Collections.emptyList(); @@ -716,6 +713,8 @@ private static final long serialVersionUID = 0L; size_ = 0L; + transactionCount_ = 0; + transactionsRoot_ = com.google.protobuf.ByteString.EMPTY; if (transactionsBuilder_ == null) { @@ -753,7 +752,6 @@ private static final long serialVersionUID = 0L; public bdledger.api.grpc.common.Block buildPartial() { bdledger.api.grpc.common.Block result = new bdledger.api.grpc.common.Block(this); int from_bitField0_ = bitField0_; - result.index_ = index_; result.hash_ = hash_; if (((bitField0_ & 0x00000001) != 0)) { parentHashes_ = java.util.Collections.unmodifiableList(parentHashes_); @@ -767,6 +765,7 @@ private static final long serialVersionUID = 0L; result.witnesses_ = witnesses_; result.timestamp_ = timestamp_; result.size_ = size_; + result.transactionCount_ = transactionCount_; result.transactionsRoot_ = transactionsRoot_; if (transactionsBuilder_ == null) { if (((bitField0_ & 0x00000004) != 0)) { @@ -830,9 +829,6 @@ private static final long serialVersionUID = 0L; public Builder mergeFrom(bdledger.api.grpc.common.Block other) { if (other == bdledger.api.grpc.common.Block.getDefaultInstance()) return this; - if (other.getIndex() != 0L) { - setIndex(other.getIndex()); - } if (other.getHash() != com.google.protobuf.ByteString.EMPTY) { setHash(other.getHash()); } @@ -862,6 +858,9 @@ private static final long serialVersionUID = 0L; if (other.getSize() != 0L) { setSize(other.getSize()); } + if (other.getTransactionCount() != 0) { + setTransactionCount(other.getTransactionCount()); + } if (other.getTransactionsRoot() != com.google.protobuf.ByteString.EMPTY) { setTransactionsRoot(other.getTransactionsRoot()); } @@ -931,55 +930,13 @@ private static final long serialVersionUID = 0L; } private int bitField0_; - private long index_ ; - /** - *
-     * 事务链本地区块索引,当区块处于待确认状态时为`null`
-     * 
- * - * uint64 index = 1; - * @return The index. - */ - public long getIndex() { - return index_; - } - /** - *
-     * 事务链本地区块索引,当区块处于待确认状态时为`null`
-     * 
- * - * uint64 index = 1; - * @param value The index to set. - * @return This builder for chaining. - */ - public Builder setIndex(long value) { - - index_ = value; - onChanged(); - return this; - } - /** - *
-     * 事务链本地区块索引,当区块处于待确认状态时为`null`
-     * 
- * - * uint64 index = 1; - * @return This builder for chaining. - */ - public Builder clearIndex() { - - index_ = 0L; - onChanged(); - return this; - } - private com.google.protobuf.ByteString hash_ = com.google.protobuf.ByteString.EMPTY; /** *
      * 区块的哈希,当区块处于待确认状态时为`null`
      * 
* - * bytes hash = 2; + * bytes hash = 1; * @return The hash. */ public com.google.protobuf.ByteString getHash() { @@ -990,7 +947,7 @@ private static final long serialVersionUID = 0L; * 区块的哈希,当区块处于待确认状态时为`null` * * - * bytes hash = 2; + * bytes hash = 1; * @param value The hash to set. * @return This builder for chaining. */ @@ -1008,7 +965,7 @@ private static final long serialVersionUID = 0L; * 区块的哈希,当区块处于待确认状态时为`null` * * - * bytes hash = 2; + * bytes hash = 1; * @return This builder for chaining. */ public Builder clearHash() { @@ -1030,7 +987,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return A list containing the parentHashes. */ public java.util.List @@ -1043,7 +1000,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return The count of parentHashes. */ public int getParentHashesCount() { @@ -1054,7 +1011,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param index The index of the element to return. * @return The parentHashes at the given index. */ @@ -1066,7 +1023,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param index The index to set the value at. * @param value The parentHashes to set. * @return This builder for chaining. @@ -1086,7 +1043,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param value The parentHashes to add. * @return This builder for chaining. */ @@ -1104,7 +1061,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param values The parentHashes to add. * @return This builder for chaining. */ @@ -1121,7 +1078,7 @@ private static final long serialVersionUID = 0L; * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return This builder for chaining. */ public Builder clearParentHashes() { @@ -1143,7 +1100,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return A list containing the witnesses. */ public java.util.List @@ -1156,7 +1113,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return The count of witnesses. */ public int getWitnessesCount() { @@ -1167,7 +1124,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param index The index of the element to return. * @return The witnesses at the given index. */ @@ -1179,7 +1136,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param index The index to set the value at. * @param value The witnesses to set. * @return This builder for chaining. @@ -1199,7 +1156,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param value The witnesses to add. * @return This builder for chaining. */ @@ -1217,7 +1174,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param values The witnesses to add. * @return This builder for chaining. */ @@ -1234,7 +1191,7 @@ private static final long serialVersionUID = 0L; * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return This builder for chaining. */ public Builder clearWitnesses() { @@ -1250,7 +1207,7 @@ private static final long serialVersionUID = 0L; * 区块产生时的 UNIX 时间戳,单位为秒 * * - * int64 timestamp = 5; + * int64 timestamp = 4; * @return The timestamp. */ public long getTimestamp() { @@ -1261,7 +1218,7 @@ private static final long serialVersionUID = 0L; * 区块产生时的 UNIX 时间戳,单位为秒 * * - * int64 timestamp = 5; + * int64 timestamp = 4; * @param value The timestamp to set. * @return This builder for chaining. */ @@ -1276,7 +1233,7 @@ private static final long serialVersionUID = 0L; * 区块产生时的 UNIX 时间戳,单位为秒 * * - * int64 timestamp = 5; + * int64 timestamp = 4; * @return This builder for chaining. */ public Builder clearTimestamp() { @@ -1292,7 +1249,7 @@ private static final long serialVersionUID = 0L; * 区块大小的字节数 * * - * uint64 size = 6; + * uint64 size = 5; * @return The size. */ public long getSize() { @@ -1303,7 +1260,7 @@ private static final long serialVersionUID = 0L; * 区块大小的字节数 * * - * uint64 size = 6; + * uint64 size = 5; * @param value The size to set. * @return This builder for chaining. */ @@ -1318,7 +1275,7 @@ private static final long serialVersionUID = 0L; * 区块大小的字节数 * * - * uint64 size = 6; + * uint64 size = 5; * @return This builder for chaining. */ public Builder clearSize() { @@ -1328,10 +1285,52 @@ private static final long serialVersionUID = 0L; return this; } + private int transactionCount_ ; + /** + *
+     * 区块包含的事务数量
+     * 
+ * + * uint32 transaction_count = 6; + * @return The transactionCount. + */ + public int getTransactionCount() { + return transactionCount_; + } + /** + *
+     * 区块包含的事务数量
+     * 
+ * + * uint32 transaction_count = 6; + * @param value The transactionCount to set. + * @return This builder for chaining. + */ + public Builder setTransactionCount(int value) { + + transactionCount_ = value; + onChanged(); + return this; + } + /** + *
+     * 区块包含的事务数量
+     * 
+ * + * uint32 transaction_count = 6; + * @return This builder for chaining. + */ + public Builder clearTransactionCount() { + + transactionCount_ = 0; + onChanged(); + return this; + } + private com.google.protobuf.ByteString transactionsRoot_ = com.google.protobuf.ByteString.EMPTY; /** *
-     * 区块的事务树根
+     * 区块的事务默克尔树根
      * 
* * bytes transactions_root = 7; @@ -1342,7 +1341,7 @@ private static final long serialVersionUID = 0L; } /** *
-     * 区块的事务树根
+     * 区块的事务默克尔树根
      * 
* * bytes transactions_root = 7; @@ -1360,7 +1359,7 @@ private static final long serialVersionUID = 0L; } /** *
-     * 区块的事务树根
+     * 区块的事务默克尔树根
      * 
* * bytes transactions_root = 7; diff --git a/src/main/java/bdledger/api/grpc/common/BlockOrBuilder.java b/src/main/java/bdledger/api/grpc/common/BlockOrBuilder.java index 2f5e71f..f28b088 100644 --- a/src/main/java/bdledger/api/grpc/common/BlockOrBuilder.java +++ b/src/main/java/bdledger/api/grpc/common/BlockOrBuilder.java @@ -7,22 +7,12 @@ public interface BlockOrBuilder extends // @@protoc_insertion_point(interface_extends:bdledger.api.Block) com.google.protobuf.MessageOrBuilder { - /** - *
-   * 事务链本地区块索引,当区块处于待确认状态时为`null`
-   * 
- * - * uint64 index = 1; - * @return The index. - */ - long getIndex(); - /** *
    * 区块的哈希,当区块处于待确认状态时为`null`
    * 
* - * bytes hash = 2; + * bytes hash = 1; * @return The hash. */ com.google.protobuf.ByteString getHash(); @@ -32,7 +22,7 @@ public interface BlockOrBuilder extends * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return A list containing the parentHashes. */ java.util.List getParentHashesList(); @@ -41,7 +31,7 @@ public interface BlockOrBuilder extends * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @return The count of parentHashes. */ int getParentHashesCount(); @@ -50,7 +40,7 @@ public interface BlockOrBuilder extends * 父区块的哈希 * * - * repeated bytes parent_hashes = 3; + * repeated bytes parent_hashes = 2; * @param index The index of the element to return. * @return The parentHashes at the given index. */ @@ -61,7 +51,7 @@ public interface BlockOrBuilder extends * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return A list containing the witnesses. */ java.util.List getWitnessesList(); @@ -70,7 +60,7 @@ public interface BlockOrBuilder extends * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @return The count of witnesses. */ int getWitnessesCount(); @@ -79,7 +69,7 @@ public interface BlockOrBuilder extends * 见证者账户地址 * * - * repeated bytes witnesses = 4; + * repeated bytes witnesses = 3; * @param index The index of the element to return. * @return The witnesses at the given index. */ @@ -90,7 +80,7 @@ public interface BlockOrBuilder extends * 区块产生时的 UNIX 时间戳,单位为秒 * * - * int64 timestamp = 5; + * int64 timestamp = 4; * @return The timestamp. */ long getTimestamp(); @@ -100,14 +90,24 @@ public interface BlockOrBuilder extends * 区块大小的字节数 * * - * uint64 size = 6; + * uint64 size = 5; * @return The size. */ long getSize(); /** *
-   * 区块的事务树根
+   * 区块包含的事务数量
+   * 
+ * + * uint32 transaction_count = 6; + * @return The transactionCount. + */ + int getTransactionCount(); + + /** + *
+   * 区块的事务默克尔树根
    * 
* * bytes transactions_root = 7; diff --git a/src/main/java/bdledger/api/grpc/common/CommonProto.java b/src/main/java/bdledger/api/grpc/common/CommonProto.java index d23e3ba..76a85cb 100644 --- a/src/main/java/bdledger/api/grpc/common/CommonProto.java +++ b/src/main/java/bdledger/api/grpc/common/CommonProto.java @@ -39,17 +39,17 @@ public final class CommonProto { "2\035.bdledger.api.TransactionType\022\014\n\004from\030" + "\005 \001(\014\022\r\n\005nonce\030\006 \001(\004\022\n\n\002to\030\007 \001(\014\022\014\n\004data" + "\030\010 \001(\014\022\t\n\001v\030\t \001(\014\022\t\n\001r\030\n \001(\014\022\t\n\001s\030\013 \001(\014\"" + - "\327\001\n\005Block\022\r\n\005index\030\001 \001(\004\022\014\n\004hash\030\002 \001(\014\022\025" + - "\n\rparent_hashes\030\003 \003(\014\022\021\n\twitnesses\030\004 \003(\014" + - "\022\021\n\ttimestamp\030\005 \001(\003\022\014\n\004size\030\006 \001(\004\022\031\n\021tra" + - "nsactions_root\030\007 \001(\014\022/\n\014transactions\030\010 \003" + - "(\0132\031.bdledger.api.Transaction\022\032\n\022transac" + - "tion_hashes\030\t \003(\014*o\n\017TransactionType\022\n\n\006" + - "RECORD\020\000\022\013\n\007MESSAGE\020\001\022\025\n\021CONTRACT_CREATI" + - "ON\020\002\022\027\n\023CONTRACT_INVOCATION\020\003\022\023\n\017CONTRAC" + - "T_STATUS\020\004BQ\n\030bdledger.api.grpc.commonB\013" + - "CommonProtoP\001Z&bdware.org/bdledger/pkg/a" + - "pi/grpc/protob\006proto3" + "\343\001\n\005Block\022\014\n\004hash\030\001 \001(\014\022\025\n\rparent_hashes" + + "\030\002 \003(\014\022\021\n\twitnesses\030\003 \003(\014\022\021\n\ttimestamp\030\004" + + " \001(\003\022\014\n\004size\030\005 \001(\004\022\031\n\021transaction_count\030" + + "\006 \001(\r\022\031\n\021transactions_root\030\007 \001(\014\022/\n\014tran" + + "sactions\030\010 \003(\0132\031.bdledger.api.Transactio" + + "n\022\032\n\022transaction_hashes\030\t \003(\014*o\n\017Transac" + + "tionType\022\n\n\006RECORD\020\000\022\013\n\007MESSAGE\020\001\022\025\n\021CON" + + "TRACT_CREATION\020\002\022\027\n\023CONTRACT_INVOCATION\020" + + "\003\022\023\n\017CONTRACT_STATUS\020\004BQ\n\030bdledger.api.g" + + "rpc.commonB\013CommonProtoP\001Z&bdware.org/bd" + + "ledger/pkg/api/grpc/protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -66,7 +66,7 @@ public final class CommonProto { internal_static_bdledger_api_Block_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_bdledger_api_Block_descriptor, - new java.lang.String[] { "Index", "Hash", "ParentHashes", "Witnesses", "Timestamp", "Size", "TransactionsRoot", "Transactions", "TransactionHashes", }); + new java.lang.String[] { "Hash", "ParentHashes", "Witnesses", "Timestamp", "Size", "TransactionCount", "TransactionsRoot", "Transactions", "TransactionHashes", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/src/main/java/bdledger/api/grpc/ledger/TransactionLedgerGrpc.java b/src/main/java/bdledger/api/grpc/ledger/LedgerGrpc.java similarity index 76% rename from src/main/java/bdledger/api/grpc/ledger/TransactionLedgerGrpc.java rename to src/main/java/bdledger/api/grpc/ledger/LedgerGrpc.java index 1e8b4fe..0596f75 100644 --- a/src/main/java/bdledger/api/grpc/ledger/TransactionLedgerGrpc.java +++ b/src/main/java/bdledger/api/grpc/ledger/LedgerGrpc.java @@ -20,11 +20,11 @@ import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; @javax.annotation.Generated( value = "by gRPC proto compiler (version 1.27.0)", comments = "Source: bdledger/api/ledger.proto") -public final class TransactionLedgerGrpc { +public final class LedgerGrpc { - private TransactionLedgerGrpc() {} + private LedgerGrpc() {} - public static final String SERVICE_NAME = "bdledger.api.TransactionLedger"; + public static final String SERVICE_NAME = "bdledger.api.Ledger"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor getCreateLedgerMethod() { io.grpc.MethodDescriptor getCreateLedgerMethod; - if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) { - synchronized (TransactionLedgerGrpc.class) { - if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) { - TransactionLedgerGrpc.getCreateLedgerMethod = getCreateLedgerMethod = + if ((getCreateLedgerMethod = LedgerGrpc.getCreateLedgerMethod) == null) { + synchronized (LedgerGrpc.class) { + if ((getCreateLedgerMethod = LedgerGrpc.getCreateLedgerMethod) == null) { + LedgerGrpc.getCreateLedgerMethod = getCreateLedgerMethod = io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateLedger")) @@ -50,7 +50,7 @@ public final class TransactionLedgerGrpc { bdledger.api.grpc.ledger.CreateLedgerRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( bdledger.api.grpc.ledger.CreateLedgerResponse.getDefaultInstance())) - .setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("CreateLedger")) + .setSchemaDescriptor(new LedgerMethodDescriptorSupplier("CreateLedger")) .build(); } } @@ -69,10 +69,10 @@ public final class TransactionLedgerGrpc { public static io.grpc.MethodDescriptor getGetLedgersMethod() { io.grpc.MethodDescriptor getGetLedgersMethod; - if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) { - synchronized (TransactionLedgerGrpc.class) { - if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) { - TransactionLedgerGrpc.getGetLedgersMethod = getGetLedgersMethod = + if ((getGetLedgersMethod = LedgerGrpc.getGetLedgersMethod) == null) { + synchronized (LedgerGrpc.class) { + if ((getGetLedgersMethod = LedgerGrpc.getGetLedgersMethod) == null) { + LedgerGrpc.getGetLedgersMethod = getGetLedgersMethod = io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetLedgers")) @@ -81,7 +81,7 @@ public final class TransactionLedgerGrpc { com.google.protobuf.Empty.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( bdledger.api.grpc.ledger.GetLedgersResponse.getDefaultInstance())) - .setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("GetLedgers")) + .setSchemaDescriptor(new LedgerMethodDescriptorSupplier("GetLedgers")) .build(); } } @@ -100,10 +100,10 @@ public final class TransactionLedgerGrpc { public static io.grpc.MethodDescriptor getSendTransactionMethod() { io.grpc.MethodDescriptor getSendTransactionMethod; - if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) { - synchronized (TransactionLedgerGrpc.class) { - if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) { - TransactionLedgerGrpc.getSendTransactionMethod = getSendTransactionMethod = + if ((getSendTransactionMethod = LedgerGrpc.getSendTransactionMethod) == null) { + synchronized (LedgerGrpc.class) { + if ((getSendTransactionMethod = LedgerGrpc.getSendTransactionMethod) == null) { + LedgerGrpc.getSendTransactionMethod = getSendTransactionMethod = io.grpc.MethodDescriptor.newBuilder() .setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendTransaction")) @@ -112,7 +112,7 @@ public final class TransactionLedgerGrpc { bdledger.api.grpc.ledger.SendTransactionRequest.getDefaultInstance())) .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( bdledger.api.grpc.ledger.SendTransactionResponse.getDefaultInstance())) - .setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("SendTransaction")) + .setSchemaDescriptor(new LedgerMethodDescriptorSupplier("SendTransaction")) .build(); } } @@ -123,50 +123,50 @@ public final class TransactionLedgerGrpc { /** * Creates a new async stub that supports all call types for the service */ - public static TransactionLedgerStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { + public static LedgerStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { @java.lang.Override - public TransactionLedgerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerStub(channel, callOptions); + public LedgerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LedgerStub(channel, callOptions); } }; - return TransactionLedgerStub.newStub(factory, channel); + return LedgerStub.newStub(factory, channel); } /** * Creates a new blocking-style stub that supports unary and streaming output calls on the service */ - public static TransactionLedgerBlockingStub newBlockingStub( + public static LedgerBlockingStub newBlockingStub( io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { @java.lang.Override - public TransactionLedgerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerBlockingStub(channel, callOptions); + public LedgerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LedgerBlockingStub(channel, callOptions); } }; - return TransactionLedgerBlockingStub.newStub(factory, channel); + return LedgerBlockingStub.newStub(factory, channel); } /** * Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static TransactionLedgerFutureStub newFutureStub( + public static LedgerFutureStub newFutureStub( io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { @java.lang.Override - public TransactionLedgerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerFutureStub(channel, callOptions); + public LedgerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new LedgerFutureStub(channel, callOptions); } }; - return TransactionLedgerFutureStub.newStub(factory, channel); + return LedgerFutureStub.newStub(factory, channel); } /** */ - public static abstract class TransactionLedgerImplBase implements io.grpc.BindableService { + public static abstract class LedgerImplBase implements io.grpc.BindableService { /** */ @@ -218,16 +218,16 @@ public final class TransactionLedgerGrpc { /** */ - public static final class TransactionLedgerStub extends io.grpc.stub.AbstractAsyncStub { - private TransactionLedgerStub( + public static final class LedgerStub extends io.grpc.stub.AbstractAsyncStub { + private LedgerStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override - protected TransactionLedgerStub build( + protected LedgerStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerStub(channel, callOptions); + return new LedgerStub(channel, callOptions); } /** @@ -257,16 +257,16 @@ public final class TransactionLedgerGrpc { /** */ - public static final class TransactionLedgerBlockingStub extends io.grpc.stub.AbstractBlockingStub { - private TransactionLedgerBlockingStub( + public static final class LedgerBlockingStub extends io.grpc.stub.AbstractBlockingStub { + private LedgerBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override - protected TransactionLedgerBlockingStub build( + protected LedgerBlockingStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerBlockingStub(channel, callOptions); + return new LedgerBlockingStub(channel, callOptions); } /** @@ -293,16 +293,16 @@ public final class TransactionLedgerGrpc { /** */ - public static final class TransactionLedgerFutureStub extends io.grpc.stub.AbstractFutureStub { - private TransactionLedgerFutureStub( + public static final class LedgerFutureStub extends io.grpc.stub.AbstractFutureStub { + private LedgerFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); } @java.lang.Override - protected TransactionLedgerFutureStub build( + protected LedgerFutureStub build( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new TransactionLedgerFutureStub(channel, callOptions); + return new LedgerFutureStub(channel, callOptions); } /** @@ -339,10 +339,10 @@ public final class TransactionLedgerGrpc { io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final TransactionLedgerImplBase serviceImpl; + private final LedgerImplBase serviceImpl; private final int methodId; - MethodHandlers(TransactionLedgerImplBase serviceImpl, int methodId) { + MethodHandlers(LedgerImplBase serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @@ -379,9 +379,9 @@ public final class TransactionLedgerGrpc { } } - private static abstract class TransactionLedgerBaseDescriptorSupplier + private static abstract class LedgerBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { - TransactionLedgerBaseDescriptorSupplier() {} + LedgerBaseDescriptorSupplier() {} @java.lang.Override public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { @@ -390,21 +390,21 @@ public final class TransactionLedgerGrpc { @java.lang.Override public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("TransactionLedger"); + return getFileDescriptor().findServiceByName("Ledger"); } } - private static final class TransactionLedgerFileDescriptorSupplier - extends TransactionLedgerBaseDescriptorSupplier { - TransactionLedgerFileDescriptorSupplier() {} + private static final class LedgerFileDescriptorSupplier + extends LedgerBaseDescriptorSupplier { + LedgerFileDescriptorSupplier() {} } - private static final class TransactionLedgerMethodDescriptorSupplier - extends TransactionLedgerBaseDescriptorSupplier + private static final class LedgerMethodDescriptorSupplier + extends LedgerBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { private final String methodName; - TransactionLedgerMethodDescriptorSupplier(String methodName) { + LedgerMethodDescriptorSupplier(String methodName) { this.methodName = methodName; } @@ -419,11 +419,11 @@ public final class TransactionLedgerGrpc { public static io.grpc.ServiceDescriptor getServiceDescriptor() { io.grpc.ServiceDescriptor result = serviceDescriptor; if (result == null) { - synchronized (TransactionLedgerGrpc.class) { + synchronized (LedgerGrpc.class) { result = serviceDescriptor; if (result == null) { serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new TransactionLedgerFileDescriptorSupplier()) + .setSchemaDescriptor(new LedgerFileDescriptorSupplier()) .addMethod(getCreateLedgerMethod()) .addMethod(getGetLedgersMethod()) .addMethod(getSendTransactionMethod()) diff --git a/src/main/java/bdledger/api/grpc/ledger/LedgerProto.java b/src/main/java/bdledger/api/grpc/ledger/LedgerProto.java index 2d3743c..d06dc85 100644 --- a/src/main/java/bdledger/api/grpc/ledger/LedgerProto.java +++ b/src/main/java/bdledger/api/grpc/ledger/LedgerProto.java @@ -64,16 +64,16 @@ public final class LedgerProto { "ion\032b\n\013Transaction\022+\n\004type\030\001 \001(\0162\035.bdled" + "ger.api.TransactionType\022\014\n\004from\030\002 \001(\014\022\n\n" + "\002to\030\003 \001(\014\022\014\n\004data\030\004 \001(\014\"\'\n\027SendTransacti" + - "onResponse\022\014\n\004hash\030\001 \001(\0142\222\002\n\021Transaction" + - "Ledger\022U\n\014CreateLedger\022!.bdledger.api.Cr" + - "eateLedgerRequest\032\".bdledger.api.CreateL" + - "edgerResponse\022F\n\nGetLedgers\022\026.google.pro" + - "tobuf.Empty\032 .bdledger.api.GetLedgersRes" + - "ponse\022^\n\017SendTransaction\022$.bdledger.api." + - "SendTransactionRequest\032%.bdledger.api.Se" + - "ndTransactionResponseBQ\n\030bdledger.api.gr" + - "pc.ledgerB\013LedgerProtoP\001Z&bdware.org/bdl" + - "edger/pkg/api/grpc/protob\006proto3" + "onResponse\022\014\n\004hash\030\001 \001(\0142\207\002\n\006Ledger\022U\n\014C" + + "reateLedger\022!.bdledger.api.CreateLedgerR" + + "equest\032\".bdledger.api.CreateLedgerRespon" + + "se\022F\n\nGetLedgers\022\026.google.protobuf.Empty" + + "\032 .bdledger.api.GetLedgersResponse\022^\n\017Se" + + "ndTransaction\022$.bdledger.api.SendTransac" + + "tionRequest\032%.bdledger.api.SendTransacti" + + "onResponseBQ\n\030bdledger.api.grpc.ledgerB\013" + + "LedgerProtoP\001Z&bdware.org/bdledger/pkg/a" + + "pi/grpc/protob\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData,