use of com.jd.blockchain.ledger.core.EventAccountSet 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 com.jd.blockchain.ledger.core.EventAccountSet 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 com.jd.blockchain.ledger.core.EventAccountSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getUserEventNameTotalCount.
@RequestMapping(method = RequestMethod.GET, path = GET_EVENT_SUBJECT_COUNT)
@Override
public long getUserEventNameTotalCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "address") String address) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
EventAccountSet eventAccountSet = ledger.getEventAccountSet(ledger.getLatestBlock());
EventPublishingAccount account = eventAccountSet.getAccount(address);
if (null == account) {
return 0;
}
return account.totalEventNames();
}
use of com.jd.blockchain.ledger.core.EventAccountSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getUserEventAccounts.
@RequestMapping(method = RequestMethod.GET, path = GET_EVENT_ACCOUNT_SEQUENCE)
@Override
public BlockchainIdentity[] getUserEventAccounts(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @RequestParam(name = "fromIndex", required = false, defaultValue = "0") int fromIndex, @RequestParam(name = "count", required = false, defaultValue = "-1") int count) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
EventAccountSet eventAccountSet = ledger.getEventAccountSet(ledger.getLatestBlock());
QueryArgs queryArgs = QueryUtils.calFromIndexAndCount(fromIndex, count, (int) eventAccountSet.getTotal());
SkippingIterator<BlockchainIdentity> it = eventAccountSet.identityIterator();
it.skip(queryArgs.getFrom());
return it.next(queryArgs.getCount(), BlockchainIdentity.class);
}
use of com.jd.blockchain.ledger.core.EventAccountSet in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getUserEventAccount.
@RequestMapping(method = RequestMethod.GET, path = GET_EVENT_ACCOUNT)
@Override
public EventPublishingAccount getUserEventAccount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "address") String address) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
EventAccountSet eventAccountSet = ledger.getEventAccountSet(ledger.getLatestBlock());
return eventAccountSet.getAccount(address);
}
Aggregations