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


 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 {
35  {
36  public:
40  virtual ~IndexFileDeleter();
41 
43 
44  protected:
48 
50  MapStringRefCount refCounts;
51 
56 
59 
62 
67 
70 
72  static bool VERBOSE_REF_COUNTS;
73 
74  public:
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 
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 
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:
155  virtual ~CommitPoint();
156 
158 
159  public:
160  int64_t gen;
163  bool deleted;
166  int64_t version;
167  int64_t generation;
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