use of utils.query.QueryArgs in project jdchain-core by blockchain-jd-com.
the class ContractLedgerQueryService method getDataEntries.
@Override
public TypedKVEntry[] getDataEntries(String address, int fromIndex, int count) {
DataAccountSet dataAccountSet = ledgerQuery.getDataAccountSet();
DataAccount dataAccount = dataAccountSet.getAccount(Bytes.fromBase58(address));
QueryArgs queryArgs = QueryUtils.calFromIndexAndCount(fromIndex, count, (int) dataAccount.getDataset().getDataCount());
SkippingIterator<DataEntry<String, TypedValue>> iterator = ((IteratorDataset) dataAccount.getDataset()).kvIterator();
iterator.skip(queryArgs.getFrom());
TypedKVEntry[] typedKVEntries = iterator.next(queryArgs.getCount(), TypedKVEntry.class, entry -> new TypedKVData(entry.getKey(), entry.getVersion(), entry.getValue()));
return typedKVEntries;
}
use of utils.query.QueryArgs in project jdchain-core by blockchain-jd-com.
the class ContractLedgerQueryService method getUserEventAccounts.
@Override
public BlockchainIdentity[] getUserEventAccounts(int fromIndex, int count) {
EventAccountSet eventAccountSet = ledgerQuery.getLedgerEventSet().getEventAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) eventAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = eventAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of utils.query.QueryArgs in project jdchain-core by blockchain-jd-com.
the class UncommittedLedgerQueryService method getUserEventAccounts.
@Override
public BlockchainIdentity[] getUserEventAccounts(int fromIndex, int count) {
EventAccountSet eventAccountSet = transactionContext.getEventSet().getEventAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) eventAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = eventAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of utils.query.QueryArgs in project jdchain-core by blockchain-jd-com.
the class UncommittedLedgerQueryService method getContractAccounts.
@Override
public BlockchainIdentity[] getContractAccounts(int fromIndex, int count) {
ContractAccountSet contractAccountSet = transactionContext.getDataset().getContractAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) contractAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = contractAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of utils.query.QueryArgs in project jdchain-core by blockchain-jd-com.
the class UncommittedLedgerQueryService method getDataAccounts.
@Override
public BlockchainIdentity[] getDataAccounts(int fromIndex, int count) {
DataAccountSet dataAccountSet = transactionContext.getDataset().getDataAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) dataAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = dataAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
Aggregations