Show / Hide Table of Contents

    Class PersistentSnapshotDeletionPolicy

    A SnapshotDeletionPolicy which adds a persistence layer so that snapshots can be maintained across the life of an application. The snapshots are persisted in a Directory and are committed as soon as Snapshot() or Release(IndexCommit) is called.

    NOTE: Sharing PersistentSnapshotDeletionPolicys that write to the same directory across IndexWriters will corrupt snapshots. You should make sure every IndexWriter has its own PersistentSnapshotDeletionPolicy and that they all write to a different Directory. It is OK to use the same Directory that holds the index.

    This class adds a Release(Int64) method to release commits from a previous snapshot's Generation.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    IndexDeletionPolicy
    SnapshotDeletionPolicy
    PersistentSnapshotDeletionPolicy
    Inherited Members
    SnapshotDeletionPolicy.m_refCounts
    SnapshotDeletionPolicy.m_indexCommits
    SnapshotDeletionPolicy.m_lastCommit
    SnapshotDeletionPolicy.OnCommit<T>(IList<T>)
    SnapshotDeletionPolicy.OnInit<T>(IList<T>)
    SnapshotDeletionPolicy.ReleaseGen(Int64)
    SnapshotDeletionPolicy.IncRef(IndexCommit)
    SnapshotDeletionPolicy.GetSnapshots()
    SnapshotDeletionPolicy.SnapshotCount
    SnapshotDeletionPolicy.GetIndexCommit(Int64)
    SnapshotDeletionPolicy.Clone()
    Namespace: Lucene.Net.Index
    Assembly: Lucene.Net.dll
    Syntax
    public class PersistentSnapshotDeletionPolicy : SnapshotDeletionPolicy

    Constructors

    | Improve this Doc View Source

    PersistentSnapshotDeletionPolicy(IndexDeletionPolicy, Directory)

    PersistentSnapshotDeletionPolicy wraps another IndexDeletionPolicy to enable flexible snapshotting, passing CREATE_OR_APPEND by default.

    Declaration
    public PersistentSnapshotDeletionPolicy(IndexDeletionPolicy primary, Directory dir)
    Parameters
    Type Name Description
    IndexDeletionPolicy primary

    the IndexDeletionPolicy that is used on non-snapshotted commits. Snapshotted commits, by definition, are not deleted until explicitly released via Release(IndexCommit).

    Directory dir

    the Directory which will be used to persist the snapshots information.

    | Improve this Doc View Source

    PersistentSnapshotDeletionPolicy(IndexDeletionPolicy, Directory, OpenMode)

    PersistentSnapshotDeletionPolicy wraps another IndexDeletionPolicy to enable flexible snapshotting.

    Declaration
    public PersistentSnapshotDeletionPolicy(IndexDeletionPolicy primary, Directory dir, OpenMode mode)
    Parameters
    Type Name Description
    IndexDeletionPolicy primary

    the IndexDeletionPolicy that is used on non-snapshotted commits. Snapshotted commits, by definition, are not deleted until explicitly released via Release(IndexCommit).

    Directory dir

    the Directory which will be used to persist the snapshots information.

    OpenMode mode

    specifies whether a new index should be created, deleting all existing snapshots information (immediately), or open an existing index, initializing the class with the snapshots information.

    Fields

    | Improve this Doc View Source

    SNAPSHOTS_PREFIX

    Prefix used for the save file.

    Declaration
    public static readonly string SNAPSHOTS_PREFIX
    Field Value
    Type Description
    System.String

    Properties

    | Improve this Doc View Source

    LastSaveFile

    Returns the file name the snapshots are currently saved to, or null if no snapshots have been saved.

    Declaration
    public virtual string LastSaveFile { get; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    Release(IndexCommit)

    Deletes a snapshotted commit. Once this method returns, the snapshot information is persisted in the directory.

    Declaration
    public override void Release(IndexCommit commit)
    Parameters
    Type Name Description
    IndexCommit commit
    Overrides
    SnapshotDeletionPolicy.Release(IndexCommit)
    See Also
    Release(IndexCommit)
    | Improve this Doc View Source

    Release(Int64)

    Deletes a snapshotted commit by generation. Once this method returns, the snapshot information is persisted in the directory.

    Declaration
    public virtual void Release(long gen)
    Parameters
    Type Name Description
    System.Int64 gen
    See Also
    Generation
    Release(IndexCommit)
    | Improve this Doc View Source

    Snapshot()

    Snapshots the last commit. Once this method returns, the snapshot information is persisted in the directory.

    Declaration
    public override IndexCommit Snapshot()
    Returns
    Type Description
    IndexCommit
    Overrides
    SnapshotDeletionPolicy.Snapshot()
    See Also
    Snapshot()
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)