io.axway.iron.StoreManager Maven / Gradle / Ivy
package io.axway.iron;
import java.math.BigInteger;
import java.util.*;
import java.util.regex.*;
import javax.annotation.*;
/**
* A store manager permits to open many stores sharing the same model definition but not the same model instances.
*/
public interface StoreManager extends AutoCloseable {
/**
* Any store name used in the {@link #getStore(String)} method must comply with this pattern.
*/
Pattern STORE_NAME_VALIDATOR_PATTERN = Pattern.compile("[\\w-]+");
/**
* @return the stores already existing in this StoreManager
*/
Set listStores();
/**
* Retrieves a store. If the store already exists it's recovered from the latest snapshot and from the command redolog. Else a new store is created.
*
* @param storeName the name of the store
* @return the {@link Store}
*/
Store getStore(String storeName);
/**
* Create a new snapshot of all stores created by this manager.
*
* A recent snapshot permits to speedup store recovery.
*
* No new snapshot is created if no change was made in the stores since the last snapshot was created.
*
* @return the transaction ID of the snapshot or {@code null} if no new snapshot was created
*/
@Nullable
BigInteger snapshot();
/**
* Close the stores, mainly stop the redolog processing thread.
*/
void close();
/**
* Change readonly state
* If switching to active then a snapshot is automatically made
*
* @param active if true then switch to readonly else resume to nominal mode
*/
void setReadonly(boolean active);
/**
* The transaction ID of the latest snapshot.
*
* @return the transaction ID of the last created snapshot
*/
BigInteger lastSnapshotTransactionId();
boolean isReadonly();
}