| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.mvstore.db; |
| 7 |
|
| 8 |
import java.util.List; |
| 9 |
|
| 10 |
import org.h2.index.Index; |
| 11 |
import org.h2.index.IndexType; |
| 12 |
import org.h2.mvstore.MVMap; |
| 13 |
import org.h2.result.Row; |
| 14 |
import org.h2.table.IndexColumn; |
| 15 |
import org.h2.table.Table; |
| 16 |
import org.h2.value.VersionedValue; |
| 17 |
|
| 18 |
/** |
| 19 |
* An index that stores the data in an MVStore. |
| 20 |
*/ |
| 21 |
public abstract class MVIndex<K,V> extends Index { |
| 22 |
|
| 23 |
protected MVIndex(Table newTable, int id, String name, IndexColumn[] newIndexColumns, int uniqueColumnCount, |
| 24 |
IndexType newIndexType) { |
| 25 |
super(newTable, id, name, newIndexColumns, uniqueColumnCount, newIndexType); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Add the rows to a temporary storage (not to the index yet). The rows are |
| 30 |
* sorted by the index columns. This is to more quickly build the index. |
| 31 |
* |
| 32 |
* @param rows the rows |
| 33 |
* @param bufferName the name of the temporary storage |
| 34 |
*/ |
| 35 |
public abstract void addRowsToBuffer(List<Row> rows, String bufferName); |
| 36 |
|
| 37 |
/** |
| 38 |
* Add all the index data from the buffers to the index. The index will |
| 39 |
* typically use merge sort to add the data more quickly in sorted order. |
| 40 |
* |
| 41 |
* @param bufferNames the names of the temporary storage |
| 42 |
*/ |
| 43 |
public abstract void addBufferedRows(List<String> bufferNames); |
| 44 |
|
| 45 |
public abstract MVMap<K,VersionedValue<V>> getMVMap(); |
| 46 |
|
| 47 |
} |