xapian-core  1.4.21
chert_check.h
Go to the documentation of this file.
1 
4 /* Copyright 1999,2000,2001 BrightStation PLC
5  * Copyright 2002 Ananova Ltd
6  * Copyright 2002,2004,2005,2006,2008,2011,2012,2013,2014 Olly Betts
7  * Copyright 2008 Lemur Consulting Ltd
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef OM_HGUARD_CHERT_CHECK_H
26 #define OM_HGUARD_CHERT_CHECK_H
27 
28 #include "chert_table.h"
29 #include "noreturn.h"
30 
31 #include <iosfwd>
32 #include <string>
33 
34 class ChertTableCheck : public ChertTable {
35  public:
36  static void check(const char * tablename, const std::string & path,
37  chert_revision_number_t * rev_ptr,
38  int opts, std::ostream *out);
39  private:
40  ChertTableCheck(const char * tablename_, const std::string &path_,
41  bool readonly, std::ostream *out_)
42  : ChertTable(tablename_, path_, readonly), out(out_),
45 
46  void block_check(Cursor * C_, int j, int opts);
47  int block_usage(const uint8_t * p) const;
48  void report_block(int m, int n, const uint8_t * p) const;
49  void report_block_full(int m, int n, const uint8_t * p) const;
50  void report_cursor(int N, const Cursor *C_) const;
51 
52  XAPIAN_NORETURN(void failure(const char * msg) const);
53  void print_key(const uint8_t * p, int c, int j) const;
54  void print_tag(const uint8_t * p, int c, int j) const;
55  void print_spaces(int n) const;
56  void print_bytes(int n, const uint8_t * p) const;
57 
58  std::ostream *out;
59 
61 
63 
65 };
66 
67 #endif /* OM_HGUARD_CHERT_CHECK_H */
Define the XAPIAN_NORETURN macro.
void report_cursor(int N, const Cursor *C_) const
Definition: chert_check.cc:485
chert_tablesize_t check_item_count
Definition: chert_check.h:60
#define true
Definition: header.h:8
std::ostream * out
Definition: chert_check.h:58
uint4 last_sequential_block
Definition: chert_check.h:64
int block_usage(const uint8_t *p) const
Definition: chert_check.cc:95
const char * tablename
The name of the table (used when writing changesets).
Definition: chert_table.h:716
static const char * opts
Class managing a Btree table in a Chert database.
Definition: chert_table.h:347
void block_check(Cursor *C_, int j, int opts)
Definition: chert_check.cc:132
void failure(const char *msg) const
Definition: chert_check.cc:126
unsigned int chert_revision_number_t
A type used to store a revision number for a table.
Definition: chert_types.h:40
bool check_sequential
Definition: chert_check.h:62
uint32_t uint4
Definition: internaltypes.h:32
unsigned long long chert_tablesize_t
A type used to store the number of entries in a table.
Definition: chert_types.h:46
void print_key(const uint8_t *p, int c, int j) const
Definition: chert_check.cc:49
ChertTableCheck(const char *tablename_, const std::string &path_, bool readonly, std::ostream *out_)
Definition: chert_check.h:40
void report_block(int m, int n, const uint8_t *p) const
ChertTableCheck::report_block(m, n, p) prints the block at p, block number n, indented by m spaces...
Definition: chert_check.cc:105
void print_bytes(int n, const uint8_t *p) const
Definition: chert_check.cc:44
Btree implementation.
void print_tag(const uint8_t *p, int c, int j) const
Definition: chert_check.cc:63
void report_block_full(int m, int n, const uint8_t *p) const
Definition: chert_check.cc:77
static void check(const char *tablename, const std::string &path, chert_revision_number_t *rev_ptr, int opts, std::ostream *out)
Definition: chert_check.cc:235
void print_spaces(int n) const
Definition: chert_check.cc:39