diff options
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/replicated')
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java | 8 | ||||
-rw-r--r-- | src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedStorage.java | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java index 3b215bc..2c73200 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java @@ -53,7 +53,7 @@ import com.amazon.carbonado.info.Direction; import com.amazon.carbonado.info.StorableInfo;
import com.amazon.carbonado.info.StorableIntrospector;
-import com.amazon.carbonado.spi.StorageCollection;
+import com.amazon.carbonado.spi.StoragePool;
import com.amazon.carbonado.spi.TransactionPair;
import com.amazon.carbonado.util.Throttle;
@@ -140,7 +140,7 @@ class ReplicatedRepository private Repository mReplicaRepository;
private Repository mMasterRepository;
- private final StorageCollection mStorages;
+ private final StoragePool mStoragePool;
ReplicatedRepository(String aName,
Repository aReplicaRepository,
@@ -149,7 +149,7 @@ class ReplicatedRepository mReplicaRepository = aReplicaRepository;
mMasterRepository = aMasterRepository;
- mStorages = new StorageCollection() {
+ mStoragePool = new StoragePool() {
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws SupportException, RepositoryException
{
@@ -199,7 +199,7 @@ class ReplicatedRepository public <S extends Storable> Storage<S> storageFor(Class<S> type)
throws MalformedTypeException, SupportException, RepositoryException
{
- return mStorages.storageFor(type);
+ return mStoragePool.get(type);
}
public Transaction enterTransaction() {
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedStorage.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedStorage.java index 9711784..5d3f47b 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedStorage.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedStorage.java @@ -21,6 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.Query;
import com.amazon.carbonado.Storage;
import com.amazon.carbonado.Storable;
@@ -105,6 +106,11 @@ class ReplicatedStorage<S extends Storable> implements Storage<S> { return mReplicaStorage.query(filter);
}
+ public void truncate() throws PersistException {
+ mMasterStorage.truncate();
+ mReplicaStorage.truncate();
+ }
+
public boolean addTrigger(Trigger<? super S> trigger) {
return mReplicationTrigger.addTrigger(trigger);
}
|