Interface IndexingStateStorage

All Known Implementing Classes:
SqlIndexingStateStorage

public interface IndexingStateStorage
Manages indexing state persistence and fingerprint generation.

Implementations may be backed by a database (like SqlIndexingStateStorage) or use in-memory storage (like HeapMemoryIndexingStateStorage).

  • Method Details

    • upsertIndexingState

      void upsertIndexingState(String dataSource, String fingerprint, CompactionState indexingState, org.joda.time.DateTime updateTime)
      Upserts an indexing state to storage.

      If a fingerprint already exists, update to reflect proper used state and timestamp. If a fingerprint doesn't exist, inserts a new row with the full state payload.

      Parameters:
      dataSource - The datasource name
      fingerprint - The fingerprint of the indexing state
      indexingState - The indexing state to upsert
      updateTime - The timestamp for this update
    • markUnreferencedIndexingStatesAsUnused

      int markUnreferencedIndexingStatesAsUnused()
      Marks indexing states as unused if they are not referenced by any used segments.

      This is used for cleanup operations.

      Returns:
      Number of rows updated, or 0 if not applicable
    • findReferencedIndexingStateMarkedAsUnused

      List<String> findReferencedIndexingStateMarkedAsUnused()
      Finds all indexing state fingerprints which have been marked as unused but are still referenced by some used segments. This is used for validation/reconciliation. Implementations may return an empty list if not applicable.
      Returns:
      List of fingerprints, or empty list
    • markIndexingStatesAsUsed

      int markIndexingStatesAsUsed(List<String> stateFingerprints)
      Marks indexing states as used.

      This is used for reconciliation operations to avoid deleting states that are still in use.

      Parameters:
      stateFingerprints - List of fingerprints to mark as used
      Returns:
      Number of rows updated, or 0 if not applicable
    • markIndexingStatesAsActive

      int markIndexingStatesAsActive(List<String> stateFingerprints)
      Marks indexing states as active
      Parameters:
      stateFingerprints - List of fingerprints to mark as active
      Returns:
      Number of rows updated, or 0 if not applicable
    • deletePendingIndexingStatesOlderThan

      int deletePendingIndexingStatesOlderThan(long timestamp)
      Deletes pending indexing states older than the given timestamp.
      Parameters:
      timestamp - The cutoff timestamp in milliseconds
      Returns:
      Number of rows deleted, or 0 if not applicable
    • deleteUnusedIndexingStatesOlderThan

      int deleteUnusedIndexingStatesOlderThan(long timestamp)
      Deletes unused indexing states older than the given timestamp.

      This is used for cleanup operations.

      Parameters:
      timestamp - The cutoff timestamp in milliseconds
      Returns:
      Number of rows deleted, or 0 if not applicable