@Override public String toString() { return String.format("Version = %d, Epoch = %d, LedgerCount = %d, Truncate = (%d-%d)", this.updateVersion.get(), this.epoch, this.ledgers.size(), this.truncationAddress.getLedgerId(), this.truncationAddress.getEntryId()); }
@Override public String toString() { return String.format("%s, LedgerId = %d, EntryId = %d", super.toString(), this.ledgerId, getEntryId()); }
} else if (address.getEntryId() < lastEntryId) { result = new LedgerAddress(address.getLedgerSequence(), address.getLedgerId(), address.getEntryId() + 1); } else {
if (lastEntryId < address.getEntryId()) { try { val reader = Exceptions.handleInterruptedCall( () -> ledger.readEntries(address.getEntryId(), lastEntryId)); previousLedger = this.currentLedger; this.currentLedger = new ReadLedger(metadata, ledger, reader);
private void assertEquals(LedgerAddress a, int ledgerSeq, long ledgerId, long entryId) { Assert.assertEquals("Unexpected ledger sequence.", ledgerSeq, a.getLedgerSequence()); Assert.assertEquals("Unexpected ledger id.", ledgerId, a.getLedgerId()); Assert.assertEquals("Unexpected entry id.", entryId, a.getEntryId()); } }
LedgerAddress a = m.getNextAddress(new LedgerAddress(firstLedgerSeq - 1, firstLedgerId - 1, 1234), Long.MAX_VALUE); Assert.assertEquals("Unexpected ledger id when input address less than first ledger.", firstLedgerId, a.getLedgerId()); Assert.assertEquals("Unexpected entry id when input address less than first ledger.", 0, a.getEntryId()); Assert.assertEquals("Unexpected entry id when result should be in the same ledger.", 1, a.getEntryId()); val nextLm = m.getLedgers().get(i + 1); Assert.assertEquals("Unexpected ledger id when result should be in the next ledger.", nextLm.getLedgerId(), a.getLedgerId()); Assert.assertEquals("Unexpected entry id when result should be in the next ledger.", 0, a.getEntryId()); Assert.assertEquals("Unexpected entry id when result should be in the next ledger.", 0, a.getEntryId());