summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/repo/logging
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/amazon/carbonado/repo/logging')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java8
-rw-r--r--src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java
index 611df4f..89e6e21 100644
--- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java
+++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingRepository.java
@@ -31,7 +31,7 @@ import com.amazon.carbonado.TriggerFactory;
import com.amazon.carbonado.capability.Capability;
-import com.amazon.carbonado.spi.StorageCollection;
+import com.amazon.carbonado.spi.StoragePool;
/**
*
@@ -44,7 +44,7 @@ class LoggingRepository implements Repository, LogAccessCapability {
private final Repository mRepo;
private final Log mLog;
- private final StorageCollection mStorages;
+ private final StoragePool mStoragePool;
LoggingRepository(AtomicReference<Repository> rootRef,
Iterable<TriggerFactory> triggerFactories,
@@ -55,7 +55,7 @@ class LoggingRepository implements Repository, LogAccessCapability {
mRepo = actual;
mLog = log;
- mStorages = new StorageCollection() {
+ mStoragePool = new StoragePool() {
protected <S extends Storable> Storage<S> createStorage(Class<S> type)
throws RepositoryException
{
@@ -71,7 +71,7 @@ class LoggingRepository implements Repository, LogAccessCapability {
public <S extends Storable> Storage<S> storageFor(Class<S> type)
throws SupportException, RepositoryException
{
- return mStorages.storageFor(type);
+ return mStoragePool.get(type);
}
public Transaction enterTransaction() {
diff --git a/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java b/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java
index 3f807c2..de1118f 100644
--- a/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java
+++ b/src/main/java/com/amazon/carbonado/repo/logging/LoggingStorage.java
@@ -41,6 +41,14 @@ class LoggingStorage<S extends Storable> extends WrappedStorage<S> {
mRepo = repo;
}
+ public void truncate() throws PersistException {
+ Log log = mRepo.getLog();
+ if (log.isEnabled()) {
+ log.write("Storage.truncate() on " + getStorableType().getClass());
+ }
+ super.truncate();
+ }
+
protected S wrap(S storable) {
return super.wrap(storable);
}