| using System.IO; |
| using System.Threading; |
| using System.Threading.Tasks; |
| |
| #nullable enable |
| |
| namespace Lucene.Net.Replicator |
| { |
| /// <summary> |
| /// Async extension of <see cref="IReplicator"/> for non-blocking replication operations. |
| /// Implementations provide both synchronous (inherited from <see cref="IReplicator"/>) |
| /// and asynchronous methods. |
| /// </summary> |
| public interface IAsyncReplicator : IReplicator |
| { |
| /// <summary> |
| /// Check whether the given version is up-to-date and returns a |
| /// <see cref="SessionToken"/> which can be used for fetching the revision files. |
| /// </summary> |
| /// <param name="currentVersion">Current version of the index.</param> |
| /// <param name="cancellationToken">Cancellation token.</param> |
| /// <returns>A <see cref="SessionToken"/> if an update exists; otherwise, <c>null</c>.</returns> |
| Task<SessionToken?> CheckForUpdateAsync(string? currentVersion, CancellationToken cancellationToken = default); |
| |
| /// <summary> |
| /// Returns a stream for the requested file and source. |
| /// </summary> |
| Task<Stream> ObtainFileAsync(string sessionId, string source, string fileName, CancellationToken cancellationToken = default); |
| |
| /// <summary> |
| /// Notify that the specified session is no longer needed. |
| /// </summary> |
| Task ReleaseAsync(string sessionId, CancellationToken cancellationToken = default); |
| |
| /// <summary> |
| /// Publish a new <see cref="IRevision"/> for consumption by clients asynchronously. |
| /// See <see cref="IReplicator.Publish(IRevision)"/> for details. |
| /// </summary> |
| Task PublishAsync(IRevision revision, CancellationToken cancellationToken = default); |
| } |
| } |