|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teiid.internal.core.index.MergeFactory
public class MergeFactory
A mergeFactory is used to merge 2 indexes into one. One of the indexes
(oldIndex) is on the disk and the other(addsIndex) is in memory.
The merge respects the following rules:
- The files are sorted in alphabetical order;
- if a file is in oldIndex and addsIndex, the one which is added
is the one in the addsIndex.
| Field Summary | |
|---|---|
static int |
ADDS_INDEX
|
protected IndexInput |
addsInput
Input on the addsIndex. |
protected int[] |
mappingAdds
|
protected int[] |
mappingOld
|
protected BlocksIndexOutput |
mergeOutput
Output to write the result of the merge in. |
static int |
OLD_INDEX
|
protected IndexInput |
oldInput
Input on the oldIndex. |
protected java.util.Map |
removedInAdds
Files removed from addsIndex. |
protected java.util.Map |
removedInOld
Files removed from oldIndex. |
| Constructor Summary | |
|---|---|
MergeFactory(IndexInput oldIndexInput,
IndexInput addsIndexInput,
BlocksIndexOutput mergeIndexOutput,
java.util.Map removedInOld,
java.util.Map removedInAdds)
MergeFactory constructor comment. |
|
| Method Summary | |
|---|---|
protected void |
init()
Initialise the merge. |
void |
merge()
Merges the 2 indexes into a new one on the disk. |
protected void |
mergeFiles()
Merges the files of the 2 indexes in the new index, removes the files to be removed, and records the changes made to propagate them to the word references. |
protected void |
mergeReferences()
Merges the files of the 2 indexes in the new index, according to the changes recorded during mergeFiles(). |
protected void |
removeFile(IndexedFile file,
int index)
Records the deletion of one file. |
protected boolean |
wasRemoved(IndexedFile indexedFile,
int index)
Returns whether the given file has to be removed from the given index (ADDS_INDEX or OLD_INDEX). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected IndexInput addsInput
protected IndexInput oldInput
protected BlocksIndexOutput mergeOutput
protected java.util.Map removedInOld
protected java.util.Map removedInAdds
protected int[] mappingOld
protected int[] mappingAdds
public static final int ADDS_INDEX
public static final int OLD_INDEX
| Constructor Detail |
|---|
public MergeFactory(IndexInput oldIndexInput,
IndexInput addsIndexInput,
BlocksIndexOutput mergeIndexOutput,
java.util.Map removedInOld,
java.util.Map removedInAdds)
directory - java.io.File| Method Detail |
|---|
protected void init()
public void merge()
throws java.io.IOException
java.io.IOException
protected void mergeFiles()
throws java.io.IOException
java.io.IOException
protected void mergeReferences()
throws java.io.IOException
java.io.IOException
protected void removeFile(IndexedFile file,
int index)
protected boolean wasRemoved(IndexedFile indexedFile,
int index)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||