All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.api.DistributedTransactionProvider Maven / Gradle / Ivy

Go to download

A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.api;

import com.scalar.db.config.DatabaseConfig;

/**
 * A class that creates {@link DistributedTransactionManager}, {@link DistributedTransactionAdmin},
 * and {@link TwoPhaseCommitTransactionManager} instances. Each transaction manager should implement
 * this class to instantiate its implementations of {@link DistributedTransactionManager}, {@link
 * DistributedTransactionAdmin}, and {@link TwoPhaseCommitTransactionManager}. The implementations
 * are assumed to be loaded by {@link java.util.ServiceLoader}.
 */
public interface DistributedTransactionProvider {

  /**
   * Returns the name of the adapter. This is for the configuration {@link
   * DatabaseConfig#TRANSACTION_MANAGER}.
   *
   * @return the name of the adapter
   */
  String getName();

  /**
   * Creates an instance of {@link DistributedTransactionManager} for the transaction manager.
   *
   * @param config a database config
   * @return an instance of {@link DistributedTransactionManager} for the transaction manager
   */
  DistributedTransactionManager createDistributedTransactionManager(DatabaseConfig config);

  /**
   * Creates an instance of {@link DistributedTransactionAdmin} for the transaction manager.
   *
   * @param config a database config
   * @return an instance of {@link DistributedTransactionAdmin} for the transaction manager
   */
  DistributedTransactionAdmin createDistributedTransactionAdmin(DatabaseConfig config);

  /**
   * Creates an instance of {@link TwoPhaseCommitTransactionManager} for the transaction manager.
   *
   * @param config a database config
   * @return an instance of {@link TwoPhaseCommitTransactionManager} for the transaction manager
   */
  TwoPhaseCommitTransactionManager createTwoPhaseCommitTransactionManager(DatabaseConfig config);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy