Package org.apache.lucene.replicator
Class IndexAndTaxonomyRevision
- java.lang.Object
-
- org.apache.lucene.replicator.IndexAndTaxonomyRevision
-
- All Implemented Interfaces:
Comparable<Revision>,Revision
public class IndexAndTaxonomyRevision extends Object implements Revision
ARevisionof a single index and taxonomy index files which comprises the list of files from both indexes. This revision should be used whenever a pair of search and taxonomy indexes need to be replicated together to guarantee consistency of both on the replicating (client) side.- See Also:
IndexRevision- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexAndTaxonomyRevision.SnapshotDirectoryTaxonomyWriterADirectoryTaxonomyWriterwhich sets the underlyingIndexWriter'sIndexDeletionPolicytoSnapshotDeletionPolicy.
-
Field Summary
Fields Modifier and Type Field Description static StringINDEX_SOURCEstatic StringTAXONOMY_SOURCE
-
Constructor Summary
Constructors Constructor Description IndexAndTaxonomyRevision(IndexWriter indexWriter, IndexAndTaxonomyRevision.SnapshotDirectoryTaxonomyWriter taxoWriter)Constructor over the givenIndexWriter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(String version)Compares the revision to the given version string.intcompareTo(Revision o)Map<String,List<RevisionFile>>getSourceFiles()Returns the files that comprise this revision, as a mapping from a source to a list of files.StringgetVersion()Returns a string representation of the version of this revision.InputStreamopen(String source, String fileName)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 indexCommit, IndexCommit taxoCommit)Returns a singleton map of the revision files from the givenIndexCommit.static StringrevisionVersion(IndexCommit indexCommit, IndexCommit taxoCommit)Returns a String representation of a revision's version from the givenIndexCommits of the search and taxonomy indexes.StringtoString()
-
-
-
Field Detail
-
INDEX_SOURCE
public static final String INDEX_SOURCE
- See Also:
- Constant Field Values
-
TAXONOMY_SOURCE
public static final String TAXONOMY_SOURCE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IndexAndTaxonomyRevision
public IndexAndTaxonomyRevision(IndexWriter indexWriter, IndexAndTaxonomyRevision.SnapshotDirectoryTaxonomyWriter taxoWriter) throws IOException
Constructor over the givenIndexWriter. Uses the lastIndexCommitfound in theDirectorymanaged by the given writer.- Throws:
IOException
-
-
Method Detail
-
revisionFiles
public static Map<String,List<RevisionFile>> revisionFiles(IndexCommit indexCommit, IndexCommit taxoCommit) throws IOException
Returns a singleton map of the revision files from the givenIndexCommit.- Throws:
IOException
-
revisionVersion
public static String revisionVersion(IndexCommit indexCommit, IndexCommit taxoCommit)
Returns a String representation of a revision's version from the givenIndexCommits of the search and taxonomy indexes.
-
compareTo
public int compareTo(String version)
Description copied from interface:RevisionCompares the revision to the given version string. Behaves likeComparable.compareTo(Object).
-
compareTo
public int compareTo(Revision o)
- Specified by:
compareToin interfaceComparable<Revision>
-
getVersion
public String 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
public Map<String,List<RevisionFile>> 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
public InputStream open(String source, String fileName) throws IOException
Description copied from interface:RevisionReturns anIndexInputfor the given fileName and source. It is the caller's respnsibility to close theIndexInputwhen it has been consumed.- Specified by:
openin interfaceRevision- Throws:
IOException
-
release
public void release() throws IOExceptionDescription 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
-
-