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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IndexFileDeleter.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 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 INDEXFILEDELETER_H
8 #define INDEXFILEDELETER_H
9
10 #include "IndexCommit.h"
11
12 namespace Lucene
13 {
34 class IndexFileDeleter : public LuceneObject
35 {
36 public:
39 IndexFileDeleter(DirectoryPtr directory, IndexDeletionPolicyPtr policy, SegmentInfosPtr segmentInfos, InfoStreamPtr infoStream, DocumentsWriterPtr docWriter, HashSet<String> synced);
40 virtual ~IndexFileDeleter();
41
42 LUCENE_CLASS(IndexFileDeleter);
43
44 protected:
47 HashSet<String> deletable;
48
50 MapStringRefCount refCounts;
51
55 Collection<IndexCommitPtr> commits;
56
58 Collection< HashSet<String> > lastFiles;
59
61 Collection<CommitPointPtr> commitsToDelete;
62
63 InfoStreamPtr infoStream;
64 DirectoryPtr directory;
65 IndexDeletionPolicyPtr policy;
66 DocumentsWriterPtr docWriter;
67
68 SegmentInfosPtr lastSegmentInfos;
69 HashSet<String> synced;
70
72 static bool VERBOSE_REF_COUNTS;
73
74 public:
75 bool startingCommitDeleted;
76
77 protected:
78 void message(const String& message);
79
81 void deleteCommits();
82
83 void deletePendingFiles();
84
85 RefCountPtr getRefCount(const String& fileName);
86
87 public:
88 void setInfoStream(InfoStreamPtr infoStream);
89
90 SegmentInfosPtr getLastSegmentInfos();
91
95 void refresh(const String& segmentName);
96 void refresh();
97
98 void close();
99
111 void checkpoint(SegmentInfosPtr segmentInfos, bool isCommit);
112
113 void incRef(SegmentInfosPtr segmentInfos, bool isCommit);
114 void incRef(HashSet<String> files);
115 void incRef(const String& fileName);
116 void decRef(HashSet<String> files);
117 void decRef(const String& fileName);
118 void decRef(SegmentInfosPtr segmentInfos);
119
120 bool exists(const String& fileName);
121
122 void deleteFiles(HashSet<String> files);
123
125 void deleteNewFiles(HashSet<String> files);
126
127 void deleteFile(const String& fileName);
128 };
129
131 class RefCount : public LuceneObject
132 {
133 public:
134 RefCount(const String& fileName);
135 virtual ~RefCount();
136
137 LUCENE_CLASS(RefCount);
138
139 public:
140 String fileName; // fileName used only for better assert error messages
141 bool initDone;
142 int32_t count;
143
144 public:
145 int32_t IncRef();
146 int32_t DecRef();
147 };
148
151 class CommitPoint : public IndexCommit
152 {
153 public:
154 CommitPoint(Collection<CommitPointPtr> commitsToDelete, DirectoryPtr directory, SegmentInfosPtr segmentInfos);
155 virtual ~CommitPoint();
156
157 LUCENE_CLASS(CommitPoint);
158
159 public:
160 int64_t gen;
161 HashSet<String> files;
162 String segmentsFileName;
163 bool deleted;
164 DirectoryPtr directory;
165 Collection<CommitPointPtr> commitsToDelete;
166 int64_t version;
167 int64_t generation;
168 bool _isOptimized;
169 MapStringString userData;
170
171 public:
172 virtual String toString();
173
175 virtual bool isOptimized();
176
178 virtual String getSegmentsFileName();
179
181 virtual HashSet<String> getFileNames();
182
184 virtual DirectoryPtr getDirectory();
185
187 virtual int64_t getVersion();
188
190 virtual int64_t getGeneration();
191
193 virtual MapStringString getUserData();
194
196 virtual void deleteCommit();
197
198 virtual bool isDeleted();
199
200 virtual int32_t compareTo(LuceneObjectPtr other);
201 };
202 }
203
204 #endif

clucene.sourceforge.net