Package org.apache.lucene.replicator
Class IndexRevision
java.lang.Object
org.apache.lucene.replicator.IndexRevision
- All Implemented Interfaces:
Comparable<Revision>,Revision
A
Revision of a single index files which comprises the list of files that are part of the
current IndexCommit. To ensure the files are not deleted by IndexWriter for as
long as this revision stays alive (i.e. until release()), the current commit point is
snapshotted, using SnapshotDeletionPolicy (this means that the given writer's config should return SnapshotDeletionPolicy).
When this revision is released, it releases the obtained snapshot as well
as calls IndexWriter.deleteUnusedFiles() so that the snapshotted files are deleted (if
they are no longer needed).
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares the revision to the given version string.intReturns the files that comprise this revision, as a mapping from a source to a list of files.Returns a string representation of the version of this revision.Returns anIndexInputfor the given fileName and source.voidrelease()Called when this revision can be safely released, i.e.static Map<String,List<RevisionFile>> revisionFiles(IndexCommit commit) Returns a singleton map of the revision files from the givenIndexCommit.static StringrevisionVersion(IndexCommit commit) Returns a String representation of a revision's version from the givenIndexCommit.toString()
-
Constructor Details
-
IndexRevision
Constructor over the givenIndexWriter. Uses the lastIndexCommitfound in theDirectorymanaged by the given writer.- Throws:
IOException
-
-
Method Details
-
revisionFiles
Returns a singleton map of the revision files from the givenIndexCommit.- Throws:
IOException
-
revisionVersion
Returns a String representation of a revision's version from the givenIndexCommit. -
compareTo
Description copied from interface:RevisionCompares the revision to the given version string. Behaves likeComparable.compareTo(Object). -
compareTo
- Specified by:
compareToin interfaceComparable<Revision>
-
getVersion
Description copied from interface:RevisionReturns a string representation of the version of this revision. The version is used byRevision.compareTo(String)as well as to serialize/deserialize revision information. Therefore it must be self descriptive as well as be able to identify one revision from another.- Specified by:
getVersionin interfaceRevision
-
getSourceFiles
Description copied from interface:RevisionReturns the files that comprise this revision, as a mapping from a source to a list of files.- Specified by:
getSourceFilesin interfaceRevision
-
open
Description copied from interface:RevisionReturns anIndexInputfor the given fileName and source. It is the caller's responsibility to close theIndexInputwhen it has been consumed.- Specified by:
openin interfaceRevision- Throws:
IOException
-
release
Description copied from interface:RevisionCalled when this revision can be safely released, i.e. where there are no more references to it.- Specified by:
releasein interfaceRevision- Throws:
IOException
-
toString
-