Interface TransactionMeta
@Beta
public interface TransactionMeta
The metadata for the transaction in the transaction buffer.
-
Method Summary
Modifier and TypeMethodDescriptionabortTxn()Mark the transaction is aborted.CompletableFuture<org.apache.bookkeeper.mledger.Position>appendEntry(long sequenceId, org.apache.bookkeeper.mledger.Position position, int batchSize) Add transaction entry into the transaction.longReturn the committed entry id at data ledger.longReturn the committed ledger id at data ledger.Mark the transaction status is committing.commitTxn(long committedAtLedgerId, long committedAtEntryId) Mark the transaction is committed.org.apache.pulsar.client.api.transaction.TxnIDid()Returns the transaction id.longReturn the last sequence id.intReturn the number of entries appended to the transaction.intReturn messages number in one transaction.CompletableFuture<SortedMap<Long,org.apache.bookkeeper.mledger.Position>> readEntries(int num, long startSequenceId) Read the entries from start sequence id.org.apache.pulsar.transaction.coordinator.proto.TxnStatusstatus()Return the status of the transaction.
-
Method Details
-
id
org.apache.pulsar.client.api.transaction.TxnID id()Returns the transaction id.- Returns:
- the transaction id
-
status
org.apache.pulsar.transaction.coordinator.proto.TxnStatus status()Return the status of the transaction.- Returns:
- the status of the transaction
-
numEntries
int numEntries()Return the number of entries appended to the transaction.- Returns:
- the number of entries
-
numMessageInTxn
Return messages number in one transaction.- Returns:
- the number of transaction messages
- Throws:
TransactionException.TransactionStatusException
-
committedAtLedgerId
long committedAtLedgerId()Return the committed ledger id at data ledger.- Returns:
- the committed ledger id
-
committedAtEntryId
long committedAtEntryId()Return the committed entry id at data ledger.- Returns:
- the committed entry id
-
lastSequenceId
long lastSequenceId()Return the last sequence id.- Returns:
- the last sequence id
-
readEntries
CompletableFuture<SortedMap<Long,org.apache.bookkeeper.mledger.Position>> readEntries(int num, long startSequenceId) Read the entries from start sequence id.- Parameters:
num- the entries number need to readstartSequenceId- the start position of the entries- Returns:
-
appendEntry
CompletableFuture<org.apache.bookkeeper.mledger.Position> appendEntry(long sequenceId, org.apache.bookkeeper.mledger.Position position, int batchSize) Add transaction entry into the transaction.- Parameters:
sequenceId- the message sequence idposition- the position of transaction logbatchSize-- Returns:
-
committingTxn
CompletableFuture<TransactionMeta> committingTxn()Mark the transaction status is committing.- Returns:
-
commitTxn
Mark the transaction is committed.- Parameters:
committedAtLedgerId-committedAtEntryId-- Returns:
-
abortTxn
CompletableFuture<TransactionMeta> abortTxn()Mark the transaction is aborted.- Returns:
-