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 Details

    • 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)
      Adds the NitriteId of the FieldValues into the existing indexed list of NitriteIds.
      Parameters:
      nitriteIds - the list of NitriteIds
      fieldValues - 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)
      Removes the NitriteId of the FieldValues from the existing indexed list of NitriteIds.
      Parameters:
      nitriteIds - the list of NitriteIds
      fieldValues - the field values to remove from index
      Returns:
      the list