Class IndexReplicationHandler
A IReplication
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Replicator
Assembly: Lucene.Net.Replicator.dll
Syntax
public class IndexReplicationHandler : IReplicationHandler
Remarks
NOTE: This handler assumes that Lucene.
This handler notifies the application via a provided
Note
This API is experimental and might change in incompatible ways in the next release.
Constructors
| Improve this Doc View SourceIndexReplicationHandler(Directory, Func<Nullable<Boolean>>)
Constructor with the given index directory and callback to notify when the indexes were updated.
Declaration
public IndexReplicationHandler(Directory indexDirectory, Func<bool?> callback)
Parameters
Type | Name | Description |
---|---|---|
Lucene. |
indexDirectory | |
System. |
callback |
Fields
| Improve this Doc View SourceINFO_STREAM_COMPONENT
The component used to log messages to the Lucene.
Declaration
public const string INFO_STREAM_COMPONENT = "IndexReplicationHandler"
Field Value
Type | Description |
---|---|
System. |
Properties
| Improve this Doc View SourceCurrentRevisionFiles
Declaration
public virtual IDictionary<string, IList<RevisionFile>> CurrentRevisionFiles { get; }
Property Value
Type | Description |
---|---|
System. |
CurrentVersion
Declaration
public virtual string CurrentVersion { get; }
Property Value
Type | Description |
---|---|
System. |
InfoStream
Gets or sets the Lucene.
Declaration
public virtual InfoStream InfoStream { get; set; }
Property Value
Type | Description |
---|---|
Lucene. |
Methods
| Improve this Doc View SourceCleanupFilesOnFailure(Directory, IList<String>)
Cleanup the index directory by deleting all given files. Called when file copy or sync failed.
Declaration
public static void CleanupFilesOnFailure(Directory directory, IList<string> files)
Parameters
Type | Name | Description |
---|---|---|
Lucene. |
directory | |
System. |
files |
CleanupOldIndexFiles(Directory, String)
Cleans up the index directory from old index files. This method uses the
last commit found by GetsegmentsFile
, then all files not referenced by this commit point
are deleted.
Declaration
public static void CleanupOldIndexFiles(Directory directory, string segmentsFile)
Parameters
Type | Name | Description |
---|---|---|
Lucene. |
directory | |
System. |
segmentsFile |
Remarks
NOTE: This method does a best effort attempt to clean the index directory. It suppresses any exceptions that occur, as this can be retried the next time.
CopyFiles(Directory, Directory, IList<String>)
Copies the provided list of files from the source
Lucene.target
Lucene.
Declaration
public static void CopyFiles(Directory source, Directory target, IList<string> files)
Parameters
Type | Name | Description |
---|---|---|
Lucene. |
source | |
Lucene. |
target | |
System. |
files |
Exceptions
Type | Condition |
---|---|
System. |
GetLastCommit(Directory)
Returns the last Lucene.null
if there are no commits.
Declaration
public static IndexCommit GetLastCommit(Directory directory)
Parameters
Type | Name | Description |
---|---|---|
Lucene. |
directory |
Returns
Type | Description |
---|---|
Lucene. |
Exceptions
Type | Condition |
---|---|
System. |
GetSegmentsFile(IList<String>, Boolean)
Verifies that the last file is segments_N and fails otherwise. It also removes and returns the file from the list, because it needs to be handled last, after all files. This is important in order to guarantee that if a reader sees the new segments_N, all other segment files are already on stable storage.
The reason why the code fails instead of putting segments_N file last is that this indicates an error in the IRevision implementation.
Declaration
public static string GetSegmentsFile(IList<string> files, bool allowEmpty)
Parameters
Type | Name | Description |
---|---|---|
System. |
files | |
System. |
allowEmpty |
Returns
Type | Description |
---|---|
System. |
RevisionReady(String, IDictionary<String, IList<RevisionFile>>, IDictionary<String, IList<String>>, IDictionary<String, Directory>)
Declaration
public virtual void RevisionReady(string version, IDictionary<string, IList<RevisionFile>> revisionFiles, IDictionary<string, IList<string>> copiedFiles, IDictionary<string, Directory> sourceDirectory)
Parameters
Type | Name | Description |
---|---|---|
System. |
version | |
System. |
revisionFiles | |
System. |
copiedFiles | |
System. |
sourceDirectory |
WriteSegmentsGen(String, Directory)
Writes SEGMENTS_GEN file to the directory, reading
the generation from the given segmentsFile
. If it is null
,
this method deletes segments.gen from the directory.
Declaration
public static void WriteSegmentsGen(string segmentsFile, Directory directory)
Parameters
Type | Name | Description |
---|---|---|
System. |
segmentsFile | |
Lucene. |
directory |