Package org.apache.lucene.replicator
Class IndexAndTaxonomyReplicationHandler
java.lang.Object
org.apache.lucene.replicator.IndexAndTaxonomyReplicationHandler
- All Implemented Interfaces:
ReplicationClient.ReplicationHandler
public class IndexAndTaxonomyReplicationHandler
extends Object
implements ReplicationClient.ReplicationHandler
A
ReplicationClient.ReplicationHandler
for replication of an index and taxonomy pair. See IndexReplicationHandler
for more detail. This handler ensures that the search and taxonomy
indexes are replicated in a consistent way.
NOTE: if you intend to recreate a taxonomy index, you should make sure to reopen an IndexSearcher and TaxonomyReader pair via the provided callback, to guarantee that both indexes are in sync. This handler does not prevent replicating such index and taxonomy pairs, and if they are reopened by a different thread, unexpected errors can occur, as well as inconsistency between the taxonomy and index readers.
- See Also:
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The component used to log messages to thedefault
InfoStream
. -
Constructor Summary
ConstructorDescriptionIndexAndTaxonomyReplicationHandler
(Directory indexDir, Directory taxoDir, Callable<Boolean> callback) Constructor with the given index directory and callback to notify when the indexes were updated. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current revision files held by the handler.Returns the current revision version held by the handler.void
revisionReady
(String version, Map<String, List<RevisionFile>> revisionFiles, Map<String, List<String>> copiedFiles, Map<String, Directory> sourceDirectory) Called when a new revision was obtained and is available (i.e.void
setInfoStream
(InfoStream infoStream) Sets theInfoStream
to use for logging messages.
-
Field Details
-
INFO_STREAM_COMPONENT
The component used to log messages to thedefault
InfoStream
.- See Also:
-
-
Constructor Details
-
IndexAndTaxonomyReplicationHandler
public IndexAndTaxonomyReplicationHandler(Directory indexDir, Directory taxoDir, Callable<Boolean> callback) throws IOException Constructor with the given index directory and callback to notify when the indexes were updated.- Throws:
IOException
-
-
Method Details
-
currentVersion
Description copied from interface:ReplicationClient.ReplicationHandler
Returns the current revision version held by the handler.- Specified by:
currentVersion
in interfaceReplicationClient.ReplicationHandler
-
currentRevisionFiles
Description copied from interface:ReplicationClient.ReplicationHandler
Returns the current revision files held by the handler.- Specified by:
currentRevisionFiles
in interfaceReplicationClient.ReplicationHandler
-
revisionReady
public void revisionReady(String version, Map<String, List<RevisionFile>> revisionFiles, Map<String, throws IOExceptionList<String>> copiedFiles, Map<String, Directory> sourceDirectory) Description copied from interface:ReplicationClient.ReplicationHandler
Called when a new revision was obtained and is available (i.e. all needed files were successfully copied).- Specified by:
revisionReady
in interfaceReplicationClient.ReplicationHandler
- Parameters:
version
- the version of theRevision
that was copiedrevisionFiles
- the files contained by thisRevision
copiedFiles
- the files that were actually copiedsourceDirectory
- a mapping from a source of files to theDirectory
they were copied into- Throws:
IOException
-
setInfoStream
Sets theInfoStream
to use for logging messages.
-