PersistentSnapshotDeletionPolicy
A SnapshotDeletionPolicy which adds a persistence layer so that snapshots can be maintained across the life of an application. The snapshots are persisted in a Directory and are committed as soon as snapshot or release is called.
NOTE: Sharing [PersistentSnapshotDeletionPolicy]s that write to the same directory across [IndexWriter]s will corrupt snapshots. You should make sure every [IndexWriter] has its own [PersistentSnapshotDeletionPolicy] and that they all write to a different [Directory]. It is OK to use the same Directory that holds the index.
This class adds a [release] method to release commits from a previous snapshot's [IndexCommit.generation].
Constructors
PersistentSnapshotDeletionPolicy wraps another IndexDeletionPolicy to enable flexible snapshotting, passing OpenMode.CREATE_OR_APPEND by default.
PersistentSnapshotDeletionPolicy wraps another IndexDeletionPolicy to enable flexible snapshotting.
Functions
Retrieve an IndexCommit from its generation; returns null if this IndexCommit is not currently snapshotted
Returns the file name the snapshots are currently saved to, or null if no snapshots have been saved.
Returns the total number of snapshots currently held.
Returns all IndexCommits held by at least one snapshot.
This is called each time the writer completed a commit. This gives the policy a chance to remove old commit points with each commit.
This is called once when a writer is first instantiated to give the policy a chance to remove old commit points.
Deletes a snapshotted commit by generation. Once this method returns, the snapshot information is persisted in the directory.
Deletes a snapshotted commit. Once this method returns, the snapshot information is persisted in the directory.
Snapshots the last commit. Once this method returns, the snapshot information is persisted in the directory.