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
CheckForUpdate(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 |
---|---|---|
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 |
---|---|
IOException |
ObtainFile(string, string, string)
Declaration
Stream ObtainFile(string sessionId, string source, string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | sessionId | |
string | source | |
string | fileName |
Returns
Type | Description |
---|---|
Stream |
Remarks
NOTE: It is the caller's responsibility to call 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. |
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Exceptions
Type | Condition |
---|---|
IOException |
Release(string)
Notify that the specified SessionToken is no longer needed by the caller.
Declaration
void Release(string sessionId)
Parameters
Type | Name | Description |
---|---|---|
string | sessionId |
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Exceptions
Type | Condition |
---|---|
IOException |