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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
Lucene::FileSwitchDirectory Class Reference

A Directory instance that switches files between two other Directory instances. More...

`#include <FileSwitchDirectory.h>`

Inheritance diagram for Lucene::FileSwitchDirectory:

## Public Member Functions

| FileSwitchDirectory (HashSet< String > primaryExtensions, DirectoryPtr primaryDir, DirectoryPtr secondaryDir, bool doClose)
virtual | ~FileSwitchDirectory ()
virtual String | getClassName ()
boost::shared_ptr < FileSwitchDirectory > | shared_from_this ()
DirectoryPtr | getPrimaryDir ()
| Return the primary directory. More...
DirectoryPtr | getSecondaryDir ()
| Return the secondary directory. More...
virtual void | close ()
| Closes the store. More...
virtual HashSet< String > | listAll ()
| Returns an array of strings, one for each file in the directory. More...
virtual bool | fileExists (const String &name)
| Returns true if a file with the given name exists. More...
virtual uint64_t | fileModified (const String &name)
| Returns the time the named file was last modified. More...
virtual void | touchFile (const String &name)
| Set the modified time of an existing file to now. More...
virtual void | deleteFile (const String &name)
| Removes an existing file in the directory. More...
virtual int64_t | fileLength (const String &name)
| Returns the length of a file in the directory. More...
virtual IndexOutputPtr | createOutput (const String &name)
| Creates a new, empty file in the directory with the given name. Returns a stream writing this file. More...
virtual void | sync (const 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. More...
virtual IndexInputPtr | openInput (const String &name)
| Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. More...
Public Member Functions inherited from Lucene::Directory
| Directory ()
virtual | ~Directory ()
boost::shared_ptr< Directory > | shared_from_this ()
virtual IndexInputPtr | openInput (const String &name, int32_t 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 CompoundFileReader. More...
virtual LockPtr | makeLock (const String &name)
| Construct a Lock. More...
void | clearLock (const 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. More...
void | setLockFactory (LockFactoryPtr 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). More...
LockFactoryPtr | getLockFactory ()
| 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. More...
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 are considered "the same index". This is how locking "scopes" to the right index. More...
virtual String | toString ()
| Returns a string representation of the object. More...
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed. More...
virtual LuceneObjectPtr | clone (LuceneObjectPtr other=LuceneObjectPtr())
| Return clone of this object. More...
virtual int32_t | hashCode ()
| Return hash code for this object. More...
virtual bool | equals (LuceneObjectPtr other)
| Return whether two objects are equal. More...
virtual int32_t | compareTo (LuceneObjectPtr other)
| Compare two objects. More...
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock. More...
virtual LuceneSignalPtr | getSignal ()
| Return this object signal. More...
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout. More...
virtual void | unlock ()
| Unlock this object. More...
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread. More...
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout. More...
virtual void | notifyAll ()
| Notify all threads waiting for signal. More...

## Static Public Member Functions

static String | _getClassName ()
static String | getExtension (const String &name)
| Utility method to return a file's extension. More...
Static Public Member Functions inherited from Lucene::Directory
static String | _getClassName ()
static void | copy (DirectoryPtr src, DirectoryPtr 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. NOTE: the source directory cannot change while this method is running. Otherwise the results are undefined. More...

## Protected Member Functions

DirectoryPtr | getDirectory (const String &name)
Protected Member Functions inherited from Lucene::Directory
void | ensureOpen ()
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Protected Attributes

HashSet< String > | primaryExtensions
DirectoryPtr | primaryDir
DirectoryPtr | secondaryDir
bool | doClose
Protected Attributes inherited from Lucene::Directory
bool | isOpen
LockFactoryPtr | lockFactory
| Holds the LockFactory instance (implements locking for this Directory instance). More...

## Detailed Description

A Directory instance that switches files between two other Directory instances.

Files with the specified extensions are placed in the primary directory; others are placed in the secondary directory. The provided Set must not change once passed to this class, and must allow multiple threads to call contains at once.

## Constructor & Destructor Documentation

Lucene::FileSwitchDirectory::FileSwitchDirectory | ( | HashSet< String > | primaryExtensions,
|  | DirectoryPtr | primaryDir,
|  | DirectoryPtr | secondaryDir,
|  | bool | doClose
| ) |  |

virtual Lucene::FileSwitchDirectory::~FileSwitchDirectory | ( | ) |  |

virtual

## Member Function Documentation

static String Lucene::FileSwitchDirectory::_getClassName | ( | ) |  |

inline static

virtual void Lucene::FileSwitchDirectory::close | ( | ) |  |

virtual

Closes the store.

Implements Lucene::Directory.

virtual IndexOutputPtr Lucene::FileSwitchDirectory::createOutput | ( | const String & | name) |  |

virtual

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

Implements Lucene::Directory.

virtual void Lucene::FileSwitchDirectory::deleteFile | ( | const String & | name) |  |

virtual

Removes an existing file in the directory.

Implements Lucene::Directory.

virtual bool Lucene::FileSwitchDirectory::fileExists | ( | const String & | name) |  |

virtual

Returns true if a file with the given name exists.

Implements Lucene::Directory.

virtual int64_t Lucene::FileSwitchDirectory::fileLength | ( | const String & | name) |  |

virtual

Returns the length of a file in the directory.

Implements Lucene::Directory.

virtual uint64_t Lucene::FileSwitchDirectory::fileModified | ( | const String & | name) |  |

virtual

Returns the time the named file was last modified.

Implements Lucene::Directory.

virtual String Lucene::FileSwitchDirectory::getClassName | ( | ) |  |

inline virtual

Reimplemented from Lucene::Directory.

DirectoryPtr Lucene::FileSwitchDirectory::getDirectory | ( | const String & | name) |  |

protected

static String Lucene::FileSwitchDirectory::getExtension | ( | const String & | name) |  |

static

Utility method to return a file's extension.

DirectoryPtr Lucene::FileSwitchDirectory::getPrimaryDir | ( | ) |  |

Return the primary directory.

DirectoryPtr Lucene::FileSwitchDirectory::getSecondaryDir | ( | ) |  |

Return the secondary directory.

virtual HashSet<String> Lucene::FileSwitchDirectory::listAll | ( | ) |  |

virtual

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

Implements Lucene::Directory.

virtual IndexInputPtr Lucene::FileSwitchDirectory::openInput | ( | const String & | name) |  |

virtual

Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size.

Implements Lucene::Directory.

boost::shared_ptr< FileSwitchDirectory > Lucene::FileSwitchDirectory::shared_from_this | ( | ) |  |

inline

virtual void Lucene::FileSwitchDirectory::sync | ( | const String & | name) |  |

virtual

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.

Reimplemented from Lucene::Directory.

virtual void Lucene::FileSwitchDirectory::touchFile | ( | const String & | name) |  |

virtual

Set the modified time of an existing file to now.

Implements Lucene::Directory.

## Field Documentation

bool Lucene::FileSwitchDirectory::doClose

protected

DirectoryPtr Lucene::FileSwitchDirectory::primaryDir

protected

HashSet<String> Lucene::FileSwitchDirectory::primaryExtensions

protected

DirectoryPtr Lucene::FileSwitchDirectory::secondaryDir

protected

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

- FileSwitchDirectory.h

clucene.sourceforge.net