Interface TransactionMetadataStore
-
- All Known Implementing Classes:
MLTransactionMetadataStore
@Beta public interface TransactionMetadataStoreA store for storing all the transaction metadata.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Void>addAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, java.util.List<TransactionSubscription> partitions)Add the acked partitions to transaction identified by txnid.java.util.concurrent.CompletableFuture<java.lang.Void>addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, java.util.List<java.lang.String> partitions)Add the produced partitions to transaction identified by txnid.java.util.concurrent.CompletableFuture<java.lang.Void>closeAsync()Close the transaction metadata store.org.apache.pulsar.common.policies.data.TransactionCoordinatorStatsgetCoordinatorStats()Get the transaction metadata store stats.default longgetLowWaterMark()Get the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.TransactionMetadataStoreStatsgetMetadataStoreStats()Get the transaction metadata store stats.java.util.List<TxnMeta>getSlowTransactions(long timeout)Get the transactions witch timeout is bigger than given timeout.TransactionCoordinatorIDgetTransactionCoordinatorID()Get the transaction coordinator id.java.util.concurrent.CompletableFuture<TxnMeta>getTxnMeta(org.apache.pulsar.client.api.transaction.TxnID txnid)Query theTxnMetaof a given transaction txnid.default java.util.concurrent.CompletableFuture<TxnStatus>getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid)Query theTxnStatusof a given transaction txnid.java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID>newTransaction(long timeoutInMills, java.lang.String owner)Create a new transaction in the transaction metadata store.java.util.concurrent.CompletableFuture<java.lang.Void>updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout)Update the transaction from expectedStatus to newStatus.
-
-
-
Method Detail
-
getTxnStatus
default java.util.concurrent.CompletableFuture<TxnStatus> getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid)
Query theTxnStatusof a given transaction txnid.- Parameters:
txnid- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnStatusof the given transaction.
-
getTxnMeta
java.util.concurrent.CompletableFuture<TxnMeta> getTxnMeta(org.apache.pulsar.client.api.transaction.TxnID txnid)
Query theTxnMetaof a given transaction txnid.- Parameters:
txnid- transaction id- Returns:
- a future represents the result of this operation.
it returns
TxnMetaof the given transaction.
-
newTransaction
java.util.concurrent.CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID> newTransaction(long timeoutInMills, java.lang.String owner)Create a new transaction in the transaction metadata store.- Parameters:
timeoutInMills- the timeout duration of the transaction in millsowner- the role which is the owner of the transaction- Returns:
- a future represents the result of creating a new transaction.
it returns
TxnIDas the identifier for identifying the transaction.
-
addProducedPartitionToTxn
java.util.concurrent.CompletableFuture<java.lang.Void> addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, java.util.List<java.lang.String> partitions)Add the produced partitions to transaction identified by txnid.- Parameters:
txnid- transaction idpartitions- the list of partitions that a transaction produces to- Returns:
- a future represents the result of this operation
-
addAckedPartitionToTxn
java.util.concurrent.CompletableFuture<java.lang.Void> addAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, java.util.List<TransactionSubscription> partitions)Add the acked partitions to transaction identified by txnid.- Parameters:
txnid- transaction idpartitions- the list of partitions that a transaction acknowledge to- Returns:
- a future represents the result of the operation
-
updateTxnStatus
java.util.concurrent.CompletableFuture<java.lang.Void> updateTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid, TxnStatus newStatus, TxnStatus expectedStatus, boolean isTimeout)Update the transaction from expectedStatus to newStatus.If the current transaction status is not expectedStatus, the update will be failed.
- Parameters:
txnid-TxnIDfor update txn statusnewStatus- the new txn status that the transaction should be updated toexpectedStatus- the expected status that the transaction should beisTimeout- the update txn status operation is it timeout- Returns:
- a future represents the result of the operation
-
getLowWaterMark
default long getLowWaterMark()
Get the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.- Returns:
- long
longthe lowWaterMark
-
getTransactionCoordinatorID
TransactionCoordinatorID getTransactionCoordinatorID()
Get the transaction coordinator id.- Returns:
- transaction coordinator id
-
getCoordinatorStats
org.apache.pulsar.common.policies.data.TransactionCoordinatorStats getCoordinatorStats()
Get the transaction metadata store stats.- Returns:
- TransactionCoordinatorStats
TransactionCoordinatorStats
-
closeAsync
java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
Close the transaction metadata store.- Returns:
- a future represents the result of this operation
-
getMetadataStoreStats
TransactionMetadataStoreStats getMetadataStoreStats()
Get the transaction metadata store stats.- Returns:
- TransactionMetadataStoreStats
TransactionMetadataStoreStats
-
-