Class LedgerEntriesImpl

java.lang.Object
org.apache.bookkeeper.client.impl.LedgerEntriesImpl
All Implemented Interfaces:
AutoCloseable, Iterable<LedgerEntry>, LedgerEntries

public class LedgerEntriesImpl extends Object implements LedgerEntries
Ledger entries implementation. It is a simple wrap of a list of ledger entries.
  • Method Details

    • create

      public static LedgerEntriesImpl create(List<LedgerEntry> entries)
      Create ledger entries.
      Parameters:
      entries - the entries with ordering
      Returns:
      the LedgerEntriesImpl
    • getEntry

      public LedgerEntry getEntry(long entryId)
      Gets a specific LedgerEntry by entryId.
      Specified by:
      getEntry in interface LedgerEntries
      Parameters:
      entryId - the LedgerEntry id
      Returns:
      the LedgerEntry, null if no LedgerEntry with such entryId
    • iterator

      public Iterator<LedgerEntry> iterator()
      Get an iterator over all the ledger entries contained in the LedgerEntries object.

      Calling this method does not modify the reference count of the ByteBuf in the returned LedgerEntry objects. The caller who calls LedgerEntries.iterator() should make sure that they do not call ByteBuf.release() on the LedgerEntry objects to avoid a double free. All reference counts will be decremented when the containing LedgerEntries object is closed via LedgerEntries.close().

      Specified by:
      iterator in interface Iterable<LedgerEntry>
      Specified by:
      iterator in interface LedgerEntries
      Returns:
      an iterator of LedgerEntry objects
    • close

      public void close()
      Description copied from interface: LedgerEntries
      Close to release the resources held by this instance.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface LedgerEntries