Package com.apple.foundationdb.record
Class IndexEntry
java.lang.Object
com.apple.foundationdb.record.IndexEntry
An
IndexEntry
carries around the key and value read from an index (as the name would imply).
Further, if the key and value were produced by applying an index key expression to a record, this will carry
around additional information about the nulls contained in the expression.-
Constructor Summary
ConstructorsConstructorDescriptionIndexEntry
(Index index, Key.Evaluated key) IndexEntry
(Index index, Key.Evaluated key, Key.Evaluated value) IndexEntry
(Index index, Tuple key, Tuple value) IndexEntry
(Index index, Tuple key, Tuple value, Tuple primaryKey) -
Method Summary
Modifier and TypeMethodDescriptionboolean
getIndex()
Get the index associated with this entry.getKey()
Get the key portion of the index entry.getKeyNullType
(int idx) Get the type of null stored in a given key index location.int
getKeyValue
(int idx) Get a tuple element of the key tuple.Get the primary key of the record associated with this entry.getValue()
Get the value portion of the index entry.int
hashCode()
boolean
Returns true if the key expression contains a NULL value that is not aKey.Evaluated.NullStandin.NULL_UNIQUE
value.subKey
(int startIdx, int endIdx) Produces a newIndexEntry
whose key is a subset of thisIndexEntry
.toString()
void
validateInIndex
(Index index) Validate that this entry is associated with the given index.
-
Constructor Details
-
IndexEntry
@API(INTERNAL) public IndexEntry(@Nonnull Index index, @Nonnull Key.Evaluated key, @Nonnull Key.Evaluated value) -
IndexEntry
-
IndexEntry
-
IndexEntry
-
-
Method Details
-
getIndex
Get the index associated with this entry. This entry was either created in order to store within this index or it was constructed from reading this index.- Returns:
- the index associated with this entry
-
getKey
Get the key portion of the index entry. This is stored in the key portion of the key-value pair in the database. Index entries are generally sorted by key, and this key must be unique for all entries in an index. As a result, it generally contains the primary key of its associated record as a sub-component.- Returns:
- the key portion of the index entry
- See Also:
-
getValue
Get the value portion of the index entry. This is stored in the value portion of the key-value pair in the database. Index entries are not sorted by value, but the user might configure indexes to have additional fields in the index value in order to increase the number of queries that can be satisfied without needing to resolve the underlying record.- Returns:
- the value portion of the index entry
-
getKeySize
public int getKeySize() -
getPrimaryKey
Get the primary key of the record associated with this entry. Note that some indexes, such as the atomic mutation indexes, erase the primary key information from the indexes they store. In that case, this method might not return a reasonable result.- Returns:
- the primary key of the record that produced this index entry
-
getKeyValue
Get a tuple element of the key tuple.- Parameters:
idx
- the index of the desired element- Returns:
- the tuple element at index
idx
-
validateInIndex
Validate that this entry is associated with the given index.- Parameters:
index
- the index this entry should be a member of
-
keyContainsNonUniqueNull
public boolean keyContainsNonUniqueNull()Returns true if the key expression contains a NULL value that is not aKey.Evaluated.NullStandin.NULL_UNIQUE
value. Calling this method on aIndexEntry
that was created directly from tuples will result in an exception.- Returns:
true
if the key contains a non-unique null value
-
getKeyNullType
Get the type of null stored in a given key index location. Calling this method on anIndexEntry
that was created directly from tuples, or if the value atidx
is not null, will result in an exception.- Parameters:
idx
- the index of a null element- Returns:
- the type of null stored at
idx
-
subKey
Produces a newIndexEntry
whose key is a subset of thisIndexEntry
.- Parameters:
startIdx
- the starting offset of the key to use for the new valueendIdx
- the ending offset (exclusive) of the key to use for the new value- Returns:
- a new index entry with the subset key between
startIdx
andendIdx
-
equals
-
hashCode
public int hashCode() -
toString
-