Package com.apple.foundationdb.record
Class IndexEntry
- java.lang.Object
-
- com.apple.foundationdb.record.IndexEntry
-
@API(MAINTAINED) public class IndexEntry extends Object
AnIndexEntry
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
Constructors Constructor Description IndexEntry(Index index, Key.Evaluated key)
IndexEntry(Index index, Key.Evaluated key, Key.Evaluated value)
IndexEntry(Index index, Tuple key, Tuple value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Index
getIndex()
Get the index associated with this entry.Tuple
getKey()
Get the key portion of the index entry.Key.Evaluated.NullStandin
getKeyNullType(int idx)
Get the type of null stored in a given key index location.int
getKeySize()
Object
getKeyValue(int idx)
Get a tuple element of the key tuple.Tuple
getPrimaryKey()
Get the primary key of the record associated with this entry.Tuple
getValue()
Get the value portion of the index entry.int
hashCode()
boolean
keyContainsNonUniqueNull()
Returns true if the key expression contains a NULL value that is not aKey.Evaluated.NullStandin.NULL_UNIQUE
value.IndexEntry
subKey(int startIdx, int endIdx)
Produces a newIndexEntry
whose key is a subset of thisIndexEntry
.String
toString()
void
validateInIndex(Index index)
Validate that this entry is associated with the given index.
-
-
-
Constructor Detail
-
IndexEntry
@API(INTERNAL) public IndexEntry(@Nonnull Index index, @Nonnull Key.Evaluated key, @Nonnull Key.Evaluated value)
-
-
Method Detail
-
getIndex
@Nonnull public Index 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
@Nonnull public Tuple 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:
getPrimaryKey()
-
getValue
@Nonnull public Tuple 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
@Nonnull public Tuple 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
@Nullable public Object getKeyValue(int idx)
Get a tuple element of the key tuple.- Parameters:
idx
- the index of the desired element- Returns:
- the tuple element at index
idx
-
validateInIndex
@API(INTERNAL) public void validateInIndex(@Nonnull Index index)
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
@Nonnull public Key.Evaluated.NullStandin getKeyNullType(int idx)
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
@Nonnull public IndexEntry subKey(int startIdx, int endIdx)
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
-
-