Class CompoundFileDirectory
Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.
All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single.cfs
file (except for the LiveDocsFormat, with a
corresponding .cfe
file indexing its sub-files.
Files:
.cfs
: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles..cfe
: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.
Description:
- Compound (.cfs) --> Header, FileData FileCount
- Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
- Header --> WriteHeader(DataOutput, string, int)
- FileCount --> WriteVInt32(int)
- DataOffset,DataLength --> WriteInt64(long)
- FileName --> WriteString(string)
- FileData --> raw file data
- Footer --> WriteFooter(IndexOutput)
Notes:
- FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
- Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.
Note
This API is experimental and might change in incompatible ways in the next release.
Implements
Inherited Members
Namespace: Lucene.Net.Store
Assembly: Lucene.Net.dll
Syntax
public sealed class CompoundFileDirectory : BaseDirectory, IDisposable
Constructors
CompoundFileDirectory(Directory, string, IOContext, bool)
Create a new CompoundFileDirectory.
Declaration
public CompoundFileDirectory(Directory directory, string fileName, IOContext context, bool openForWrite)
Parameters
Type | Name | Description |
---|---|---|
Directory | directory | |
string | fileName | |
IOContext | context | |
bool | openForWrite |
Properties
Directory
Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.
All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single.cfs
file (except for the LiveDocsFormat, with a
corresponding .cfe
file indexing its sub-files.
Files:
.cfs
: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles..cfe
: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.
Description:
- Compound (.cfs) --> Header, FileData FileCount
- Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
- Header --> WriteHeader(DataOutput, string, int)
- FileCount --> WriteVInt32(int)
- DataOffset,DataLength --> WriteInt64(long)
- FileName --> WriteString(string)
- FileData --> raw file data
- Footer --> WriteFooter(IndexOutput)
Notes:
- FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
- Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public Directory Directory { get; }
Property Value
Type | Description |
---|---|
Directory |
Name
Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.
All files belonging to a segment have the same name with varying extensions. The extensions correspond to the different file formats used by the Codec. When using the Compound File format these files are collapsed into a single.cfs
file (except for the LiveDocsFormat, with a
corresponding .cfe
file indexing its sub-files.
Files:
.cfs
: An optional "virtual" file consisting of all the other index files for systems that frequently run out of file handles..cfe
: The "virtual" compound file's entry table holding all entries in the corresponding .cfs file.
Description:
- Compound (.cfs) --> Header, FileData FileCount
- Compound Entry Table (.cfe) --> Header, FileCount, <FileName, DataOffset, DataLength> FileCount, Footer
- Header --> WriteHeader(DataOutput, string, int)
- FileCount --> WriteVInt32(int)
- DataOffset,DataLength --> WriteInt64(long)
- FileName --> WriteString(string)
- FileData --> raw file data
- Footer --> WriteFooter(IndexOutput)
Notes:
- FileCount indicates how many files are contained in this compound file. The entry table that follows has that many entries.
- Each directory entry contains a long pointer to the start of this file's data section, the files length, and a string with that file's name.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
CreateOutput(string, IOContext)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
Declaration
public override IndexOutput CreateOutput(string name, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
IOContext | context |
Returns
Type | Description |
---|---|
IndexOutput |
Overrides
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 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
Exceptions
Type | Condition |
---|---|
IOException | if an IOException occurs |
DeleteFile(string)
Not implemented
Declaration
public override void DeleteFile(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | always: not supported by CFS |
Dispose(bool)
Disposes the store.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
Overrides
FileExists(string)
Returns true iff a file with the given name exists.
Declaration
[Obsolete("this method will be removed in 5.0")]
public override bool FileExists(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
bool |
Overrides
FileLength(string)
Returns the length of a file in the directory.
Declaration
public override long FileLength(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
long |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | if the file does not exist |
ListAll()
Returns an array of strings, one for each file in the directory.
Declaration
public override string[] ListAll()
Returns
Type | Description |
---|---|
string[] |
Overrides
MakeLock(string)
Not implemented
Declaration
public override Lock MakeLock(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
Lock |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | always: not supported by CFS |
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 FileNotFoundException if the file does not exist.Declaration
public override IndexInput OpenInput(string name, IOContext context)
Parameters
Type | Name | Description |
---|---|---|
string | name | |
IOContext | context |
Returns
Type | Description |
---|---|
IndexInput |
Overrides
RenameFile(string, string)
Not implemented
Declaration
public void RenameFile(string from, string to)
Parameters
Type | Name | Description |
---|---|---|
string | from | |
string | to |
Exceptions
Type | Condition |
---|---|
NotSupportedException | always: not supported by CFS |
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.
NOTE: Clients may call this method for same files over
and over again, so some impls might optimize for that.
For other impls the operation can be a noop, for various
reasons.
Declaration
public override void Sync(ICollection<string> names)
Parameters
Type | Name | Description |
---|---|---|
ICollection<string> | names |
Overrides
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |