use of com.jd.blockchain.ledger.core.EventGroup in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getSystemEvents.
@RequestMapping(method = RequestMethod.GET, path = GET_SYSTEM_EVENT_SEQUENCE)
@Override
public Event[] getSystemEvents(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "eventName") String eventName, @RequestParam(name = "fromSequence", required = false, defaultValue = "0") long fromSequence, @RequestParam(name = "count", required = false, defaultValue = "-1") int count) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
EventGroup systemEvents = ledger.getSystemEventGroup(block);
return systemEvents.getEvents(eventName, fromSequence, count);
}
use of com.jd.blockchain.ledger.core.EventGroup in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getSystemEventNameTotalCount.
@RequestMapping(method = RequestMethod.GET, path = GET_SYSTEM_EVENT_SUBJECT_COUNT)
@Override
public long getSystemEventNameTotalCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
EventGroup systemEvents = ledger.getSystemEventGroup(block);
return systemEvents.totalEventNames();
}
use of com.jd.blockchain.ledger.core.EventGroup in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getSystemEventNames.
@RequestMapping(method = RequestMethod.GET, path = GET_SYSTEM_EVENT_SUBJECTS)
@Override
public String[] getSystemEventNames(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @RequestParam(name = "fromIndex", required = false, defaultValue = "0") int fromIndex, @RequestParam(name = "maxCount", required = false, defaultValue = "-1") int count) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
EventGroup systemEvents = ledger.getSystemEventGroup(block);
QueryArgs queryArgs = QueryUtils.calFromIndexAndCount(fromIndex, count, (int) systemEvents.totalEventNames());
return systemEvents.getEventNames(queryArgs.getFrom(), queryArgs.getCount());
}
use of com.jd.blockchain.ledger.core.EventGroup in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getLatestSystemEvent.
@RequestMapping(method = RequestMethod.GET, path = GET_LATEST_SYSTEM_EVENT)
@Override
public Event getLatestSystemEvent(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "eventName") String eventName) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
EventGroup systemEvents = ledger.getSystemEventGroup(block);
return systemEvents.getLatest(eventName);
}
use of com.jd.blockchain.ledger.core.EventGroup in project jdchain-core by blockchain-jd-com.
the class LedgerQueryController method getSystemEventsTotalCount.
@RequestMapping(method = RequestMethod.GET, path = GET_SYSTEM_EVENT_COUNT)
@Override
public long getSystemEventsTotalCount(@PathVariable(name = "ledgerHash") HashDigest ledgerHash, @PathVariable(name = "eventName") String eventName) {
LedgerQuery ledger = ledgerService.getLedger(ledgerHash);
LedgerBlock block = ledger.getLatestBlock();
EventGroup systemEvents = ledger.getSystemEventGroup(block);
return systemEvents.totalEvents(eventName);
}
Aggregations