Class LedgerDescriptor

  • Direct Known Subclasses:
    LedgerDescriptorImpl

    public abstract class LedgerDescriptor
    extends java.lang.Object
    Implements a ledger inside a bookie. In particular, it implements operations to write entries to a ledger and read entries from a ledger.
    • Constructor Detail

      • LedgerDescriptor

        public LedgerDescriptor()
    • Method Detail

      • create

        static LedgerDescriptor create​(byte[] masterKey,
                                       long ledgerId,
                                       LedgerStorage ledgerStorage)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • createLedgerFenceEntry

        static io.netty.buffer.ByteBuf createLedgerFenceEntry​(java.lang.Long ledgerId)
      • checkAccess

        abstract void checkAccess​(byte[] masterKey)
                           throws BookieException,
                                  java.io.IOException
        Throws:
        BookieException
        java.io.IOException
      • getLedgerId

        abstract long getLedgerId()
      • setFenced

        abstract boolean setFenced()
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • fenceAndLogInJournal

        abstract java.util.concurrent.CompletableFuture<java.lang.Boolean> fenceAndLogInJournal​(Journal journal)
                                                                                         throws java.io.IOException
        When we fence a ledger, we need to first set ledger to fenced state in memory and then log the fence entry in Journal so that we can rebuild the state.

        We should satisfy the future only after we complete logging fence entry in Journal

        Returns:
        Throws:
        java.io.IOException
      • addEntry

        abstract long addEntry​(io.netty.buffer.ByteBuf entry)
                        throws java.io.IOException,
                               BookieException
        Throws:
        java.io.IOException
        BookieException
      • readEntry

        abstract io.netty.buffer.ByteBuf readEntry​(long entryId)
                                            throws java.io.IOException,
                                                   BookieException
        Throws:
        java.io.IOException
        BookieException
      • waitForLastAddConfirmedUpdate

        abstract boolean waitForLastAddConfirmedUpdate​(long previousLAC,
                                                       Watcher<LastAddConfirmedUpdateNotification> watcher)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • setExplicitLac

        abstract void setExplicitLac​(io.netty.buffer.ByteBuf entry)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • getExplicitLac

        abstract io.netty.buffer.ByteBuf getExplicitLac()
                                                 throws java.io.IOException,
                                                        BookieException
        Throws:
        java.io.IOException
        BookieException
      • getListOfEntriesOfLedger

        abstract java.util.PrimitiveIterator.OfLong getListOfEntriesOfLedger​(long ledgerId)
                                                                      throws java.io.IOException
        Throws:
        java.io.IOException