Class LocalReplicator
A IReplicator implementation for use by the side that publishes IRevisions, as well for clients to CheckForUpdate(string) check for updates}. When a client needs to be updated, it is returned a SessionToken through which it can ObtainFile(string, string, string) the files of that revision. As long as a revision is being replicated, this replicator guarantees that it will not be Release().
Replication sessions expire by default afterInherited Members
Namespace: Lucene.Net.Replicator
Assembly: Lucene.Net.Replicator.dll
Syntax
public class LocalReplicator : IReplicator, IDisposable
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Fields
DEFAULT_SESSION_EXPIRATION_THRESHOLD
Threshold for expiring inactive sessions. Defaults to 30 minutes.
Declaration
public const long DEFAULT_SESSION_EXPIRATION_THRESHOLD = 1800000
Field Value
Type | Description |
---|---|
long |
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Properties
ExpirationThreshold
Gets or sets the expiration threshold in milliseconds.
If a replication session is inactive this long it is automatically expired, and further attempts to operate within this session will throw a SessionExpiredException.Declaration
public virtual long ExpirationThreshold { get; set; }
Property Value
Type | Description |
---|---|
long |
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
public virtual 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 |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Dispose(bool)
A IReplicator implementation for use by the side that publishes IRevisions, as well for clients to CheckForUpdate(string) check for updates}. When a client needs to be updated, it is returned a SessionToken through which it can ObtainFile(string, string, string) the files of that revision. As long as a revision is being replicated, this replicator guarantees that it will not be Release().
Replication sessions expire by default afterDeclaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
EnsureOpen()
Ensure that replicator is still open, or throw ObjectDisposedException otherwise.
Declaration
protected void EnsureOpen()
Remarks
Note
This API is experimental and might change in incompatible ways in the next release.
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | This replicator has already been disposed. |
ObtainFile(string, string, string)
Declaration
public virtual 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
public virtual 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)
A IReplicator implementation for use by the side that publishes IRevisions, as well for clients to CheckForUpdate(string) check for updates}. When a client needs to be updated, it is returned a SessionToken through which it can ObtainFile(string, string, string) the files of that revision. As long as a revision is being replicated, this replicator guarantees that it will not be Release().
Replication sessions expire by default afterDeclaration
public virtual 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 |
---|---|
InvalidOperationException |