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
SegmentInfos.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 SEGMENTINFOS_H
8 #define SEGMENTINFOS_H
9
10 #include "SegmentInfoCollection.h"
11
12 namespace Lucene
13 {
15 class LPPAPI SegmentInfos : public SegmentInfoCollection
16 {
17 public:
18 SegmentInfos();
19 virtual ~SegmentInfos();
20
21 LUCENE_CLASS(SegmentInfos);
22
23 public:
25 static const int32_t FORMAT;
26
31 static const int32_t FORMAT_LOCKLESS;
32
34 static const int32_t FORMAT_SINGLE_NORM_FILE;
35
37 static const int32_t FORMAT_SHARED_DOC_STORE;
38
40 static const int32_t FORMAT_CHECKSUM;
41
43 static const int32_t FORMAT_DEL_COUNT;
44
47 static const int32_t FORMAT_HAS_PROX;
48
50 static const int32_t FORMAT_USER_DATA;
51
53 static const int32_t FORMAT_DIAGNOSTICS;
54
56 static const int32_t CURRENT_FORMAT;
57
58 int32_t counter; // used to name new segments
59
60 private:
62 static int32_t defaultGenFileRetryCount;
63 static int32_t defaultGenFileRetryPauseMsec;
64 static int32_t defaultGenLookaheadCount;
65
68 int64_t version;
69
70 int64_t generation; // generation of the "segments_N" for the next commit
71
72 int64_t lastGeneration; // generation of the "segments_N" file we last successfully read
73 // or wrote; this is normally the same as generation except if
74 // there was an exception that had interrupted a commit
75
76 MapStringString userData; // Opaque map<string, string> that user can specify during IndexWriter::commit
77
78 static MapStringString singletonUserData;
79
80 static InfoStreamPtr infoStream;
81 ChecksumIndexOutputPtr pendingSegnOutput;
82
83 public:
84 SegmentInfoPtr info(int32_t i);
85 String getCurrentSegmentFileName();
86 String getNextSegmentFileName();
87
89 void read(DirectoryPtr directory, const String& segmentFileName);
90
92 void read(DirectoryPtr directory);
93
95 virtual LuceneObjectPtr clone(LuceneObjectPtr other = LuceneObjectPtr());
96
98 int64_t getVersion();
99 int64_t getGeneration();
100 int64_t getLastGeneration();
101
104 SegmentInfosPtr range(int32_t first, int32_t last);
105
107 void updateGeneration(SegmentInfosPtr other);
108
109 void rollbackCommit(DirectoryPtr dir);
110
115 void prepareCommit(DirectoryPtr dir);
116
119 HashSet<String> files(DirectoryPtr dir, bool includeSegmentsFile);
120
121 void finishCommit(DirectoryPtr dir);
122
124 void commit(DirectoryPtr dir);
125
126 String segString(DirectoryPtr directory);
127 MapStringString getUserData();
128 void setUserData(MapStringString data);
129
132 void replace(SegmentInfosPtr other);
133
134 bool hasExternalSegments(DirectoryPtr dir);
135
136 static int64_t getCurrentSegmentGeneration(HashSet<String> files);
137 static int64_t getCurrentSegmentGeneration(DirectoryPtr directory);
138 static String getCurrentSegmentFileName(HashSet<String> files);
139 static String getCurrentSegmentFileName(DirectoryPtr directory);
140 static int64_t generationFromSegmentsFileName(const String& fileName);
141
143 static int64_t readCurrentVersion(DirectoryPtr directory);
144
146 static MapStringString readCurrentUserData(DirectoryPtr directory);
147
149 static void setInfoStream(InfoStreamPtr infoStream);
150
153 static void setDefaultGenFileRetryCount(int32_t count);
154
156 static int32_t getDefaultGenFileRetryCount();
157
159 static void setDefaultGenFileRetryPauseMsec(int32_t msec);
160
162 static int32_t getDefaultGenFileRetryPauseMsec();
163
166 static void setDefaultGenLookaheadCount(int32_t count);
167
169 static int32_t getDefaultGenLookahedCount();
170
172 static InfoStreamPtr getInfoStream();
173
174 static void message(const String& message);
175
176 protected:
177 void write(DirectoryPtr directory);
178
179 friend class FindSegmentsFile;
180 };
181 }
182
183 #endif

clucene.sourceforge.net