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


lucene::store::FSDirectory Class Reference

Straightforward implementation of Directory as a directory of files. More...

#include <FSDirectory.h>

Inheritance diagram for lucene::store::FSDirectory:

lucene::store::Directory

Public Member Functions

 ~FSDirectory ()
 Destructor - only call this if you are sure the directory is not being used anymore.
void list (std::vector< std::string > *names) const
 Get a list of strings, one for each file in the directory.
bool fileExists (const char *name) const
 Returns true iff a file with the given name exists.
const char * getDirName () const
 Returns the text name of the 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.
IndexInputopenInput (const char *name)
 Returns a stream reading an existing file.
IndexInputopenInput (const char *name, int32_t bufferSize)
IndexInputopenMMapFile (const char *name, int32_t bufferSize=LUCENE_STREAM_BUFFER_SIZE)
void renameFile (const char *from, const char *to)
 Renames an existing file in the directory.
void touchFile (const char *name)
 Set the modified time of an existing file to now.
IndexOutputcreateOutput (const char *name)
 Creates a new, empty file in the directory with the given name.
void close ()
 Decrease the ref-count to the directory by one.
void setUseMMap (bool value)
 If MMap is available, this can disable use of mmap reading.
bool getUseMMap () const
 Gets whether the directory is using MMap for inputstreams.
TCHAR * toString () const
const char * getDirectoryType () const

Static Public Member Functions

static FSDirectorygetDirectory (const char *file, const bool create, LockFactory *lockFactory=NULL)
 Returns the directory instance for the named location.
static int64_t fileModified (const char *dir, const char *name)
 Returns the time the named file was last modified.
static const char * DirectoryType ()
static void setDisableLocks (bool doDisableLocks)
 Set whether Lucene's use of lock files is disabled.
static bool getDisableLocks ()
 Returns whether Lucene's use of lock files is disabled.

Protected Member Functions

 FSDirectory (const char *path, const bool createDir, LockFactory *lockFactory=NULL)
bool doDeleteFile (const char *name)
 Removes an existing file in the directory.

Friends

class FSDirectory::FSIndexOutput
class FSDirectory::FSIndexInput

Detailed Description

Straightforward implementation of Directory as a directory of files.

If the system property 'disableLuceneLocks' has the String value of "true", lock creation will be disabled.

See also:
Directory

Constructor & Destructor Documentation

lucene::store::FSDirectory::FSDirectory ( const char *  path,
const bool  createDir,
LockFactory lockFactory = NULL 
) [protected]

lucene::store::FSDirectory::~FSDirectory (  ) 

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

Otherwise use the ref-counting facilities of _CLDECDELETE


Member Function Documentation

bool lucene::store::FSDirectory::doDeleteFile ( const char *  name  )  [protected, virtual]

Removes an existing file in the directory.

Implements lucene::store::Directory.

void lucene::store::FSDirectory::list ( std::vector< std::string > *  names  )  const [virtual]

Get a list of strings, one for each file in the directory.

Implements lucene::store::Directory.

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

Returns true iff a file with the given name exists.

Implements lucene::store::Directory.

const char* lucene::store::FSDirectory::getDirName (  )  const

Returns the text name of the directory.

returns reference

static FSDirectory* lucene::store::FSDirectory::getDirectory ( const char *  file,
const bool  create,
LockFactory lockFactory = NULL 
) [static]

Returns the directory instance for the named location.

Do not delete this instance, only use close, otherwise other instances will lose this instance.

Directories are cached, so that, for a given canonical path, the same FSDirectory instance will always be returned. This permits synchronization on directories.

Parameters:
file the path to the directory.
create if true, create, or erase any existing contents.
Returns:
the FSDirectory for the named file.

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

Returns the time the named file was last modified.

Implements lucene::store::Directory.

static int64_t lucene::store::FSDirectory::fileModified ( const char *  dir,
const char *  name 
) [static]

Returns the time the named file was last modified.

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

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

Implements lucene::store::Directory.

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

Returns a stream reading an existing file.

Implements lucene::store::Directory.

IndexInput* lucene::store::FSDirectory::openInput ( const char *  name,
int32_t  bufferSize 
) [virtual]

Reimplemented from lucene::store::Directory.

IndexInput* lucene::store::FSDirectory::openMMapFile ( const char *  name,
int32_t  bufferSize = LUCENE_STREAM_BUFFER_SIZE 
)

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

Renames an existing file in the directory.

Implements lucene::store::Directory.

void lucene::store::FSDirectory::touchFile ( const char *  name  )  [virtual]

Set the modified time of an existing file to now.

Implements lucene::store::Directory.

IndexOutput* lucene::store::FSDirectory::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.

void lucene::store::FSDirectory::close (  )  [virtual]

Decrease the ref-count to the directory by one.

If the object is no longer needed, then the object is removed from the directory pool.

Implements lucene::store::Directory.

void lucene::store::FSDirectory::setUseMMap ( bool  value  )  [inline]

If MMap is available, this can disable use of mmap reading.

bool lucene::store::FSDirectory::getUseMMap (  )  const [inline]

Gets whether the directory is using MMap for inputstreams.

TCHAR* lucene::store::FSDirectory::toString (  )  const [virtual]

static const char* lucene::store::FSDirectory::DirectoryType (  )  [inline, static]

const char* lucene::store::FSDirectory::getDirectoryType (  )  const [inline, virtual]

static void lucene::store::FSDirectory::setDisableLocks ( bool  doDisableLocks  )  [inline, static]

Set whether Lucene's use of lock files is disabled.

By default, lock files are enabled. They should only be disabled if the index is on a read-only medium like a CD-ROM.

static bool lucene::store::FSDirectory::getDisableLocks (  )  [inline, static]

Returns whether Lucene's use of lock files is disabled.

Returns:
true if locks are disabled, false if locks are enabled.


Friends And Related Function Documentation

friend class FSDirectory::FSIndexOutput [friend]

friend class FSDirectory::FSIndexInput [friend]


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

clucene.sourceforge.net