Interface LuceneIndexSnapshotManager

All Known Implementing Classes:
DefaultLuceneIndexSnapshotManager

public interface LuceneIndexSnapshotManager
Manage Lucene index snapshots.
Since:
7.6.0
  • Method Details

    • create

      LuceneIndexSnapshot create(JournalIdentifier journalIdentifier)
      Create a new Lucene index snapshot for given journal (index)
      Parameters:
      journalIdentifier - Identifier of a journal of which a snapshot will be created
      Returns:
      newly created snapshot, its content can be accessed by getFile(LuceneIndexSnapshot)
      Throws:
      LuceneIndexSnapshotException - if there is error creating the snapshot e.g. not enough space
    • restore

      void restore(LuceneIndexSnapshot luceneIndexSnapshot)
      Restore a Lucene snapshot for given journal (index) to the current node
      Parameters:
      luceneIndexSnapshot - snapshot to restore
      Throws:
      LuceneIndexSnapshotException - if there is not enough space or any error restoring from the snapshot
    • findForJournal

      List<LuceneIndexSnapshot> findForJournal(JournalIdentifier journalIdentifier)
      Returns:
      all snapshots created for given journal (index) in chronological order (desc)
    • find

      Optional<LuceneIndexSnapshot> find(JournalIdentifier journalIdentifier, long journalEntryId)
      Find a specific index snapshot corresponding to a journal entry ID. This method returns immediately. Note: In certain network filesystem it may take a while after a snapshot file is created by a node until it is visible to other nodes. If you want to find a newly created snapshot and wait until it becomes visible, use find(JournalIdentifier, long, long)
      Parameters:
      journalIdentifier - Identifier of a journal of which a snapshot will be created
      journalEntryId - place in journal when snapshot was created
    • find

      Optional<LuceneIndexSnapshot> find(JournalIdentifier journalIdentifier, long journalEntryId, long waitTimeMs) throws InterruptedException
      Find a specific index snapshot corresponding to a journal entry ID. If it cannot be found immediately then this method will wait until it becomes visible or certain time has passed.
      Parameters:
      journalIdentifier - Identifier of a journal of which a snapshot will be created
      journalEntryId - place in journal when snapshot was created
      waitTimeMs - max time to wait until the snapshot file is available
      Returns:
      Location of the zipped snapshot in file system if found within waitTimeMs or empty
      Throws:
      InterruptedException
    • delete

      void delete(LuceneIndexSnapshot snapshot) throws IOException
      Delete an index snapshot from file system. Do nothing if the snapshot doesn't exist
      Parameters:
      snapshot - The snapshot to be deleted
      Throws:
      IOException - If there is error deleting the snapshot file
    • getFile

      Optional<Path> getFile(LuceneIndexSnapshot snapshot)
      Obtain location of an index snapshot.
      Parameters:
      snapshot - Index snapshot to be accessed
      Returns:
      Location of the zipped snapshot in file system