Package org.dizitart.no2.index
Interface NitriteIndex
public interface NitriteIndex
The NitriteIndex interface represents an index in Nitrite database. It provides methods to write, remove and find
NitriteIds from the index. It also provides methods to drop the index and validate the index field.
- Since:
- 4.0
- Author:
- Anindya Chatterjee
-
Method Summary
Modifier and TypeMethodDescriptionaddNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues) voiddrop()Drops the index.findNitriteIds(FindPlan findPlan) Finds the NitriteIds from the index for the given find plan.Gets index descriptor.default booleanisUnique()Checks if the index is unique.voidremove(FieldValues fieldValues) Removes the index entry for the specified field values.removeNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues) default voidvalidateIndexField(Object value, String field) Validates the index field.voidwrite(FieldValues fieldValues) Writes the given field values to the index.
-
Method Details
-
getIndexDescriptor
IndexDescriptor getIndexDescriptor()Gets index descriptor.- Returns:
- the index descriptor
-
write
Writes the given field values to the index.- Parameters:
fieldValues- the field values to write.
-
remove
Removes the index entry for the specified field values.- Parameters:
fieldValues- the field values to remove the index entry for.
-
drop
void drop()Drops the index. -
findNitriteIds
Finds the NitriteIds from the index for the given find plan.- Parameters:
findPlan- the find plan- Returns:
- the linked hash set
-
isUnique
default boolean isUnique()Checks if the index is unique.- Returns:
- true if the index is unique, false otherwise.
-
validateIndexField
Validates the index field.- Parameters:
value- the value to be validated.field- the name of the field to be validated.- Throws:
ValidationException- if the index field is not a comparable type.
-
addNitriteIds
- Parameters:
nitriteIds- the list of NitriteIdsfieldValues- the field values to index- Returns:
- the updated list of NitriteIds
- Throws:
UniqueConstraintException- if the index is unique and the key already exists
-
removeNitriteIds
- Parameters:
nitriteIds- the list of NitriteIdsfieldValues- the field values to remove from index- Returns:
- the list
-