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


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FileSwitchDirectory.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 FILESWITCHDIRECTORY_H
8 #define FILESWITCHDIRECTORY_H
9 
10 #include "Directory.h"
11 
12 namespace Lucene {
13 
21 class LPPAPI FileSwitchDirectory : public Directory {
22 public:
23  FileSwitchDirectory(HashSet<String> primaryExtensions, const DirectoryPtr& primaryDir, const DirectoryPtr& secondaryDir, bool doClose);
24  virtual ~FileSwitchDirectory();
25 
27 
28 protected:
29  HashSet<String> primaryExtensions;
32  bool doClose;
33 
34 public:
36  DirectoryPtr getPrimaryDir();
37 
39  DirectoryPtr getSecondaryDir();
40 
42  virtual void close();
43 
45  virtual HashSet<String> listAll();
46 
48  static String getExtension(const String& name);
49 
51  virtual bool fileExists(const String& name);
52 
54  virtual uint64_t fileModified(const String& name);
55 
57  virtual void touchFile(const String& name);
58 
60  virtual void deleteFile(const String& name);
61 
63  virtual int64_t fileLength(const String& name);
64 
67  virtual IndexOutputPtr createOutput(const String& name);
68 
72  virtual void sync(const String& name);
73 
77  virtual IndexInputPtr openInput(const String& name);
78 
79 protected:
80  DirectoryPtr getDirectory(const String& name);
81 };
82 
83 }
84 
85 #endif
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494
A Directory instance that switches files between two other Directory instances.
Definition: FileSwitchDirectory.h:21
DirectoryPtr primaryDir
Definition: FileSwitchDirectory.h:30
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
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
DirectoryPtr secondaryDir
Definition: FileSwitchDirectory.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.
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.
bool doClose
Definition: FileSwitchDirectory.h:32

clucene.sourceforge.net