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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<NitriteId>
addNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues)
void
drop()
Drops the index.LinkedHashSet<NitriteId>
findNitriteIds(FindPlan findPlan)
Finds the NitriteIds from the index for the given find plan.IndexDescriptor
getIndexDescriptor()
Gets index descriptor.default boolean
isUnique()
Checks if the index is unique.void
remove(FieldValues fieldValues)
Removes the index entry for the specified field values.default List<NitriteId>
removeNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues)
default void
validateIndexField(Object value, String field)
Validates the index field.void
write(FieldValues fieldValues)
Writes the given field values to the index.
-
-
-
Method Detail
-
getIndexDescriptor
IndexDescriptor getIndexDescriptor()
Gets index descriptor.- Returns:
- the index descriptor
-
write
void write(FieldValues fieldValues)
Writes the given field values to the index.- Parameters:
fieldValues
- the field values to write.
-
remove
void remove(FieldValues fieldValues)
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
LinkedHashSet<NitriteId> findNitriteIds(FindPlan findPlan)
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
default void validateIndexField(Object value, String field)
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
default List<NitriteId> addNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues)
- 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
default List<NitriteId> removeNitriteIds(List<NitriteId> nitriteIds, FieldValues fieldValues)
- Parameters:
nitriteIds
- the list of NitriteIdsfieldValues
- the field values to remove from index- Returns:
- the list
-
-