Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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 after , and the threshold can be configured through ExpirationThreshold.
    Inheritance
    object
    LocalReplicator
    Implements
    IReplicator
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 after , and the threshold can be configured through ExpirationThreshold.
    Declaration
    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)

    Returns an Stream for the requested file and source in the context of the given Id.

    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 after , and the threshold can be configured through ExpirationThreshold.
    Declaration
    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

    Implements

    IReplicator
    IDisposable
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.