Class PulsarMockLedgerHandle

  • All Implemented Interfaces:
    AutoCloseable, org.apache.bookkeeper.client.api.ForceableHandle, org.apache.bookkeeper.client.api.Handle, org.apache.bookkeeper.client.api.ReadHandle, org.apache.bookkeeper.client.api.WriteHandle

    public class PulsarMockLedgerHandle
    extends org.apache.bookkeeper.client.LedgerHandle
    Mock BK LedgerHandle. Used by PulsarMockBookKeeper.
    • Field Summary

      • Fields inherited from class org.apache.bookkeeper.client.LedgerHandle

        INVALID_ENTRY_ID, INVALID_LEDGER_ID
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long addEntry​(byte[] data)  
      void asyncAddEntry​(byte[] data, int offset, int length, org.apache.bookkeeper.client.AsyncCallback.AddCallback cb, Object ctx)  
      void asyncAddEntry​(byte[] data, org.apache.bookkeeper.client.AsyncCallback.AddCallback cb, Object ctx)  
      void asyncAddEntry​(io.netty.buffer.ByteBuf data, org.apache.bookkeeper.client.AsyncCallback.AddCallback cb, Object ctx)  
      void asyncClose​(org.apache.bookkeeper.client.AsyncCallback.CloseCallback cb, Object ctx)  
      void asyncReadEntries​(long firstEntry, long lastEntry, org.apache.bookkeeper.client.AsyncCallback.ReadCallback cb, Object ctx)  
      long getId()  
      long getLastAddConfirmed()  
      long getLength()  
      boolean isClosed()  
      CompletableFuture<org.apache.bookkeeper.client.api.LedgerEntries> readAsync​(long firstEntry, long lastEntry)  
      CompletableFuture<org.apache.bookkeeper.client.api.LastConfirmedAndEntry> readLastAddConfirmedAndEntryAsync​(long entryId, long timeOutInMillis, boolean parallel)  
      CompletableFuture<Long> readLastAddConfirmedAsync()  
      CompletableFuture<org.apache.bookkeeper.client.api.LedgerEntries> readUnconfirmedAsync​(long firstEntry, long lastEntry)  
      CompletableFuture<Long> tryReadLastAddConfirmedAsync()  
      • Methods inherited from class org.apache.bookkeeper.client.LedgerHandle

        addEntry, addEntry, addEntry, appendAsync, asyncAddEntry, asyncAddEntry, asyncAddEntry, asyncAddEntry, asyncReadExplicitLastConfirmed, asyncReadLastConfirmed, asyncReadLastConfirmedAndEntry, asyncReadLastEntry, asyncReadUnconfirmedEntries, asyncTryReadLastConfirmed, close, closeAsync, doAsyncAddEntry, force, getCtime, getCustomMetadata, getLastAddPushed, getLedgerKey, getLedgerMetadata, getNumBookies, getNumFragments, getWriteFlags, initializeWriteHandleState, readEntries, readExplicitLastConfirmed, readLastConfirmed, readLastEntry, readUnconfirmedEntries, tryReadLastConfirmed, waitForWritable
      • Methods inherited from interface org.apache.bookkeeper.client.api.ReadHandle

        read, readLastAddConfirmed, readLastAddConfirmedAndEntry, readUnconfirmed, tryReadLastAddConfirmed
      • Methods inherited from interface org.apache.bookkeeper.client.api.WriteHandle

        append, append, append, append, appendAsync, appendAsync, appendAsync
    • Method Detail

      • asyncClose

        public void asyncClose​(org.apache.bookkeeper.client.AsyncCallback.CloseCallback cb,
                               Object ctx)
        Overrides:
        asyncClose in class org.apache.bookkeeper.client.LedgerHandle
      • asyncReadEntries

        public void asyncReadEntries​(long firstEntry,
                                     long lastEntry,
                                     org.apache.bookkeeper.client.AsyncCallback.ReadCallback cb,
                                     Object ctx)
        Overrides:
        asyncReadEntries in class org.apache.bookkeeper.client.LedgerHandle
      • addEntry

        public long addEntry​(byte[] data)
                      throws InterruptedException,
                             org.apache.bookkeeper.client.BKException
        Overrides:
        addEntry in class org.apache.bookkeeper.client.LedgerHandle
        Throws:
        InterruptedException
        org.apache.bookkeeper.client.BKException
      • asyncAddEntry

        public void asyncAddEntry​(byte[] data,
                                  org.apache.bookkeeper.client.AsyncCallback.AddCallback cb,
                                  Object ctx)
        Overrides:
        asyncAddEntry in class org.apache.bookkeeper.client.LedgerHandle
      • asyncAddEntry

        public void asyncAddEntry​(byte[] data,
                                  int offset,
                                  int length,
                                  org.apache.bookkeeper.client.AsyncCallback.AddCallback cb,
                                  Object ctx)
        Overrides:
        asyncAddEntry in class org.apache.bookkeeper.client.LedgerHandle
      • asyncAddEntry

        public void asyncAddEntry​(io.netty.buffer.ByteBuf data,
                                  org.apache.bookkeeper.client.AsyncCallback.AddCallback cb,
                                  Object ctx)
        Overrides:
        asyncAddEntry in class org.apache.bookkeeper.client.LedgerHandle
      • getId

        public long getId()
        Specified by:
        getId in interface org.apache.bookkeeper.client.api.Handle
        Overrides:
        getId in class org.apache.bookkeeper.client.LedgerHandle
      • getLastAddConfirmed

        public long getLastAddConfirmed()
        Specified by:
        getLastAddConfirmed in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        getLastAddConfirmed in class org.apache.bookkeeper.client.LedgerHandle
      • getLength

        public long getLength()
        Specified by:
        getLength in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        getLength in class org.apache.bookkeeper.client.LedgerHandle
      • readAsync

        public CompletableFuture<org.apache.bookkeeper.client.api.LedgerEntries> readAsync​(long firstEntry,
                                                                                           long lastEntry)
        Specified by:
        readAsync in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        readAsync in class org.apache.bookkeeper.client.LedgerHandle
      • readUnconfirmedAsync

        public CompletableFuture<org.apache.bookkeeper.client.api.LedgerEntries> readUnconfirmedAsync​(long firstEntry,
                                                                                                      long lastEntry)
        Specified by:
        readUnconfirmedAsync in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        readUnconfirmedAsync in class org.apache.bookkeeper.client.LedgerHandle
      • readLastAddConfirmedAsync

        public CompletableFuture<Long> readLastAddConfirmedAsync()
        Specified by:
        readLastAddConfirmedAsync in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        readLastAddConfirmedAsync in class org.apache.bookkeeper.client.LedgerHandle
      • tryReadLastAddConfirmedAsync

        public CompletableFuture<Long> tryReadLastAddConfirmedAsync()
        Specified by:
        tryReadLastAddConfirmedAsync in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        tryReadLastAddConfirmedAsync in class org.apache.bookkeeper.client.LedgerHandle
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        isClosed in class org.apache.bookkeeper.client.LedgerHandle
      • readLastAddConfirmedAndEntryAsync

        public CompletableFuture<org.apache.bookkeeper.client.api.LastConfirmedAndEntry> readLastAddConfirmedAndEntryAsync​(long entryId,
                                                                                                                           long timeOutInMillis,
                                                                                                                           boolean parallel)
        Specified by:
        readLastAddConfirmedAndEntryAsync in interface org.apache.bookkeeper.client.api.ReadHandle
        Overrides:
        readLastAddConfirmedAndEntryAsync in class org.apache.bookkeeper.client.LedgerHandle