Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class BaseDirectoryWrapper

    Calls check index on dispose.

    Inheritance
    object
    Directory
    FilterDirectory
    BaseDirectoryWrapper
    MockDirectoryWrapper
    Implements
    IDisposable
    Inherited Members
    FilterDirectory.m_input
    FilterDirectory.Delegate
    FilterDirectory.ListAll()
    FilterDirectory.FileExists(string)
    FilterDirectory.DeleteFile(string)
    FilterDirectory.FileLength(string)
    FilterDirectory.CreateOutput(string, IOContext)
    FilterDirectory.Sync(ICollection<string>)
    FilterDirectory.OpenInput(string, IOContext)
    FilterDirectory.MakeLock(string)
    FilterDirectory.ClearLock(string)
    FilterDirectory.SetLockFactory(LockFactory)
    FilterDirectory.GetLockID()
    FilterDirectory.LockFactory
    FilterDirectory.ToString()
    Directory.OpenChecksumInput(string, IOContext)
    Directory.Dispose()
    Directory.EnsureOpen()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.TestFramework.dll
    Syntax
    public class BaseDirectoryWrapper : FilterDirectory, IDisposable

    Constructors

    BaseDirectoryWrapper(Directory)

    Calls check index on dispose.

    Declaration
    public BaseDirectoryWrapper(Directory @delegate)
    Parameters
    Type Name Description
    Directory delegate

    Properties

    CheckIndexOnDispose

    Set whether or not checkindex should be run on dispose

    Declaration
    public virtual bool CheckIndexOnDispose { get; set; }
    Property Value
    Type Description
    bool

    CrossCheckTermVectorsOnDispose

    Calls check index on dispose.

    Declaration
    public virtual bool CrossCheckTermVectorsOnDispose { get; set; }
    Property Value
    Type Description
    bool

    IsOpen

    Gets a value indicating whether the current Lucene.Net.Store.Directory instance is open.

    Expert: This is useful for implementing the Lucene.Net.Store.Directory.EnsureOpen() logic.
    Declaration
    public virtual bool IsOpen { get; protected set; }
    Property Value
    Type Description
    bool

    Methods

    CompareAndSetIsOpen(bool, bool)

    Atomically sets the value to the given updated value if the current value == the expected value.

    Expert: Use this in the Dispose(bool) call to skip duplicate calls by using the folling if block to guard the dispose logic.
    protected override void Dispose(bool disposing)
    {
        if (!CompareAndSetIsOpen(expect: true, update: false)) return;
    
    // Dispose unmanaged resources
    if (disposing)
    {
        // Dispose managed resources
    }
    

    }

    Declaration
    protected bool CompareAndSetIsOpen(bool expect, bool update)
    Parameters
    Type Name Description
    bool expect

    The expected value (the comparand).

    bool update

    The new value.

    Returns
    Type Description
    bool

    true if successful. A false return value indicates that the actual value was not equal to the expected value.

    Copy(Directory, string, string, IOContext)

    Copies the file src to Lucene.Net.Store.Directoryto under the new file name dest.

    If you want to copy the entire source directory to the destination one, you can do so like this:
    Directory to; // the directory to copy to
    foreach (string file in dir.ListAll()) {
        dir.Copy(to, file, newFile, IOContext.DEFAULT); // newFile can be either file, or a new name
    }

    NOTE: this method does not check whether dest exist and will

    overwrite it if it does.

    Declaration
    public override void Copy(Directory to, string src, string dest, IOContext context)
    Parameters
    Type Name Description
    Directory to
    string src
    string dest
    IOContext context
    Overrides
    Directory.Copy(Directory, string, string, IOContext)

    CreateSlicer(string, IOContext)

    Creates an Lucene.Net.Store.Directory.IndexInputSlicer for the given file name. Lucene.Net.Store.Directory.IndexInputSlicer allows other Lucene.Net.Store.Directory implementations to efficiently open one or more sliced Lucene.Net.Store.IndexInput instances from a single file handle. The underlying file handle is kept open until the Lucene.Net.Store.Directory.IndexInputSlicer is closed.

    Throws FileNotFoundException if the file does not exist.

    Note

    This API is for internal purposes only and might change in incompatible ways in the next release.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Declaration
    public override Directory.IndexInputSlicer CreateSlicer(string name, IOContext context)
    Parameters
    Type Name Description
    string name
    IOContext context
    Returns
    Type Description
    Directory.IndexInputSlicer
    Overrides
    Directory.CreateSlicer(string, IOContext)
    Exceptions
    Type Condition
    IOException

    if an IOException occurs

    Dispose(bool)

    Disposes the store.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing
    Overrides
    FilterDirectory.Dispose(bool)

    Implements

    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.