00001 /* quartz_record.h: Records in quartz databases 00002 * 00003 * ----START-LICENCE---- 00004 * Copyright 1999,2000,2001 BrightStation PLC 00005 * Copyright 2002 Ananova Ltd 00006 * Copyright 2002,2003,2004 Olly Betts 00007 * 00008 * This program is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU General Public License as 00010 * published by the Free Software Foundation; either version 2 of the 00011 * License, or (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 * USA 00022 * -----END-LICENCE----- 00023 */ 00024 00025 #ifndef OM_HGUARD_QUARTZ_RECORD_H 00026 #define OM_HGUARD_QUARTZ_RECORD_H 00027 00028 #include <string> 00029 00030 #include <xapian/types.h> 00031 #include "quartz_types.h" 00032 #include "btree.h" 00033 00034 using namespace std; 00035 00038 class QuartzRecordTable : public Btree { 00039 public: 00054 QuartzRecordTable(string path_, bool readonly_) 00055 : Btree(path_ + "/record_", readonly_) { } 00056 00059 string get_record(Xapian::docid did) const; 00060 00063 Xapian::doccount get_doccount() const; 00064 00067 quartz_totlen_t get_total_length() const; 00068 00071 Xapian::docid get_lastdocid() const; 00072 00075 void set_total_length_and_lastdocid(quartz_totlen_t totlen, 00076 Xapian::docid did); 00077 00078 /* Add a new record to the table, or replace an existing record. 00079 * 00080 * @param did The document ID to use. 00081 */ 00082 void replace_record(const string & data, Xapian::docid did); 00083 00086 void delete_record(Xapian::docid did); 00087 }; 00088 00089 #endif /* OM_HGUARD_QUARTZ_RECORD_H */