updated lsm harness to implement its proper interface
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_tree@1746 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
index 94f53a4..82b702b 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/api/ILSMHarness.java
@@ -24,42 +24,24 @@
import edu.uci.ics.hyracks.storage.am.common.api.IIndexOpContext;
import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
-import edu.uci.ics.hyracks.storage.am.common.dataflow.IIndex;
-import edu.uci.ics.hyracks.storage.am.lsm.common.freepage.InMemoryFreePageManager;
-import edu.uci.ics.hyracks.storage.am.lsm.common.impls.LSMHarness;
-/**
- * Methods to be implemented by an LSM index, which are called from {@link LSMHarness}.
- * The implementations of the methods below should be thread agnostic.
- * Synchronization of LSM operations like updates/searches/flushes/merges are
- * done by the {@link LSMHarness}. For example, a flush() implementation should only
- * create and return the new on-disk component, ignoring the fact that
- * concurrent searches/updates/merges may be ongoing.
- */
-public interface ILSMHarness extends IIndex {
- public boolean insertUpdateOrDelete(ITupleReference tuple, IIndexOpContext ictx) throws HyracksDataException,
+public interface ILSMHarness {
+ public void insertUpdateOrDelete(ITupleReference tuple, IIndexOpContext ictx) throws HyracksDataException,
IndexException;
- public void search(IIndexCursor cursor, List<Object> diskComponents, ISearchPredicate pred, IIndexOpContext ictx,
- boolean includeMemComponent, AtomicInteger searcherRefCount) throws HyracksDataException, IndexException;
+ public List<Object> search(IIndexCursor cursor, ISearchPredicate pred, IIndexOpContext ctx,
+ boolean includeMemComponent) throws HyracksDataException, IndexException;
- public Object merge(List<Object> mergedComponents) throws HyracksDataException, IndexException;
+ public void closeSearchCursor(AtomicInteger searcherRefCount, boolean includeMemComponent)
+ throws HyracksDataException;
- public void addMergedComponent(Object newComponent, List<Object> mergedComponents);
+ public void merge(ILSMIOOperation operation) throws HyracksDataException, IndexException;
- public void cleanUpAfterMerge(List<Object> mergedComponents) throws HyracksDataException;
+ public void flush(ILSMIOOperation operation) throws HyracksDataException, IndexException;
- public Object flush() throws HyracksDataException, IndexException;
-
- public void addFlushedComponent(Object index);
-
- public InMemoryFreePageManager getInMemoryFreePageManager();
-
- public void resetInMemoryComponent() throws HyracksDataException;
-
- public List<Object> getDiskComponents();
-
- public ILSMComponentFinalizer getComponentFinalizer();
+ public void addBulkLoadedComponent(Object index) throws HyracksDataException;
+
+ public ILSMIndex getIndex();
public ILSMFlushController getFlushController();
diff --git a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
index 44f305e..66ea185 100644
--- a/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
+++ b/hyracks-storage-am-lsm-common/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/common/impls/LSMHarness.java
@@ -29,6 +29,7 @@
import edu.uci.ics.hyracks.storage.am.common.api.ISearchPredicate;
import edu.uci.ics.hyracks.storage.am.common.api.IndexException;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMFlushController;
+import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMHarness;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationCallback;
import edu.uci.ics.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
@@ -46,7 +47,7 @@
* During a merge, all operations (except another merge) can proceed concurrently.
* A merge and a flush can proceed concurrently.
*/
-public class LSMHarness {
+public class LSMHarness implements ILSMHarness {
protected final Logger LOGGER = Logger.getLogger(LSMHarness.class.getName());
protected static final long AFTER_MERGE_CLEANUP_SLEEP = 100;
@@ -221,6 +222,7 @@
isMerging.set(false);
}
+ @Override
public void closeSearchCursor(AtomicInteger searcherRefCount, boolean includeMemComponent)
throws HyracksDataException {
// If the in-memory Tree was not included in the search, then we don't
@@ -261,4 +263,5 @@
public ILSMIndex getIndex() {
return lsmIndex;
}
+
}