Interface TransactionMeta
-
@Beta public interface TransactionMetaThe metadata for the transaction in the transaction buffer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<TransactionMeta>abortTxn()Mark the transaction is aborted.java.util.concurrent.CompletableFuture<org.apache.bookkeeper.mledger.Position>appendEntry(long sequenceId, org.apache.bookkeeper.mledger.Position position, int batchSize)Add transaction entry into the transaction.longcommittedAtEntryId()Return the committed entry id at data ledger.longcommittedAtLedgerId()Return the committed ledger id at data ledger.java.util.concurrent.CompletableFuture<TransactionMeta>committingTxn()Mark the transaction status is committing.java.util.concurrent.CompletableFuture<TransactionMeta>commitTxn(long committedAtLedgerId, long committedAtEntryId)Mark the transaction is committed.org.apache.pulsar.client.api.transaction.TxnIDid()Returns the transaction id.longlastSequenceId()Return the last sequence id.intnumEntries()Return the number of entries appended to the transaction.intnumMessageInTxn()Return messages number in one transaction.java.util.concurrent.CompletableFuture<java.util.SortedMap<java.lang.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 Detail
-
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
int numMessageInTxn() throws TransactionException.TransactionStatusExceptionReturn 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
java.util.concurrent.CompletableFuture<java.util.SortedMap<java.lang.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
java.util.concurrent.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
java.util.concurrent.CompletableFuture<TransactionMeta> committingTxn()
Mark the transaction status is committing.- Returns:
-
commitTxn
java.util.concurrent.CompletableFuture<TransactionMeta> commitTxn(long committedAtLedgerId, long committedAtEntryId)
Mark the transaction is committed.- Parameters:
committedAtLedgerId-committedAtEntryId-- Returns:
-
abortTxn
java.util.concurrent.CompletableFuture<TransactionMeta> abortTxn()
Mark the transaction is aborted.- Returns:
-
-