Interface TransactionMetadataStore

  • All Known Implementing Classes:
    MLTransactionMetadataStore

    @Beta
    public interface TransactionMetadataStore
    A 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.TransactionCoordinatorStats getCoordinatorStats()
      Get the transaction metadata store stats.
      default long getLowWaterMark()
      Get the low water mark of this tc, in order to delete unless transaction in transaction buffer and pending ack.
      TransactionMetadataStoreStats getMetadataStoreStats()
      Get the transaction metadata store stats.
      java.util.List<TxnMeta> getSlowTransactions​(long timeout)
      Get the transactions witch timeout is bigger than given timeout.
      TransactionCoordinatorID getTransactionCoordinatorID()
      Get the transaction coordinator id.
      java.util.concurrent.CompletableFuture<TxnMeta> getTxnMeta​(org.apache.pulsar.client.api.transaction.TxnID txnid)
      Query the TxnMeta of a given transaction txnid.
      default java.util.concurrent.CompletableFuture<TxnStatus> getTxnStatus​(org.apache.pulsar.client.api.transaction.TxnID txnid)
      Query the TxnStatus of 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 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

        java.util.concurrent.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

        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 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

        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 id
        partitions - 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 id
        partitions - 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 - 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

        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
      • getSlowTransactions

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