| Modifier and Type | Class and Description |
|---|---|
static class |
IndexImpl.ForeignKeyReference
Information about a foreign key reference defined in an index (when
referential integrity should be enforced).
|
Index.Column| Modifier and Type | Field and Description |
|---|---|
private IndexData |
_data
the actual data backing this index (more than one index may be backed by
the same data
|
private int |
_indexNumber
0-based index number
|
private byte |
_indexType
the type of the index
|
private java.lang.String |
_name
Index name
|
private IndexImpl.ForeignKeyReference |
_reference
foreign key reference info, if any
|
private static byte |
CASCADE_DELETES_FLAG
flag for indicating that deletes should cascade in a foreign key index
|
private static byte |
CASCADE_UPDATES_FLAG
flag for indicating that updates should cascade in a foreign key index
|
static byte |
FOREIGN_KEY_INDEX_TYPE
index type for foreign key indexes
|
private static int |
INVALID_INDEX_NUMBER
indicate an invalid index number for foreign key field
|
protected static org.apache.commons.logging.Log |
LOG |
static byte |
PRIMARY_KEY_INDEX_TYPE
index type for primary key indexes
|
private static byte |
PRIMARY_TABLE_TYPE
index table type for the "primary" table in a foreign key index
|
| Modifier | Constructor and Description |
|---|---|
protected |
IndexImpl(java.nio.ByteBuffer tableBuffer,
java.util.List<IndexData> indexDatas,
JetFormat format) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(IndexImpl other) |
java.lang.Object[] |
constructIndexRow(java.util.Map<java.lang.String,?> row)
Constructs an array of values appropriate for this index from the given
column values.
|
java.lang.Object[] |
constructIndexRow(java.lang.String colName,
java.lang.Object value)
Constructs an array of values appropriate for this index from the given
column value.
|
java.lang.Object[] |
constructIndexRowFromEntry(java.lang.Object... values)
Constructs an array of values appropriate for this index from the given
column values, expected to match the columns for this index.
|
IndexData.EntryCursor |
cursor()
Gets a new cursor for this index.
|
IndexData.EntryCursor |
cursor(java.lang.Object[] startRow,
boolean startInclusive,
java.lang.Object[] endRow,
boolean endInclusive)
Gets a new cursor for this index, narrowed to the range defined by the
given startRow and endRow.
|
java.util.List<IndexData.ColumnDescriptor> |
getColumns() |
JetFormat |
getFormat() |
IndexData |
getIndexData() |
byte |
getIndexFlags() |
int |
getIndexNumber() |
java.lang.String |
getName() |
PageChannel |
getPageChannel() |
IndexImpl.ForeignKeyReference |
getReference() |
IndexImpl |
getReferencedIndex() |
TableImpl |
getTable() |
int |
getUniqueEntryCount() |
int |
getUniqueEntryCountOffset() |
void |
initialize()
Forces initialization of this index (actual parsing of index pages).
|
boolean |
isForeignKey() |
boolean |
isInitialized()
Whether or not the complete index state has been read.
|
boolean |
isPrimaryKey() |
boolean |
isUnique()
Whether or not index entries must be unique.
|
CursorBuilder |
newCursor()
Convenience method for constructing a new CursorBuilder for this Index.
|
(package private) void |
setName(java.lang.String name) |
boolean |
shouldIgnoreNulls()
Whether or not
null values are actually recorded in the index. |
java.lang.String |
toString() |
private java.lang.String |
withErrorContext(java.lang.String msg) |
private static java.lang.String |
withErrorContext(java.lang.String msg,
DatabaseImpl db,
java.lang.String idxName) |
protected static void |
writeDefinitions(TableCreator creator,
java.nio.ByteBuffer buffer)
Writes the logical index definitions into a table definition buffer.
|
protected static final org.apache.commons.logging.Log LOG
public static final byte PRIMARY_KEY_INDEX_TYPE
public static final byte FOREIGN_KEY_INDEX_TYPE
private static final byte CASCADE_UPDATES_FLAG
private static final byte CASCADE_DELETES_FLAG
private static final byte PRIMARY_TABLE_TYPE
private static final int INVALID_INDEX_NUMBER
private final IndexData _data
private final int _indexNumber
private final byte _indexType
private java.lang.String _name
private final IndexImpl.ForeignKeyReference _reference
public IndexData getIndexData()
public JetFormat getFormat()
public PageChannel getPageChannel()
public int getIndexNumber()
public byte getIndexFlags()
public int getUniqueEntryCount()
public int getUniqueEntryCountOffset()
void setName(java.lang.String name)
public boolean isPrimaryKey()
isPrimaryKey in interface Indexpublic boolean isForeignKey()
isForeignKey in interface Indexpublic IndexImpl.ForeignKeyReference getReference()
public IndexImpl getReferencedIndex() throws java.io.IOException
getReferencedIndex in interface Indexnull.java.io.IOExceptionpublic boolean shouldIgnoreNulls()
Indexnull values are actually recorded in the index.shouldIgnoreNulls in interface Indexpublic boolean isUnique()
IndexSome notes about uniqueness:
null entries
invalid for a unique indexpublic java.util.List<IndexData.ColumnDescriptor> getColumns()
getColumns in interface Indexpublic CursorBuilder newCursor()
Indexpublic boolean isInitialized()
public void initialize()
throws java.io.IOException
java.io.IOExceptionpublic IndexData.EntryCursor cursor() throws java.io.IOException
Forces index initialization.
java.io.IOExceptionpublic IndexData.EntryCursor cursor(java.lang.Object[] startRow, boolean startInclusive, java.lang.Object[] endRow, boolean endInclusive) throws java.io.IOException
Forces index initialization.
startRow - the first row of data for the cursor, or null for
the first entrystartInclusive - whether or not startRow is inclusive or exclusiveendRow - the last row of data for the cursor, or null for
the last entryendInclusive - whether or not endRow is inclusive or exclusivejava.io.IOExceptionpublic java.lang.Object[] constructIndexRowFromEntry(java.lang.Object... values)
java.lang.IllegalArgumentException - if the wrong number of values are
providedpublic java.lang.Object[] constructIndexRow(java.lang.String colName,
java.lang.Object value)
null if not all
columns for this index were providedpublic java.lang.Object[] constructIndexRow(java.util.Map<java.lang.String,?> row)
null if not all
columns for this index were providedpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(IndexImpl other)
compareTo in interface java.lang.Comparable<IndexImpl>protected static void writeDefinitions(TableCreator creator, java.nio.ByteBuffer buffer) throws java.io.IOException
creator - description of the indexes to writebuffer - Buffer to write tojava.io.IOExceptionprivate java.lang.String withErrorContext(java.lang.String msg)
private static java.lang.String withErrorContext(java.lang.String msg,
DatabaseImpl db,
java.lang.String idxName)