00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef OM_HGUARD_FLINT_CHECK_H
00025 #define OM_HGUARD_FLINT_CHECK_H
00026
00027 #include "flint_table.h"
00028 #include "noreturn.h"
00029
00030 #include <iostream>
00031 #include <string>
00032
00033 class BtreeCheck : public FlintTable {
00034 public:
00035 static void check(const char * tablename, const std::string & path,
00036 int opts, std::ostream &out = std::cout);
00037 private:
00038 BtreeCheck(const char * tablename_, const std::string &path_,
00039 bool readonly, std::ostream &out_)
00040 : FlintTable(tablename_, path_, readonly), out(out_) { }
00041
00042 void block_check(Cursor_ * C_, int j, int opts);
00043 int block_usage(const byte * p) const;
00044 void report_block(int m, int n, const byte * p) const;
00045 void report_block_full(int m, int n, const byte * p) const;
00046 void report_cursor(int N, const Cursor_ *C_) const;
00047
00048 XAPIAN_NORETURN(void failure(int n) const);
00049 void print_key(const byte * p, int c, int j) const;
00050 void print_tag(const byte * p, int c, int j) const;
00051 void print_spaces(int n) const;
00052 void print_bytes(int n, const byte * p) const;
00053
00054 std::ostream &out;
00055 };
00056
00057 #define OPT_SHORT_TREE 1
00058 #define OPT_FULL_TREE 2
00059 #define OPT_SHOW_BITMAP 4
00060 #define OPT_SHOW_STATS 8
00061
00062 #endif