Interface TransactionMetadataStore

All Known Implementing Classes:
MLTransactionMetadataStore

@Beta public interface TransactionMetadataStore
A store for storing all the transaction metadata.
  • Method Details

    • getTxnStatus

      default CompletableFuture<TxnStatus> getTxnStatus(org.apache.pulsar.client.api.transaction.TxnID txnid)
      Query the TxnStatus of a given transaction txnid.
      Parameters:
      txnid - transaction id
      Returns:
      a future represents the result of this operation. it returns TxnStatus of the given transaction.
    • getTxnMeta

      CompletableFuture<TxnMeta> getTxnMeta(org.apache.pulsar.client.api.transaction.TxnID txnid)
      Query the TxnMeta of a given transaction txnid.
      Parameters:
      txnid - transaction id
      Returns:
      a future represents the result of this operation. it returns TxnMeta of the given transaction.
    • newTransaction

      CompletableFuture<org.apache.pulsar.client.api.transaction.TxnID> newTransaction(long timeoutInMills, String owner)
      Create a new transaction in the transaction metadata store.
      Parameters:
      timeoutInMills - the timeout duration of the transaction in mills
      owner - the role which is the owner of the transaction
      Returns:
      a future represents the result of creating a new transaction. it returns TxnID as the identifier for identifying the transaction.
    • addProducedPartitionToTxn

      CompletableFuture<Void> addProducedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<String> partitions)
      Add the produced partitions to transaction identified by txnid.
      Parameters:
      txnid - transaction id
      partitions - the list of partitions that a transaction produces to
      Returns:
      a future represents the result of this operation
    • addAckedPartitionToTxn

      CompletableFuture<Void> addAckedPartitionToTxn(org.apache.pulsar.client.api.transaction.TxnID txnid, List<TransactionSubscription> partitions)
      Add the acked partitions to transaction identified by txnid.
      Parameters:
      txnid - transaction id
      partitions - the list of partitions that a transaction acknowledge to
      Returns:
      a future represents the result of the operation
    • updateTxnStatus

      CompletableFuture<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 - TxnID for update txn status
      newStatus - the new txn status that the transaction should be updated to
      expectedStatus - the expected status that the transaction should be
      isTimeout - 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 long the lowWaterMark
    • getTransactionCoordinatorID

      TransactionCoordinatorID getTransactionCoordinatorID()
      Get the transaction coordinator id.
      Returns:
      transaction coordinator id
    • getCoordinatorStats

      TransactionCoordinatorStats getCoordinatorStats()
      Get the transaction metadata store stats.
      Returns:
      TransactionCoordinatorStats TransactionCoordinatorStats
    • closeAsync

      CompletableFuture<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
    • getAttributes

      default TransactionMetadataStoreAttributes getAttributes()
      Get the transaction metadata store OpenTelemetry attributes.
      Returns:
      TransactionMetadataStoreAttributes TransactionMetadataStoreAttributes
    • getSlowTransactions

      List<TxnMeta> getSlowTransactions(long timeout)
      Get the transactions witch timeout is bigger than given timeout.
      Returns:
      TxnMeta the txnMetas of slow transactions