use of com.jd.blockchain.ledger.core.UserAccountSet in project jdchain-core by blockchain-jd-com.
the class ContractLedgerQueryService method getUsers.
@Override
public BlockchainIdentity[] getUsers(int fromIndex, int count) {
UserAccountSet userAccountSet = ledgerQuery.getUserAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) userAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = userAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of com.jd.blockchain.ledger.core.UserAccountSet in project jdchain-core by blockchain-jd-com.
the class UncommittedLedgerQueryService method getUsers.
@Override
public BlockchainIdentity[] getUsers(int fromIndex, int count) {
UserAccountSet userAccountSet = transactionContext.getDataset().getUserAccountSet();
QueryArgs queryArgs = QueryUtils.calFromIndexAndCountDescend(fromIndex, count, (int) userAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = userAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of com.jd.blockchain.ledger.core.UserAccountSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getUser.
@RequestMapping(method = RequestMethod.GET, path = GET_USER)
@Override
public UserInfo getUser(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "address") String address) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
UserAccountSet userAccountSet = ledger.getUserAccountSet(block);
return userAccountSet.getAccount(address);
}
use of com.jd.blockchain.ledger.core.UserAccountSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getUserCount.
@RequestMapping(method = RequestMethod.GET, path = GET_USER_COUNT_ON_BLOCK_HEIGHT)
@Override
public long getUserCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "blockHeight") long height) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getBlock(height);
if (null == block) {
return 0;
}
UserAccountSet userAccountSet = ledger.getUserAccountSet(block);
return userAccountSet.getTotal();
}
Aggregations