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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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:
20  Directory();
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 
86  LockFactoryPtr getLockFactory();
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
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494
boost::shared_ptr< Lock > LockPtr
Definition: LuceneTypes.h:496
A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing. Directory locking is implemented by an instance of LockFactory, and can be changed for each Directory instance using setLockFactory.
Definition: Directory.h:18
LockFactoryPtr lockFactory
Holds the LockFactory instance (implements locking for this Directory instance).
Definition: Directory.h:29
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Base class for all Lucene classes.
Definition: LuceneObject.h:31
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
LPPAPI bool fileExists(const String &path)
Return true if given file or directory exists.
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
LPPAPI int64_t fileLength(const String &path)
Return file length in bytes.
boost::shared_ptr< LockFactory > LockFactoryPtr
Definition: LuceneTypes.h:497
LPPAPI bool touchFile(const String &path)
Set file last modified date and time to now.
LPPAPI uint64_t fileModified(const String &path)
Return file last modified date and time.

clucene.sourceforge.net