xapian-core  1.4.27
glass_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,2009,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_GLASS_CHECK_H
26 #define OM_HGUARD_GLASS_CHECK_H
27 
28 #include "glass_table.h"
29 #include "noreturn.h"
30 
31 #include <iosfwd>
32 #include <string>
33 
34 class GlassVersion;
35 
36 class GlassTableCheck : public GlassTable {
37  public:
38  static GlassTableCheck * check(
39  const char * tablename, const std::string & path, int fd,
40  off_t offset_,
41  const GlassVersion & version_file,
42  int opts, std::ostream *out);
43 
44  private:
45  GlassTableCheck(const char * tablename_, const std::string &path_,
46  bool readonly_, std::ostream *out_)
47  : GlassTable(tablename_, path_, readonly_), out(out_) { }
48 
49  GlassTableCheck(const char * tablename_, int fd, off_t offset_,
50  bool readonly_, std::ostream *out_)
51  : GlassTable(tablename_, fd, offset_, readonly_), out(out_) { }
52 
53  void block_check(Glass::Cursor * C_, int j, int opts,
54  GlassFreeListChecker &flcheck);
55  int block_usage(const uint8_t * p) const;
56  void report_block(int m, int n, const uint8_t * p) const;
57  void report_block_full(int m, int n, const uint8_t * p) const;
58  void report_cursor(int N, const Glass::Cursor *C_) const;
59 
60  void print_key(const uint8_t * p, int c, int j) const;
61  void print_tag(const uint8_t * p, int c, int j) const;
62  void print_spaces(int n) const;
63  void print_bytes(int n, const uint8_t * p) const;
64 
65  std::ostream *out;
66 };
67 
68 #endif /* OM_HGUARD_GLASS_CHECK_H */
Define the XAPIAN_NORETURN macro.
Class managing a Btree table in a Glass database.
Definition: glass_table.h:425
The GlassVersion class manages the revision files.
Definition: glass_version.h:94
static const char * opts
void print_tag(const uint8_t *p, int c, int j) const
Definition: glass_check.cc:76
void report_block(int m, int n, const uint8_t *p) const
GlassTableCheck::report_block(m, n, p) prints the block at p, block number n, indented by m spaces...
Definition: glass_check.cc:119
std::ostream * out
Definition: glass_check.h:65
void print_bytes(int n, const uint8_t *p) const
Definition: glass_check.cc:45
const char * tablename
The name of the table (used when writing changesets).
Definition: glass_table.h:758
GlassTableCheck(const char *tablename_, int fd, off_t offset_, bool readonly_, std::ostream *out_)
Definition: glass_check.h:49
GlassTableCheck(const char *tablename_, const std::string &path_, bool readonly_, std::ostream *out_)
Definition: glass_check.h:45
void report_cursor(int N, const Glass::Cursor *C_) const
Definition: glass_check.cc:362
void report_block_full(int m, int n, const uint8_t *p) const
Definition: glass_check.cc:91
Btree implementation.
static GlassTableCheck * check(const char *tablename, const std::string &path, int fd, off_t offset_, const GlassVersion &version_file, int opts, std::ostream *out)
Definition: glass_check.cc:263
void block_check(Glass::Cursor *C_, int j, int opts, GlassFreeListChecker &flcheck)
Definition: glass_check.cc:156
int block_usage(const uint8_t *p) const
Definition: glass_check.cc:109
void print_key(const uint8_t *p, int c, int j) const
Definition: glass_check.cc:50
void print_spaces(int n) const
Definition: glass_check.cc:40