Class TransactionEntryImpl
java.lang.Object
org.apache.pulsar.broker.transaction.buffer.impl.TransactionEntryImpl
- All Implemented Interfaces:
AutoCloseable,org.apache.bookkeeper.mledger.Entry,TransactionEntry
A simple implementation of
TransactionEntry.-
Constructor Summary
ConstructorsConstructorDescriptionTransactionEntryImpl(org.apache.pulsar.client.api.transaction.TxnID txnId, long sequenceId, org.apache.bookkeeper.mledger.Entry entry, long committedAtLedgerId, long committedAtEntryId, int numMessageInTxn) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the entry to release the resource that it holds.longThe entry id that the transaction is committed to.longThe ledger id that the transaction is committed to.byte[]getData()byte[]io.netty.buffer.ByteBuforg.apache.bookkeeper.mledger.EntrygetEntry()Returns the entry saved in theTransactionBuffer.longlongintorg.apache.bookkeeper.mledger.Positionintintbooleanrelease()longThe 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.
-
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: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 interfaceAutoCloseable- 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
-