package com.atlassian.stash.internal.crowd;

/**
 * Encapsulates a transaction used to process a batch of Crowd updates.
 * <p>
 * {@link #commit()} or {@link #rollback()} should be invoked <i>exactly once</i> for each batch. Multiple invocations
 * will result in exceptions.
 *
 * @since 2.4.2
 */
public interface BatchTransaction {

    /**
     * Commits the transaction.
     *
     * @throws IllegalStateException if the transaction has already been committed or rolled back
     * @throws org.springframework.dao.DataAccessException if the transaction cannot be committed
     */
    void commit();

    /**
     * Rolls back the transaction.
     *
     * @throws IllegalStateException if the transaction has already been committed or rolled back
     * @throws org.springframework.dao.DataAccessException if the transaction cannot be rolled back
     */
    void rollback();
}
