lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] jeme edited a comment on issue #401: Lucene Replication - Geting revision from replicator (local) and handler (remote)
Date Wed, 13 Jan 2021 07:22:45 GMT

jeme edited a comment on issue #401:
URL: https://github.com/apache/lucenenet/issues/401#issuecomment-759258652


   1) Sounds about right
   
   2) Since your passing a IReplicationHandler to the client, where IndexReplicationHandler
is just the built-in implementation, see: https://github.com/apache/lucenenet/blob/4e66181e702db9a0849a26a86361a8fc1e796c3f/src/Lucene.Net.Replicator/ReplicationClient.cs#L496
   
   3) Do the batch update and wait with publishing a revision till your done, on server B
the IndexReplicationHandler takes a Func<bool?> as a last parameter in the constructor,
this is called as the last thing in the replication process.
   
   ----
   
   If you require a tighter integration or perhaps more insight to when a replication starts
and ends on server B, or to expose additional information. You can utilize a decorator pattern
and simply delegate to the IndexReplicationHandler.
   
   E.g.
   
   ```CSharp
   public class MyIndexReplicationHandler : IReplicationHandler
   {
       private readonly IReplicationHandler innerHandler;
   
       public string CurrentVersion => innerHandler.CurrentVersion;
   
       public IDictionary<string, IList<RevisionFile>> CurrentRevisionFiles =>
innerHandler.CurrentRevisionFiles;
       
       public MyIndexReplicationHandler(IReplicationHandler innerHandler)
       {
           this.innerHandler = innerHandler;
       }
   
       public void RevisionReady(string version, IDictionary<string, IList<RevisionFile>>
revisionFiles, IDictionary<string, IList<string>> copiedFiles, IDictionary<string,
Directory> sourceDirectory)
       {
           //TODO: Do something before replication takes place.
           innerHandler.RevisionReady(version, revisionFiles, copiedFiles, sourceDirectory);
           //TODO: Do something after replication takes place.
       }
   }
   ```
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message