Class SimpleFSDirectory
A straightforward implementation of FSDirectory using System.IO.FileStream.
FSDirectory is ideal for use cases where efficient writing is required without utilizing too much RAM. However, reading is less efficient than when using MMapDirectory. This class has poor concurrent read performance (multiple threads will bottleneck) as it synchronizes when multiple threads read from the same file. It's usually better to use MMapDirectory for reading.
NOTE: Unlike in Java, it is not recommended to use
System.Threading.Thread.Interrupt in .NET
in conjunction with an open FSDirectory because it is not guaranteed to exit atomically.
Any lock
statement or System.Threading.Monitor.Enter(System.Object) call can throw a
System.Threading.ThreadInterruptedException, which makes shutting down unpredictable.
To exit parallel tasks safely, we recommend using System.Threading.Tasks.Tasks
and "interrupt" them with System.Threading.CancellationTokens.
Implements
Inherited Members
Namespace: Lucene.Net.Store
Assembly: Lucene.Net.dll
Syntax
public class SimpleFSDirectory : FSDirectory, IDisposable
Constructors
| Improve this Doc View SourceSimpleFSDirectory(DirectoryInfo)
Create a new SimpleFSDirectory for the named location and NativeFSLockFactory.
Declaration
public SimpleFSDirectory(DirectoryInfo path)
Parameters
Type | Name | Description |
---|---|---|
System.IO.DirectoryInfo | path | the path of the directory |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level I/O error |
SimpleFSDirectory(DirectoryInfo, LockFactory)
Create a new SimpleFSDirectory for the named location.
Declaration
public SimpleFSDirectory(DirectoryInfo path, LockFactory lockFactory)
Parameters
Type | Name | Description |
---|---|---|
System.IO.DirectoryInfo | path | the path of the directory |
LockFactory | lockFactory | the lock factory to use, or null for the default (NativeFSLockFactory); |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level I/O error |
SimpleFSDirectory(String)
Create a new SimpleFSDirectory for the named location and NativeFSLockFactory.
LUCENENET specific overload for convenience using string instead of System.IO.DirectoryInfo.
Declaration
public SimpleFSDirectory(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | the path of the directory |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level I/O error |
SimpleFSDirectory(String, LockFactory)
Create a new SimpleFSDirectory for the named location.
LUCENENET specific overload for convenience using string instead of System.IO.DirectoryInfo.
Declaration
public SimpleFSDirectory(string path, LockFactory lockFactory)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | the path of the directory |
LockFactory | lockFactory | the lock factory to use, or null for the default (NativeFSLockFactory); |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | if there is a low-level I/O error |
Methods
| Improve this Doc View SourceCreateSlicer(String, IOContext)
Declaration
public override Directory.IndexInputSlicer CreateSlicer(string name, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
IOContext | context |
Returns
Type | Description |
---|---|
Directory.IndexInputSlicer |
Overrides
| Improve this Doc View SourceOpenInput(String, IOContext)
Creates an IndexInput for the file with the given name.
Declaration
public override IndexInput OpenInput(string name, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
IOContext | context |
Returns
Type | Description |
---|---|
IndexInput |