Class IndexReplicationHandler
Inheritance
System.Object
IndexReplicationHandler
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Lucene.Net.Replicator.dll
Syntax
public class IndexReplicationHandler : IReplicationHandler
Remarks
Constructors
|
Improve this Doc
View Source
IndexReplicationHandler(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.Net.Store.Directory |
indexDirectory |
|
System.Func<System.Nullable<System.Boolean>> |
callback |
|
Fields
|
Improve this Doc
View Source
INFO_STREAM_COMPONENT
The component used to log messages to the Default
Lucene.Net.Util.InfoStream.
Declaration
public const string INFO_STREAM_COMPONENT = "IndexReplicationHandler"
Field Value
Type |
Description |
System.String |
|
Properties
|
Improve this Doc
View Source
CurrentRevisionFiles
Declaration
public virtual IDictionary<string, IList<RevisionFile>> CurrentRevisionFiles { get; }
Property Value
Type |
Description |
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<RevisionFile>> |
|
|
Improve this Doc
View Source
CurrentVersion
Declaration
public virtual string CurrentVersion { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
InfoStream
Gets or sets the Lucene.Net.Util.InfoStream to use for logging messages.
Declaration
public virtual InfoStream InfoStream { get; set; }
Property Value
Type |
Description |
Lucene.Net.Util.InfoStream |
|
Methods
|
Improve this Doc
View Source
CleanupFilesOnFailure(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.Net.Store.Directory |
directory |
|
System.Collections.Generic.IList<System.String> |
files |
|
|
Improve this Doc
View Source
CleanupOldIndexFiles(Directory, String)
Cleans up the index directory from old index files. This method uses the
last commit found by GetLastCommit(Directory). If it matches the
expected segmentsFile
, 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.Net.Store.Directory |
directory |
|
System.String |
segmentsFile |
|
Remarks
|
Improve this Doc
View Source
CopyFiles(Directory, Directory, IList<String>)
Copies the provided list of files from the source
Lucene.Net.Store.Directory to the
target
Lucene.Net.Store.Directory, if they are not the same.
Declaration
public static void CopyFiles(Directory source, Directory target, IList<string> files)
Parameters
Type |
Name |
Description |
Lucene.Net.Store.Directory |
source |
|
Lucene.Net.Store.Directory |
target |
|
System.Collections.Generic.IList<System.String> |
files |
|
Exceptions
Type |
Condition |
System.IO.IOException |
|
|
Improve this Doc
View Source
GetLastCommit(Directory)
Returns the last Lucene.Net.Index.IndexCommit found in the Lucene.Net.Store.Directory, or
null
if there are no commits.
Declaration
public static IndexCommit GetLastCommit(Directory directory)
Parameters
Type |
Name |
Description |
Lucene.Net.Store.Directory |
directory |
|
Returns
Type |
Description |
Lucene.Net.Index.IndexCommit |
|
Exceptions
Type |
Condition |
System.IO.IOException |
|
|
Improve this Doc
View Source
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.Collections.Generic.IList<System.String> |
files |
|
System.Boolean |
allowEmpty |
|
Returns
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
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.String |
version |
|
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<RevisionFile>> |
revisionFiles |
|
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IList<System.String>> |
copiedFiles |
|
System.Collections.Generic.IDictionary<System.String, Lucene.Net.Store.Directory> |
sourceDirectory |
|
|
Improve this Doc
View Source
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.String |
segmentsFile |
|
Lucene.Net.Store.Directory |
directory |
|
Implements