CLucene - a full-featured, c++ search engine
API Documentation


lucene::store::RAMDirectory Class Reference

A memory-resident Directory implementation. More...

#include <RAMDirectory.h>

Inheritance diagram for lucene::store::RAMDirectory:
lucene::store::Directory lucene::debug::LuceneBase lucene::store::TransactionalRAMDirectory

List of all members.

Classes

class  RAMLock

Public Member Functions

 DEFINE_MUTEX (files_mutex) void list(vector< string > *names) const
 Returns a null terminated array of strings, one for each file in the directory.
 RAMDirectory ()
 Constructs an empty Directory.
virtual ~RAMDirectory ()
 Destructor - only call this if you are sure the directory is not being used anymore.
 RAMDirectory (Directory *dir)
 RAMDirectory (const char *dir)
 Creates a new RAMDirectory instance from the FSDirectory.
bool fileExists (const char *name) const
 Returns true iff the named file exists in this directory.
int64_t fileModified (const char *name) const
 Returns the time the named file was last modified.
int64_t fileLength (const char *name) const
 Returns the length in bytes of a file in the directory.
virtual void renameFile (const char *from, const char *to)
 Removes an existing file in the directory.
void touchFile (const char *name)
 Set the modified time of an existing file to now.
virtual IndexOutputcreateOutput (const char *name)
 Creates a new, empty file in the directory with the given name.
LuceneLockmakeLock (const char *name)
 Construct a Lock.
IndexInputopenInput (const char *name)
 Returns a stream reading an existing file.
virtual void close ()
TCHAR * toString () const
const char * getDirectoryType () const

Static Public Member Functions

static const char * DirectoryType ()

Protected Member Functions

virtual bool doDeleteFile (const char *name)
 Removes an existing file in the directory.
void _copyFromDir (Directory *dir, bool closeDir)
 Creates a new RAMDirectory instance from a different Directory implementation.

Protected Attributes

FileMap files

Detailed Description

A memory-resident Directory implementation.


Constructor & Destructor Documentation

lucene::store::RAMDirectory::RAMDirectory (  ) 

Constructs an empty Directory.

virtual lucene::store::RAMDirectory::~RAMDirectory (  )  [virtual]

Destructor - only call this if you are sure the directory is not being used anymore.

Otherwise use the ref-counting facilities of dir->close

lucene::store::RAMDirectory::RAMDirectory ( Directory dir  ) 
lucene::store::RAMDirectory::RAMDirectory ( const char *  dir  ) 

Creates a new RAMDirectory instance from the FSDirectory.

Parameters:
dir a String specifying the full index directory path

Member Function Documentation

void lucene::store::RAMDirectory::_copyFromDir ( Directory dir,
bool  closeDir 
) [protected]

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.

Parameters:
dir a Directory value
Exceptions:
IOException if an error occurs
virtual void lucene::store::RAMDirectory::close (  )  [virtual]
virtual IndexOutput* lucene::store::RAMDirectory::createOutput ( const char *  name  )  [virtual]

Creates a new, empty file in the directory with the given name.

Returns a stream writing this file.

Implements lucene::store::Directory.

Reimplemented in lucene::store::TransactionalRAMDirectory.

lucene::store::RAMDirectory::DEFINE_MUTEX ( files_mutex   )  const [mutable]

Returns a null terminated array of strings, one for each file in the directory.

static const char* lucene::store::RAMDirectory::DirectoryType (  )  [inline, static]
virtual bool lucene::store::RAMDirectory::doDeleteFile ( const char *  name  )  [protected, virtual]

Removes an existing file in the directory.

Implements lucene::store::Directory.

Reimplemented in lucene::store::TransactionalRAMDirectory.

bool lucene::store::RAMDirectory::fileExists ( const char *  name  )  const [virtual]

Returns true iff the named file exists in this directory.

Implements lucene::store::Directory.

int64_t lucene::store::RAMDirectory::fileLength ( const char *  name  )  const [virtual]

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

Implements lucene::store::Directory.

int64_t lucene::store::RAMDirectory::fileModified ( const char *  name  )  const [virtual]

Returns the time the named file was last modified.

Implements lucene::store::Directory.

const char* lucene::store::RAMDirectory::getDirectoryType (  )  const [inline, virtual]
LuceneLock* lucene::store::RAMDirectory::makeLock ( const char *  name  )  [virtual]

Construct a Lock.

Parameters:
name the name of the lock file

Implements lucene::store::Directory.

IndexInput* lucene::store::RAMDirectory::openInput ( const char *  name  )  [virtual]

Returns a stream reading an existing file.

Implements lucene::store::Directory.

virtual void lucene::store::RAMDirectory::renameFile ( const char *  from,
const char *  to 
) [virtual]

Removes an existing file in the directory.

Implements lucene::store::Directory.

Reimplemented in lucene::store::TransactionalRAMDirectory.

TCHAR* lucene::store::RAMDirectory::toString (  )  const [virtual]
void lucene::store::RAMDirectory::touchFile ( const char *  name  )  [virtual]

Set the modified time of an existing file to now.

Implements lucene::store::Directory.


Member Data Documentation


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

clucene.sourceforge.net