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

FSDirectory.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 FSDIRECTORY_H
8 #define FSDIRECTORY_H
9
10 #include "Directory.h"
11
12 namespace Lucene {
13
29 class LPPAPI FSDirectory : public Directory {
30 protected:
34 FSDirectory(const String& path, const LockFactoryPtr& lockFactory);
35
36 public:
37 virtual ~FSDirectory();
38
39 LUCENE_CLASS(FSDirectory);
40
41 public:
44 static const int32_t DEFAULT_READ_CHUNK_SIZE;
45
46 protected:
47 bool checked;
48
50 String directory;
51
53 int32_t chunkSize;
54
55 public:
57 static FSDirectoryPtr open(const String& path);
58
60 static FSDirectoryPtr open(const String& path, const LockFactoryPtr& lockFactory);
61
64 static HashSet<String> listAll(const String& dir);
65
67 static uint64_t fileModified(const String& directory, const String& name);
68
70 void createDir();
71
73 String getFile();
74
79 void setReadChunkSize(int32_t chunkSize);
80
83 int32_t getReadChunkSize();
84
87 virtual HashSet<String> listAll();
88
90 virtual bool fileExists(const String& name);
91
93 virtual uint64_t fileModified(const String& name);
94
96 virtual void touchFile(const String& name);
97
99 virtual void deleteFile(const String& name);
100
102 virtual int64_t fileLength(const String& name);
103
106 virtual void sync(const String& name);
107
110 virtual IndexInputPtr openInput(const String& name);
111
115 virtual IndexInputPtr openInput(const String& name, int32_t bufferSize);
116
118 virtual String getLockID();
119
121 virtual void close();
122
124 virtual String toString();
125
126 protected:
128 void initOutput(const String& name);
129 };
130
131 }
132
133 #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::FSDirectory
Base class for Directory implementations that store index files in the file system....
Definition: FSDirectory.h:29
Lucene::FSDirectory::FSDirectory
FSDirectory(const String &path, const LockFactoryPtr &lockFactory)
Create a new FSDirectory for the named location (ctor for subclasses).
Lucene::FSDirectory::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::FSDirectory::checked
bool checked
Definition: FSDirectory.h:47
Lucene::FSDirectory::getFile
String getFile()
Return file system directory.
Lucene::FSDirectory::deleteFile
virtual void deleteFile(const String &name)
Removes an existing file in the directory.
Lucene::FSDirectory::close
virtual void close()
Closes the store to future operations.
Lucene::FSDirectory::setReadChunkSize
void setReadChunkSize(int32_t chunkSize)
Sets the maximum number of bytes read at once from the underlying file during IndexInput#readBytes....
Lucene::FSDirectory::DEFAULT_READ_CHUNK_SIZE
static const int32_t DEFAULT_READ_CHUNK_SIZE
Default read chunk size. This is a conditional default based on operating system.
Definition: FSDirectory.h:39
Lucene::FSDirectory::fileModified
virtual uint64_t fileModified(const String &name)
Returns the time the named file was last modified.
Lucene::FSDirectory::getReadChunkSize
int32_t getReadChunkSize()
The maximum number of bytes to read at once from the underlying file during IndexInput#readBytes.
Lucene::FSDirectory::fileModified
static uint64_t fileModified(const String &directory, const String &name)
Returns the time the named file was last modified.
Lucene::FSDirectory::open
static FSDirectoryPtr open(const String &path, const LockFactoryPtr &lockFactory)
Just like open(File), but allows you to also specify a custom LockFactory.
Lucene::FSDirectory::touchFile
virtual void touchFile(const String &name)
Set the modified time of an existing file to now.
Lucene::FSDirectory::fileExists
virtual bool fileExists(const String &name)
Returns true if a file with the given name exists.
Lucene::FSDirectory::directory
String directory
The underlying filesystem directory.
Definition: FSDirectory.h:50
Lucene::FSDirectory::getLockID
virtual String getLockID()
Return a string identifier that uniquely differentiates this Directory instance from other Directory ...
Lucene::FSDirectory::createDir
void createDir()
Create file system directory.
Lucene::FSDirectory::toString
virtual String toString()
For debug output.
Lucene::FSDirectory::openInput
virtual IndexInputPtr openInput(const String &name)
Returns a stream reading an existing file, with the specified read buffer size. The particular Direct...
Lucene::FSDirectory::initOutput
void initOutput(const String &name)
Initializes the directory to create a new file with the given name. This method should be used in cre...
Lucene::FSDirectory::fileLength
virtual int64_t fileLength(const String &name)
Returns the length in bytes of a file in the directory.
Lucene::FSDirectory::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::FSDirectory::listAll
static HashSet< String > listAll(const String &dir)
Lists all files (not subdirectories) in the directory.
Lucene::FSDirectory::~FSDirectory
virtual ~FSDirectory()
Lucene::FSDirectory::listAll
virtual HashSet< String > listAll()
Lists all files (not subdirectories) in the directory.
Lucene::FSDirectory::chunkSize
int32_t chunkSize
Definition: FSDirectory.h:53
Lucene::FSDirectory::open
static FSDirectoryPtr open(const String &path)
Creates an FSDirectory instance.
Lucene::HashSet< String >
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::FSDirectoryPtr
boost::shared_ptr< FSDirectory > FSDirectoryPtr
Definition: LuceneTypes.h:491
Lucene::LockFactoryPtr
boost::shared_ptr< LockFactory > LockFactoryPtr
Definition: LuceneTypes.h:497
Lucene::IndexInputPtr
boost::shared_ptr< IndexInput > IndexInputPtr
Definition: LuceneTypes.h:493

clucene.sourceforge.net