xapian-core  2.0.0
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,2024 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, see
21  * <https://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef XAPIAN_INCLUDED_GLASS_CHECK_H
25 #define XAPIAN_INCLUDED_GLASS_CHECK_H
26 
27 #include "glass_table.h"
28 
29 #include <iosfwd>
30 #include <string_view>
31 
32 class GlassVersion;
33 
34 class GlassTableCheck : public GlassTable {
35  public:
36  static GlassTableCheck* check(const char* tablename,
37  std::string_view path,
38  int fd,
39  off_t offset_,
40  const GlassVersion& version_file,
41  int opts,
42  std::ostream* out);
43 
44  private:
45  GlassTableCheck(const char* tablename_, std::string_view 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 #ifdef DISABLE_GPL_LIBXAPIAN
69 # error GPL source we cannot relicense included in libxapian
70 #endif
71 
72 #endif /* XAPIAN_INCLUDED_GLASS_CHECK_H */
static GlassTableCheck * check(const char *tablename, std::string_view path, int fd, off_t offset_, const GlassVersion &version_file, int opts, std::ostream *out)
Definition: glass_check.cc:263
void print_bytes(int n, const uint8_t *p) const
Definition: glass_check.cc:45
GlassTableCheck(const char *tablename_, int fd, off_t offset_, bool readonly_, std::ostream *out_)
Definition: glass_check.h:49
void print_tag(const uint8_t *p, int c, int j) const
Definition: glass_check.cc:76
void report_cursor(int N, const Glass::Cursor *C_) const
Definition: glass_check.cc:362
GlassTableCheck(const char *tablename_, std::string_view path_, bool readonly_, std::ostream *out_)
Definition: glass_check.h:45
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
int block_usage(const uint8_t *p) const
Definition: glass_check.cc:109
void block_check(Glass::Cursor *C_, int j, int opts, GlassFreeListChecker &flcheck)
Definition: glass_check.cc:156
void print_spaces(int n) const
Definition: glass_check.cc:40
void print_key(const uint8_t *p, int c, int j) const
Definition: glass_check.cc:50
void report_block_full(int m, int n, const uint8_t *p) const
Definition: glass_check.cc:91
std::ostream * out
Definition: glass_check.h:65
Class managing a Btree table in a Glass database.
Definition: glass_table.h:432
const char * tablename
The name of the table (used when writing changesets).
Definition: glass_table.h:769
The GlassVersion class manages the revision files.
Definition: glass_version.h:96
PositionList * p
Btree implementation.
static const char * opts