Class Directory
A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing.
.NET's i/o APIs not used directly, but rather all i/o is through this API. This permits things such as:
- implementation of RAM-based indices;
- implementation indices stored in a database;
- implementation of an index as a single file;
Directory locking is implemented by an instance of LockFactory, and can be changed for each Directory instance using SetLockFactory(LockFactory).
Inheritance
Assembly: DistributedLucene.Net.dll
Syntax
public abstract class Directory : IDisposable
Properties
Name | Description |
---|---|
LockFactory | Get the LockFactory that this Directory instance is using for its locking implementation. Note that this may be null for Directory implementations that provide their own locking implementation. |
StatusLatch |
Methods
Name | Description |
---|---|
AllowOpenInput() | |
AllowOpenOutput() | |
ClearLock(String) | Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use. |
Copy(Directory, String, String, IOContext) | Copies the file If you want to copy the entire source directory to the destination one, you can do so like this:
NOTE: this method does not check whether |
CreateOutput(String, IOContext) | Creates a new, empty file in the directory with the given name. Returns a stream writing this file. |
CreateSlicer(String, IOContext) | Creates an Directory.IndexInputSlicer for the given file name. Directory.IndexInputSlicer allows other Directory implementations to efficiently open one or more sliced IndexInput instances from a single file handle. The underlying file handle is kept open until the Directory.IndexInputSlicer is closed. Throws @lucene.internal @lucene.experimental |
DeleteFile(String) | Removes an existing file in the directory. |
DirectoryExist() | |
Dispose() | Disposes the store. |
Dispose(Boolean) | Disposes the store. |
DisposeOnRemoval() | |
EnsureOpen() | |
FileExists(String) | Returns |
FileLength(String) | Returns the length of a file in the directory. this method follows the following contract: |
GetBucketId() | |
GetLockID() | Return a string identifier that uniquely differentiates this Directory instance from other Directory instances. This ID should be the same if two Directory instances (even in different AppDomains and/or on different machines) are considered "the same index". This is how locking "scopes" to the right index. |
ListAll() | Returns an array of strings, one for each file in the directory. |
MakeLock(String) | Construct a Lock. |
OpenChecksumInput(String, IOContext) | Returns a stream reading an existing file, computing checksum as it reads |
OpenInput(String, IOContext) | Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. Currently the only Directory implementations that respect this parameter are FSDirectory and CompoundFileDirectory. Throws |
SetBucketId(Int32) | |
SetLockFactory(LockFactory) | Set the LockFactory that this Directory instance should use for its locking implementation. Each * instance of LockFactory should only be used for one directory (ie, do not share a single instance across multiple Directories). |
Sync(ICollection<String>) | Ensure that any writes to these files are moved to
stable storage. Lucene uses this to properly commit
changes to the index, to prevent a machine/OS crash
from corrupting the index. |
ToString() | |
UnregisterInput(IndexInput) |