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

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
26 LUCENE_CLASS(FileSwitchDirectory);
27
28 protected:
29 HashSet<String> primaryExtensions;
30 DirectoryPtr primaryDir;
31 DirectoryPtr secondaryDir;
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
Directory.h
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::Directory
A Directory is a flat list of files. Files may be written once, when they are created....
Definition: Directory.h:18
Lucene::FileSwitchDirectory
A Directory instance that switches files between two other Directory instances.
Definition: FileSwitchDirectory.h:21
Lucene::FileSwitchDirectory::primaryDir
DirectoryPtr primaryDir
Definition: FileSwitchDirectory.h:30
Lucene::FileSwitchDirectory::touchFile
virtual void touchFile(const String &name)
Set the modified time of an existing file to now.
Lucene::FileSwitchDirectory::primaryExtensions
HashSet< String > primaryExtensions
Definition: FileSwitchDirectory.h:26
Lucene::FileSwitchDirectory::getDirectory
DirectoryPtr getDirectory(const String &name)
Lucene::FileSwitchDirectory::close
virtual void close()
Closes the store.
Lucene::FileSwitchDirectory::fileModified
virtual uint64_t fileModified(const String &name)
Returns the time the named file was last modified.
Lucene::FileSwitchDirectory::getSecondaryDir
DirectoryPtr getSecondaryDir()
Return the secondary directory.
Lucene::FileSwitchDirectory::listAll
virtual HashSet< String > listAll()
Returns an array of strings, one for each file in the directory.
Lucene::FileSwitchDirectory::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::FileSwitchDirectory::getPrimaryDir
DirectoryPtr getPrimaryDir()
Return the primary directory.
Lucene::FileSwitchDirectory::deleteFile
virtual void deleteFile(const String &name)
Removes an existing file in the directory.
Lucene::FileSwitchDirectory::fileLength
virtual int64_t fileLength(const String &name)
Returns the length of a file in the directory.
Lucene::FileSwitchDirectory::doClose
bool doClose
Definition: FileSwitchDirectory.h:32
Lucene::FileSwitchDirectory::secondaryDir
DirectoryPtr secondaryDir
Definition: FileSwitchDirectory.h:31
Lucene::FileSwitchDirectory::fileExists
virtual bool fileExists(const String &name)
Returns true if a file with the given name exists.
Lucene::FileSwitchDirectory::~FileSwitchDirectory
virtual ~FileSwitchDirectory()
Lucene::FileSwitchDirectory::openInput
virtual IndexInputPtr openInput(const String &name)
Returns a stream reading an existing file, with the specified read buffer size. The particular Direct...
Lucene::FileSwitchDirectory::createOutput
virtual IndexOutputPtr createOutput(const String &name)
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
Lucene::FileSwitchDirectory::FileSwitchDirectory
FileSwitchDirectory(HashSet< String > primaryExtensions, const DirectoryPtr &primaryDir, const DirectoryPtr &secondaryDir, bool doClose)
Lucene::FileSwitchDirectory::getExtension
static String getExtension(const String &name)
Utility method to return a file's extension.
Lucene::HashSet< String >
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::IndexOutputPtr
boost::shared_ptr< IndexOutput > IndexOutputPtr
Definition: LuceneTypes.h:494

clucene.sourceforge.net