Class TransactionEntryImpl

java.lang.Object
org.apache.pulsar.broker.transaction.buffer.impl.TransactionEntryImpl
All Implemented Interfaces:
AutoCloseable, org.apache.bookkeeper.mledger.Entry, TransactionEntry

public class TransactionEntryImpl extends Object implements TransactionEntry
A simple implementation of TransactionEntry.
  • Constructor Details

    • TransactionEntryImpl

      public TransactionEntryImpl(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, org.apache.bookkeeper.mledger.Entry entry, long committedAtLedgerId, long committedAtEntryId, int numMessageInTxn)
  • Method Details

    • txnId

      public org.apache.pulsar.client.api.transaction.TxnID txnId()
      Description copied from interface: TransactionEntry
      The transaction id that the entry is appended to.
      Specified by:
      txnId in interface TransactionEntry
      Returns:
      the transaction id
    • sequenceId

      public long sequenceId()
      Description copied from interface: TransactionEntry
      The sequence id of this entry in this transaction.
      Specified by:
      sequenceId in interface TransactionEntry
      Returns:
      the sequence id
    • numMessageInTxn

      public int numMessageInTxn()
      Specified by:
      numMessageInTxn in interface TransactionEntry
    • committedAtLedgerId

      public long committedAtLedgerId()
      Description copied from interface: TransactionEntry
      The ledger id that the transaction is committed to.
      Specified by:
      committedAtLedgerId in interface TransactionEntry
      Returns:
      the ledger id that the transaction is committed to.
    • committedAtEntryId

      public long committedAtEntryId()
      Description copied from interface: TransactionEntry
      The entry id that the transaction is committed to.
      Specified by:
      committedAtEntryId in interface TransactionEntry
      Returns:
      the entry id that the transaction is committed to.
    • getEntry

      public org.apache.bookkeeper.mledger.Entry getEntry()
      Description copied from interface: TransactionEntry
      Returns the entry saved in the TransactionBuffer.
      Specified by:
      getEntry in interface TransactionEntry
      Returns:
      the Entry.
    • setStartBatchIndex

      public void setStartBatchIndex(int startBatchIndex)
    • getStartBatchIndex

      public int getStartBatchIndex()
    • close

      public void close()
      Description copied from interface: TransactionEntry
      Close the entry to release the resource that it holds.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface TransactionEntry
    • getData

      public byte[] getData()
      Specified by:
      getData in interface org.apache.bookkeeper.mledger.Entry
    • getDataAndRelease

      public byte[] getDataAndRelease()
      Specified by:
      getDataAndRelease in interface org.apache.bookkeeper.mledger.Entry
    • getLength

      public int getLength()
      Specified by:
      getLength in interface org.apache.bookkeeper.mledger.Entry
    • getDataBuffer

      public io.netty.buffer.ByteBuf getDataBuffer()
      Specified by:
      getDataBuffer in interface org.apache.bookkeeper.mledger.Entry
    • getPosition

      public org.apache.bookkeeper.mledger.Position getPosition()
      Specified by:
      getPosition in interface org.apache.bookkeeper.mledger.Entry
    • getLedgerId

      public long getLedgerId()
      Specified by:
      getLedgerId in interface org.apache.bookkeeper.mledger.Entry
    • getEntryId

      public long getEntryId()
      Specified by:
      getEntryId in interface org.apache.bookkeeper.mledger.Entry
    • release

      public boolean release()
      Specified by:
      release in interface org.apache.bookkeeper.mledger.Entry