Class BookkeeperVerifier.LedgerInfo

  • Enclosing class:
    BookkeeperVerifier

    class BookkeeperVerifier.LedgerInfo
    extends java.lang.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() | ...
    • Constructor Summary

      Constructors 
      Constructor Description
      LedgerInfo​(long ledgerID, long seed)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void closeWrite​(long entryID, java.util.function.Consumer<java.lang.Integer> cb)  
      (package private) void decReads​(java.util.function.Consumer<java.lang.Integer> cb)  
      (package private) long getConfirmedLAC()  
      (package private) BookkeeperVerifier.LedgerInfo.EntryIterator getIterator()  
      (package private) long getLastEntryIDCompleted()  
      (package private) java.util.ArrayList<BookkeeperVerifier.EntryInfo> getNextEntries​(int num)  
      (package private) void incReads()  
      boolean isClosed()  
      (package private) void onLastOpComplete​(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.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).
      (package private) void onLastWriteComplete​(java.util.function.Consumer<java.lang.Integer> cb, java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> newOnLastWrite)
      Very similar to onLastOpComplete, but gets called on the final call to closeWrite.
      (package private) void openWrite​(long entryID)  
      void setClosed()  
      (package private) void updateLAC​(long lac)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • writesInProgress

        final java.util.TreeSet<java.lang.Long> writesInProgress
      • writesCompleted

        final java.util.TreeSet<java.lang.Long> writesCompleted
      • readsInProgress

        int readsInProgress
      • onLastOp

        java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> onLastOp
      • onLastWrite

        java.util.function.Consumer<java.util.function.Consumer<java.lang.Integer>> onLastWrite
    • Constructor Detail

      • LedgerInfo

        LedgerInfo​(long ledgerID,
                   long seed)
    • Method Detail

      • getLastEntryIDCompleted

        long getLastEntryIDCompleted()
      • getConfirmedLAC

        long getConfirmedLAC()
      • openWrite

        void openWrite​(long entryID)
      • incReads

        void incReads()
      • onLastOpComplete

        void onLastOpComplete​(java.util.function.Consumer<java.lang.Integer> cb,
                              java.util.function.Consumer<java.util.function.Consumer<java.lang.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​(java.util.function.Consumer<java.lang.Integer> cb,
                                 java.util.function.Consumer<java.util.function.Consumer<java.lang.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,
                        java.util.function.Consumer<java.lang.Integer> cb)
      • updateLAC

        void updateLAC​(long lac)
      • decReads

        void decReads​(java.util.function.Consumer<java.lang.Integer> cb)
      • isClosed

        public boolean isClosed()
      • setClosed

        public void setClosed()