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


Directory.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef DIRECTORY_H
8 #define DIRECTORY_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene {
13 
18 class LPPAPI Directory : public LuceneObject {
19 public:
21  virtual ~Directory();
22 
24 
25 protected:
26  bool isOpen;
27 
30 
31 public:
33  virtual HashSet<String> listAll() = 0;
34 
36  virtual bool fileExists(const String& name) = 0;
37 
39  virtual uint64_t fileModified(const String& name) = 0;
40 
42  virtual void touchFile(const String& name) = 0;
43 
45  virtual void deleteFile(const String& name) = 0;
46 
48  virtual int64_t fileLength(const String& name) = 0;
49 
52  virtual IndexOutputPtr createOutput(const String& name) = 0;
53 
55  virtual IndexInputPtr openInput(const String& name) = 0;
56 
58  virtual void close() = 0;
59 
62  virtual void sync(const String& name);
63 
67  virtual IndexInputPtr openInput(const String& name, int32_t bufferSize);
68 
71  virtual LockPtr makeLock(const String& name);
72 
76  void clearLock(const String& name);
77 
82  void setLockFactory(const LockFactoryPtr& lockFactory);
83 
87 
91  virtual String getLockID();
92 
93  virtual String toString();
94 
101  static void copy(const DirectoryPtr& src, const DirectoryPtr& dest, bool closeDirSrc);
102 
103 protected:
105  void ensureOpen();
106 };
107 
108 }
109 
110 #endif
Lucene::Directory::Directory
Directory()
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::LockFactoryPtr
boost::shared_ptr< LockFactory > LockFactoryPtr
Definition: LuceneTypes.h:497
Lucene::Directory
A Directory is a flat list of files. Files may be written once, when they are created....
Definition: Directory.h:18
Lucene::Directory::fileLength
virtual int64_t fileLength(const String &name)=0
Returns the length of a file in the directory.
Lucene::LockPtr
boost::shared_ptr< Lock > LockPtr
Definition: LuceneTypes.h:496
Lucene::Directory::~Directory
virtual ~Directory()
Lucene::Directory::listAll
virtual HashSet< String > listAll()=0
Returns an array of strings, one for each file in the directory.
Lucene::Directory::createOutput
virtual IndexOutputPtr createOutput(const String &name)=0
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
Lucene::Directory::openInput
virtual IndexInputPtr openInput(const String &name)=0
Returns a stream reading an existing file.
Lucene::Directory::fileExists
virtual bool fileExists(const String &name)=0
Returns true if a file with the given name exists.
Lucene::Directory::deleteFile
virtual void deleteFile(const String &name)=0
Removes an existing file in the directory.
Lucene::Directory::sync
virtual void sync(const String &name)
Ensure that any writes to this file are moved to stable storage. Lucene uses this to properly commit ...
Lucene::Directory::lockFactory
LockFactoryPtr lockFactory
Holds the LockFactory instance (implements locking for this Directory instance).
Definition: Directory.h:29
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::Directory::touchFile
virtual void touchFile(const String &name)=0
Set the modified time of an existing file to now.
Lucene::Directory::clearLock
void clearLock(const String &name)
Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you...
Lucene::Directory::getLockID
virtual String getLockID()
Return a string identifier that uniquely differentiates this Directory instance from other Directory ...
Lucene::LuceneObject
Base class for all Lucene classes.
Definition: LuceneObject.h:31
Lucene::Directory::setLockFactory
void setLockFactory(const LockFactoryPtr &lockFactory)
Set the LockFactory that this Directory instance should use for its locking implementation....
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
Lucene::HashSet< String >
Lucene::Directory::copy
static void copy(const DirectoryPtr &src, const DirectoryPtr &dest, bool closeDirSrc)
Copy contents of a directory src to a directory dest. If a file in src already exists in dest then th...
Lucene::Directory::makeLock
virtual LockPtr makeLock(const String &name)
Construct a Lock.
Lucene::Directory::openInput
virtual IndexInputPtr openInput(const String &name, int32_t bufferSize)
Returns a stream reading an existing file, with the specified read buffer size. The particular Direct...
Lucene::Directory::isOpen
bool isOpen
Definition: Directory.h:23
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::Directory::toString
virtual String toString()
Returns a string representation of the object.
Lucene::Directory::close
virtual void close()=0
Closes the store.
Lucene::Directory::ensureOpen
void ensureOpen()
Lucene::Directory::fileModified
virtual uint64_t fileModified(const String &name)=0
Returns the time the named file was last modified.
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494
LuceneObject.h
Lucene::Directory::getLockFactory
LockFactoryPtr getLockFactory()
Get the LockFactory that this Directory instance is using for its locking implementation....

clucene.sourceforge.net