Class TransactionEntryImpl
- java.lang.Object
-
- org.apache.pulsar.broker.transaction.buffer.impl.TransactionEntryImpl
-
- All Implemented Interfaces:
java.lang.AutoCloseable,org.apache.bookkeeper.mledger.Entry,TransactionEntry
public class TransactionEntryImpl extends java.lang.Object implements TransactionEntry
A simple implementation ofTransactionEntry.
-
-
Constructor Summary
Constructors Constructor Description TransactionEntryImpl(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, org.apache.bookkeeper.mledger.Entry entry, long committedAtLedgerId, long committedAtEntryId, int numMessageInTxn)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the entry to release the resource that it holds.longcommittedAtEntryId()The entry id that the transaction is committed to.longcommittedAtLedgerId()The ledger id that the transaction is committed to.byte[]getData()byte[]getDataAndRelease()io.netty.buffer.ByteBufgetDataBuffer()org.apache.bookkeeper.mledger.EntrygetEntry()Returns the entry saved in theTransactionBuffer.longgetEntryId()longgetLedgerId()intgetLength()org.apache.bookkeeper.mledger.PositiongetPosition()intgetStartBatchIndex()intnumMessageInTxn()booleanrelease()longsequenceId()The sequence id of this entry in this transaction.voidsetStartBatchIndex(int startBatchIndex)org.apache.pulsar.client.api.transaction.TxnIDtxnId()The transaction id that the entry is appended to.
-
-
-
Method Detail
-
txnId
public org.apache.pulsar.client.api.transaction.TxnID txnId()
Description copied from interface:TransactionEntryThe transaction id that the entry is appended to.- Specified by:
txnIdin interfaceTransactionEntry- Returns:
- the transaction id
-
sequenceId
public long sequenceId()
Description copied from interface:TransactionEntryThe sequence id of this entry in this transaction.- Specified by:
sequenceIdin interfaceTransactionEntry- Returns:
- the sequence id
-
numMessageInTxn
public int numMessageInTxn()
- Specified by:
numMessageInTxnin interfaceTransactionEntry
-
committedAtLedgerId
public long committedAtLedgerId()
Description copied from interface:TransactionEntryThe ledger id that the transaction is committed to.- Specified by:
committedAtLedgerIdin interfaceTransactionEntry- Returns:
- the ledger id that the transaction is committed to.
-
committedAtEntryId
public long committedAtEntryId()
Description copied from interface:TransactionEntryThe entry id that the transaction is committed to.- Specified by:
committedAtEntryIdin interfaceTransactionEntry- Returns:
- the entry id that the transaction is committed to.
-
getEntry
public org.apache.bookkeeper.mledger.Entry getEntry()
Description copied from interface:TransactionEntryReturns the entry saved in theTransactionBuffer.- Specified by:
getEntryin interfaceTransactionEntry- Returns:
- the
Entry.
-
setStartBatchIndex
public void setStartBatchIndex(int startBatchIndex)
-
getStartBatchIndex
public int getStartBatchIndex()
-
close
public void close()
Description copied from interface:TransactionEntryClose the entry to release the resource that it holds.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceTransactionEntry
-
getData
public byte[] getData()
- Specified by:
getDatain interfaceorg.apache.bookkeeper.mledger.Entry
-
getDataAndRelease
public byte[] getDataAndRelease()
- Specified by:
getDataAndReleasein interfaceorg.apache.bookkeeper.mledger.Entry
-
getLength
public int getLength()
- Specified by:
getLengthin interfaceorg.apache.bookkeeper.mledger.Entry
-
getDataBuffer
public io.netty.buffer.ByteBuf getDataBuffer()
- Specified by:
getDataBufferin interfaceorg.apache.bookkeeper.mledger.Entry
-
getPosition
public org.apache.bookkeeper.mledger.Position getPosition()
- Specified by:
getPositionin interfaceorg.apache.bookkeeper.mledger.Entry
-
getLedgerId
public long getLedgerId()
- Specified by:
getLedgerIdin interfaceorg.apache.bookkeeper.mledger.Entry
-
getEntryId
public long getEntryId()
- Specified by:
getEntryIdin interfaceorg.apache.bookkeeper.mledger.Entry
-
release
public boolean release()
- Specified by:
releasein interfaceorg.apache.bookkeeper.mledger.Entry
-
-