Branch data Line data Source code
1 : : /* brass_record.h: Records in brass databases
2 : : *
3 : : * Copyright 1999,2000,2001 BrightStation PLC
4 : : * Copyright 2002 Ananova Ltd
5 : : * Copyright 2002,2003,2004,2005,2007,2008,2009 Olly Betts
6 : : *
7 : : * This program is free software; you can redistribute it and/or
8 : : * modify it under the terms of the GNU General Public License as
9 : : * published by the Free Software Foundation; either version 2 of the
10 : : * License, or (at your option) any later version.
11 : : *
12 : : * This program is distributed in the hope that it will be useful,
13 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : : * GNU General Public License for more details.
16 : : *
17 : : * You should have received a copy of the GNU General Public License
18 : : * along with this program; if not, write to the Free Software
19 : : * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 : : * USA
21 : : */
22 : :
23 : : #ifndef OM_HGUARD_BRASS_RECORD_H
24 : : #define OM_HGUARD_BRASS_RECORD_H
25 : :
26 : : #include <string>
27 : :
28 : : #include <xapian/types.h>
29 : : #include "brass_types.h"
30 : : #include "brass_table.h"
31 : :
32 : : using namespace std;
33 : :
34 : : /** A record in a brass database.
35 : : */
36 : 2236 : class BrassRecordTable : public BrassTable {
37 : : public:
38 : : /** Create a new table object.
39 : : *
40 : : * This does not create the table on disk - the create() method must
41 : : * be called before the table is created on disk
42 : : *
43 : : * This also does not open the table - the open() method must be
44 : : * called before use is made of the table.
45 : : *
46 : : * @param path_ - Path at which the table is stored.
47 : : * @param readonly_ - whether to open the table for read only
48 : : * access.
49 : : */
50 : 2236 : BrassRecordTable(const string & path_, bool readonly_)
51 : 2236 : : BrassTable("record", path_ + "/record.", readonly_, Z_DEFAULT_STRATEGY) { }
52 : :
53 : : /** Retrieve a document from the table.
54 : : */
55 : : string get_record(Xapian::docid did) const;
56 : :
57 : : /** Get the number of records in the table.
58 : : */
59 : : Xapian::doccount get_doccount() const;
60 : :
61 : : /* Add a new record to the table, or replace an existing record.
62 : : *
63 : : * @param did The document ID to use.
64 : : */
65 : : void replace_record(const string & data, Xapian::docid did);
66 : :
67 : : /** Delete a record from the table.
68 : : */
69 : : void delete_record(Xapian::docid did);
70 : : };
71 : :
72 : : #endif /* OM_HGUARD_BRASS_RECORD_H */
|