root / tags / 1.0.8 / xapian-core / backends / flint / flint_version.h

Revision 9426, 1.6 kB (checked in by olly, 15 months ago)

backends/flint/flint_database.cc,backends/flint/flint_version.cc,
backends/flint/flint_version.h: Don't try to upgrade a flint
database if we're only reading it, or it's already the latest
version.

Line 
1/** @file flint_version.h
2 * @brief FlintVersion class
3 */
4/* Copyright (C) 2006,2007 Olly Betts
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19 */
20
21#ifndef OM_HGUARD_FLINT_VERSION_H
22#define OM_HGUARD_FLINT_VERSION_H
23
24#include <string>
25
26/** The FlintVersion class manages the "iamflint" file.
27 *
28 *  The "iamflint" file (currently) contains a "magic" string identifying
29 *  that this is a flint database and a database format version number.
30 */
31class FlintVersion {
32    std::string filename;
33
34  public:
35    FlintVersion(const std::string & dbdir) : filename(dbdir) {
36        filename += "/iamflint";
37    }
38
39    /** Create the version file. */
40    void create();
41
42    /** Read the version file and check it's a version we understand.
43     *
44     *  @param readonly    true if the database is being opened readonly.
45     *
46     *  On failure, an exception is thrown.
47     */
48    void read_and_check(bool readonly);
49};
50
51#endif
Note: See TracBrowser for help on using the browser.