Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Lucene.Net.Store.RAMDirectory Class Reference

A memory-resident Directory implementation. Locking implementation is by default the SingleInstanceLockFactory but can be changed with Directory.SetLockFactory. More...

Inherits Lucene.Net.Store.Directory.

Public Member Functions

 RAMDirectory ()
 Constructs an empty Directory.
 
 RAMDirectory (Directory dir)
 Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory. This should be used only with indices that can fit into memory. Note that the resulting RAMDirectory instance is fully independent from the original Directory (it is a complete copy). Any subsequent changes to the original Directory will not be visible in the RAMDirectory instance.
 
override System.String[] ListAll ()
 Returns an array of strings, one for each file in the directory.
 
override bool FileExists (System.String name)
 Returns true iff the named file exists in this directory.
 
override long FileModified (System.String name)
 Returns the time the named file was last modified.
 
override void TouchFile (System.String name)
 Set the modified time of an existing file to now.
 
override long FileLength (System.String name)
 Returns the length in bytes of a file in the directory.
 
long SizeInBytes ()
 Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.
 
override void DeleteFile (System.String name)
 Removes an existing file in the directory.
 
override IndexOutput CreateOutput (System.String name)
 Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
 
override IndexInput OpenInput (System.String name)
 Returns a stream reading an existing file.
 
- Public Member Functions inherited from Lucene.Net.Store.Directory
virtual void Sync (System.String name)
 Ensure that any writes to this file 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.
 
virtual IndexInput OpenInput (System.String name, int bufferSize)
 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 Lucene.Net.Index.CompoundFileReader
 
virtual Lock MakeLock (System.String name)
 Construct a Lock.
 
virtual void ClearLock (System.String name)
 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.
 
void Close ()
 
void Dispose ()
 Closes the store.
 
virtual void SetLockFactory (LockFactory 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).
 
virtual string 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 JVMs and/or on different machines) are considered "the same index". This is how locking "scopes" to the right index.
 
override string ToString ()
 
void EnsureOpen ()
 <throws> AlreadyClosedException if this Directory is closed </throws>
 

Protected Member Functions

override void Dispose (bool disposing)
 Closes the store to future operations, releasing associated memory.
 

Protected Attributes

HashMap< string, RAMFilefileMap = new HashMap<string, RAMFile>()
 
long internalSizeInBytes = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Lucene.Net.Store.Directory
static void Copy (Directory src, Directory dest, bool closeDirSrc)
 Copy contents of a directory src to a directory dest. If a file in src already exists in dest then the one in dest will be blindly overwritten.
 
- Properties inherited from Lucene.Net.Store.Directory
virtual LockFactory LockFactory [get]
 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.
 
bool isOpen_ForNUnit [get]
 

Detailed Description

A memory-resident Directory implementation. Locking implementation is by default the SingleInstanceLockFactory but can be changed with Directory.SetLockFactory.

Definition at line 29 of file RAMDirectory.cs.

Constructor & Destructor Documentation

Lucene.Net.Store.RAMDirectory.RAMDirectory ( )

Constructs an empty Directory.

Definition at line 42 of file RAMDirectory.cs.

Lucene.Net.Store.RAMDirectory.RAMDirectory ( Directory  dir)

Creates a new RAMDirectory instance from a different Directory implementation. This can be used to load a disk-based index into memory. This should be used only with indices that can fit into memory. Note that the resulting RAMDirectory instance is fully independent from the original Directory (it is a complete copy). Any subsequent changes to the original Directory will not be visible in the RAMDirectory instance.

Parameters
dira Directory value
Exceptions
System.IO.IOExceptionif an error occurs

Definition at line 64 of file RAMDirectory.cs.

Member Function Documentation

override IndexOutput Lucene.Net.Store.RAMDirectory.CreateOutput ( System.String  name)
virtual

Creates a new, empty file in the directory with the given name. Returns a stream writing this file.

Implements Lucene.Net.Store.Directory.

Definition at line 213 of file RAMDirectory.cs.

override void Lucene.Net.Store.RAMDirectory.DeleteFile ( System.String  name)
virtual

Removes an existing file in the directory.

<throws> IOException if the file does not exist </throws>

Implements Lucene.Net.Store.Directory.

Definition at line 195 of file RAMDirectory.cs.

override void Lucene.Net.Store.RAMDirectory.Dispose ( bool  disposing)
protectedvirtual

Closes the store to future operations, releasing associated memory.

Implements Lucene.Net.Store.Directory.

Definition at line 245 of file RAMDirectory.cs.

override bool Lucene.Net.Store.RAMDirectory.FileExists ( System.String  name)
virtual

Returns true iff the named file exists in this directory.

Implements Lucene.Net.Store.Directory.

Definition at line 101 of file RAMDirectory.cs.

override long Lucene.Net.Store.RAMDirectory.FileLength ( System.String  name)
virtual

Returns the length in bytes of a file in the directory.

<throws> IOException if the file does not exist </throws>

Implements Lucene.Net.Store.Directory.

Definition at line 167 of file RAMDirectory.cs.

override long Lucene.Net.Store.RAMDirectory.FileModified ( System.String  name)
virtual

Returns the time the named file was last modified.

<throws> IOException if the file does not exist </throws>

Implements Lucene.Net.Store.Directory.

Definition at line 114 of file RAMDirectory.cs.

override System.String [] Lucene.Net.Store.RAMDirectory.ListAll ( )
virtual

Returns an array of strings, one for each file in the directory.

Exceptions
System.IO.IOException

Implements Lucene.Net.Store.Directory.

Definition at line 83 of file RAMDirectory.cs.

override IndexInput Lucene.Net.Store.RAMDirectory.OpenInput ( System.String  name)
virtual

Returns a stream reading an existing file.

Implements Lucene.Net.Store.Directory.

Definition at line 231 of file RAMDirectory.cs.

long Lucene.Net.Store.RAMDirectory.SizeInBytes ( )

Return total size in bytes of all files in this directory. This is currently quantized to RAMOutputStream.BUFFER_SIZE.

Definition at line 184 of file RAMDirectory.cs.

override void Lucene.Net.Store.RAMDirectory.TouchFile ( System.String  name)
virtual

Set the modified time of an existing file to now.

<throws> IOException if the file does not exist </throws>

Implements Lucene.Net.Store.Directory.

Definition at line 133 of file RAMDirectory.cs.

Member Data Documentation

HashMap<string, RAMFile> Lucene.Net.Store.RAMDirectory.fileMap = new HashMap<string, RAMFile>()
protected

Definition at line 34 of file RAMDirectory.cs.

long Lucene.Net.Store.RAMDirectory.internalSizeInBytes = 0
protected

Definition at line 35 of file RAMDirectory.cs.


The documentation for this class was generated from the following file: