
org.chronos.chronodb.internal.api.MutableTransactionConfiguration Maven / Gradle / Ivy
Show all versions of org.chronos.chronodb.api Show documentation
package org.chronos.chronodb.internal.api;
import org.chronos.chronodb.api.ChronoDB;
import org.chronos.chronodb.api.ChronoDBConstants;
import org.chronos.chronodb.api.ChronoDBTransaction;
import org.chronos.chronodb.api.DuplicateVersionEliminationMode;
import org.chronos.chronodb.api.conflict.ConflictResolutionStrategy;
/**
* The mutable portion of a {@link org.chronos.chronodb.api.ChronoDBTransaction.Configuration}.
*
*
* This class is not part of the public API. Down-casting a configuration to this class means leaving the public API.
*
*
* This class contains methods that are intended for building up the configuration. Once the construction is complete,
* {@link #freeze()} should be called to make the configuration unmodifiable.
*
* @author [email protected] -- Initial Contribution and API
*/
public interface MutableTransactionConfiguration extends TransactionConfigurationInternal {
/**
* Sets the name of the branch on which the resulting transaction should operate.
*
*
* By default, this is set to {@link ChronoDBConstants#MASTER_BRANCH_IDENTIFIER}.
*
* @param branchName The branch name. Must not be null
.
*/
public void setBranch(String branchName);
/**
* Sets the timestamp on which the resulting transaction should operate.
*
*
* By default, this is set to the "now" timestamp of the branch. To reset it to the now timestamp after calling this
* method, please use {@link #setTimestampToNow()}.
*
* @param timestamp The timestamp. Must not be negative.
*/
public void setTimestamp(long timestamp);
/**
* Sets the timestamp on which the resulting transaction should operate to the "now" timestamp of the target branch.
*/
public void setTimestampToNow();
/**
* Enables or disables thread-safety on this transaction.
*
*
* Important note: {@link ChronoDB} instances themselves are always thread-safe. This property only determines if
* the resulting {@link ChronoDBTransaction} itself may be shared among multiple threads or not.
*
* @param threadSafe Set this to true
if thread-safety on the transaction itself is required, otherwise set it
* to false
to disable thread-safety.
*/
public void setThreadSafe(boolean threadSafe);
/**
* Sets the conflict resolution strategy to apply in case of commit conflicts.
*
* @param strategy The strategy to use. Must not be null
.
*/
public void setConflictResolutionStrategy(ConflictResolutionStrategy strategy);
/**
* Sets the {@link DuplicateVersionEliminationMode} on this transaction.
*
* @param mode The mode to use. Must not be null
.
*/
public void setDuplicateVersionEliminationMode(DuplicateVersionEliminationMode mode);
/**
* Sets the read-only mode of this transaction configuration.
*
* @param readOnly Set this to true
if the transaction should be read-only, or to false
if it
* should be read-write.
*/
public void setReadOnly(boolean readOnly);
/**
* Decides if this transaction is allowed to run during a dateback operation.
*
* @param allowedDuringDateback true
if the transaction is permitted during dateback, otherwise false
.
*/
public void setAllowedDuringDateback(boolean allowedDuringDateback);
/**
* "Freezes" the configuration.
*
*
* After calling this method, no further modifications to the transaction configuration will be allowed.
*/
public void freeze();
}