Interface IReplicator
An interface for replicating files. Allows a producer to Publish(IRevision) IRevisions and consumers to CheckForUpdate(String). When a client needs to be updated, it is given a SessionToken through which it can ObtainFile(String, String, String) the files of that revision. After the client has finished obtaining all the files, it should Release(String) the given session, so that the files can be reclaimed if they are not needed anymore.
A client is always updated to the newest revision available. That is, if a client is on revision r1 and revisions r2 and r3 were published, then when the client will next check for update, it will receive r3.
Inherited Members
Namespace: Lucene.Net.Replicator
Assembly: Lucene.Net.Replicator.dll
Syntax
public interface IReplicator : IDisposable
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Methods
| Improve this Doc View SourceCheckForUpdate(String)
Check whether the given version is up-to-date and returns a
SessionToken which can be used for fetching the revision files,
otherwise returns null
.
Declaration
SessionToken CheckForUpdate(string currentVersion)
Parameters
Type | Name | Description |
---|---|---|
System.String | currentVersion |
Returns
Type | Description |
---|---|
SessionToken |
Remarks
NOTE: When the returned session token is no longer needed, you should call Release(String) so that the session resources can be reclaimed, including the revision files.
Exceptions
Type | Condition |
---|---|
System.IO.IOException |
ObtainFile(String, String, String)
Returns an System.IO.Stream for the requested file and source in the context of the given Id.
Declaration
Stream ObtainFile(string sessionId, string source, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sessionId | |
System.String | source | |
System.String | fileName |
Returns
Type | Description |
---|---|
System.IO.Stream |
Remarks
NOTE: It is the caller's responsibility to call System.IDisposable.Dispose() on the returned stream.
Exceptions
Type | Condition |
---|---|
SessionExpiredException | The specified session has already expired |
Publish(IRevision)
Publish a new IRevision for consumption by clients. It is the caller's responsibility to verify that the revision files exist and can be read by clients. When the revision is no longer needed, it will be Release(String)d by the replicator.
Declaration
void Publish(IRevision revision)
Parameters
Type | Name | Description |
---|---|---|
IRevision | revision | The IRevision to publish. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException |
Release(String)
Notify that the specified SessionToken is no longer needed by the caller.
Declaration
void Release(string sessionId)
Parameters
Type | Name | Description |
---|---|---|
System.String | sessionId |
Exceptions
Type | Condition |
---|---|
System.IO.IOException |