Class BookkeeperVerifier.LedgerInfo

java.lang.Object
org.apache.bookkeeper.verifier.BookkeeperVerifier.LedgerInfo
Enclosing class:
BookkeeperVerifier

class BookkeeperVerifier.LedgerInfo extends Object
Contains the state required to reconstruct the contents of any entry in the ledger. The seed value passed into the constructor fully determines the contents of the ledger. Each EntryInfo has its own seed generated sequentially from a Random instance seeded from the original seed. It then uses that seed to generate a secondary Random instance for generating the bytes within the entry. See EntryIterator for details. Random(seed) | E0 -> Random(E0) -> getBuffer() | E1 -> Random(E1) -> getBuffer() | E2 -> Random(E2) -> getBuffer() | E3 -> Random(E3) -> getBuffer() | E4 -> Random(E4) -> getBuffer() | ...
  • Field Details

  • Constructor Details

    • LedgerInfo

      LedgerInfo(long ledgerID, long seed)
  • Method Details

    • getLastEntryIDCompleted

      long getLastEntryIDCompleted()
    • getConfirmedLAC

      long getConfirmedLAC()
    • getNextEntries

      ArrayList<BookkeeperVerifier.EntryInfo> getNextEntries(int num)
    • getIterator

    • openWrite

      void openWrite(long entryID)
    • incReads

      void incReads()
    • onLastOpComplete

      void onLastOpComplete(Consumer<Integer> cb, Consumer<Consumer<Integer>> newOnLastOp)
      The idea here is that we may need to register an operation which needs to run whenever the final op completes on this Ledger (like deletion). If there are none, newOnLastOp should be called synchronously with cb. Otherwise, cb should be called synchronously with cb and newOnLastOp should be called with the cb passed in with the decReads or closeWrite. In the deletion case, cb would be the callback for the error from the deletion operation (if it happens). The reason for all of this is that the delete case will need to chain an async call to delete into the async callback chain for whatever the last operation to complete on this Ledger. newOnLastOp would invoke that delete. The cb passed in allows it to pick up and continue the original chain.
      Parameters:
      cb - Callback to get result of newOnLastOp if called now
      newOnLastOp - Callback to be invoked on the last decReads or closeWrite, should be passed the cb passed in with the final closeWrite or decReads
    • onLastWriteComplete

      void onLastWriteComplete(Consumer<Integer> cb, Consumer<Consumer<Integer>> newOnLastWrite)
      Very similar to onLastOpComplete, but gets called on the final call to closeWrite.
      Parameters:
      cb - Callback to get result of newOnLastWrite if called now
      newOnLastWrite - Callback to be invoked on the last closeWrite, should be passed the cb passed in with the final closeWrite.
    • closeWrite

      void closeWrite(long entryID, Consumer<Integer> cb)
    • updateLAC

      void updateLAC(long lac)
    • decReads

      void decReads(Consumer<Integer> cb)
    • isClosed

      public boolean isClosed()
    • setClosed

      public void setClosed()