|
xapian-core
1.4.29
|
#include <chert_check.h>
Inheritance diagram for ChertTableCheck:
Collaboration diagram for ChertTableCheck:Static Public Member Functions | |
| static void | check (const char *tablename, const std::string &path, chert_revision_number_t *rev_ptr, int opts, std::ostream *out) |
Static Public Member Functions inherited from ChertTable | |
| static void | throw_database_closed () |
| Throw an exception indicating that the database is closed. More... | |
Private Member Functions | |
| ChertTableCheck (const char *tablename_, const std::string &path_, bool readonly, std::ostream *out_) | |
| void | block_check (Cursor *C_, int j, int opts) |
| int | block_usage (const uint8_t *p) const |
| 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. More... | |
| void | report_block_full (int m, int n, const uint8_t *p) const |
| void | report_cursor (int N, const Cursor *C_) const |
| void | failure (const char *msg) const |
| void | print_key (const uint8_t *p, int c, int j) const |
| void | print_tag (const uint8_t *p, int c, int j) const |
| void | print_spaces (int n) const |
| void | print_bytes (int n, const uint8_t *p) const |
Private Attributes | |
| std::ostream * | out |
| chert_tablesize_t | check_item_count |
| bool | check_sequential |
| uint4 | last_sequential_block |
Additional Inherited Members | |
Public Member Functions inherited from ChertTable | |
| ChertTable (const char *tablename_, const std::string &path_, bool readonly_, int compress_strategy_=DONT_COMPRESS, bool lazy=false) | |
| Create a new Btree object. More... | |
| ~ChertTable () | |
| Close the Btree. More... | |
| void | close (bool permanent=false) |
| Close the Btree. More... | |
| bool | readahead_key (const string &key) const |
| bool | exists () const |
| Determine whether the btree exists on disk. More... | |
| void | open () |
| Open the btree at the latest revision. More... | |
| bool | open (chert_revision_number_t revision_) |
| Open the btree at a given revision. More... | |
| bool | is_open () const |
| Return true if this table is open. More... | |
| void | flush_db () |
| Flush any outstanding changes to the DB file of the table. More... | |
| void | commit (chert_revision_number_t revision, int changes_fd=-1, const std::string *changes_tail=NULL) |
| Commit any outstanding changes to the table. More... | |
| void | write_changed_blocks (int changes_fd) |
| Append the list of blocks changed to a changeset file. More... | |
| void | cancel () |
| Cancel any outstanding changes. More... | |
| bool | get_exact_entry (const std::string &key, std::string &tag) const |
| Read an entry from the table, if and only if it is exactly that being asked for. More... | |
| bool | key_exists (const std::string &key) const |
| Check if a key exists in the Btree. More... | |
| bool | read_tag (Cursor *C_, std::string *tag, bool keep_compressed) const |
| Read the tag value for the key pointed to by cursor C_. More... | |
| void | add (const std::string &key, std::string tag, bool already_compressed=false) |
| Add a key/tag pair to the table, replacing any existing pair with the same key. More... | |
| bool | del (const std::string &key) |
| Delete an entry from the table. More... | |
| void | erase () |
| Erase this table from disk. More... | |
| void | set_block_size (unsigned int block_size_) |
| Set the block size. More... | |
| unsigned int | get_block_size () const |
| Get the block size. More... | |
| void | create_and_open (unsigned int blocksize) |
| Create a new empty btree structure on disk and open it at the initial revision. More... | |
| void | set_full_compaction (bool parity) |
| chert_revision_number_t | get_latest_revision_number () const |
| Get the latest revision number stored in this table. More... | |
| chert_revision_number_t | get_open_revision_number () const |
| Get the revision number at which this table is currently open. More... | |
| chert_tablesize_t | get_entry_count () const |
| Return a count of the number of entries in the table. More... | |
| bool | empty () const |
| Return true if there are no entries in the table. More... | |
| ChertCursor * | cursor_get () const |
| Get a cursor for reading from the table. More... | |
| bool | is_modified () const |
| Determine whether the object contains uncommitted modifications. More... | |
| void | set_max_item_size (size_t block_capacity) |
| Set the maximum item size given the block capacity. More... | |
| string | get_path () const |
Protected Member Functions inherited from ChertTable | |
| bool | do_open_to_read (bool revision_supplied, chert_revision_number_t revision_) |
| Perform the opening operation to read. More... | |
| bool | do_open_to_write (bool revision_supplied, chert_revision_number_t revision_, bool create_db=false) |
| Perform the opening operation to write. More... | |
| bool | basic_open (bool revision_supplied, chert_revision_number_t revision) |
| bool | find (Cursor *) const |
| find(C_) searches for the key of B->kt in the B-tree. More... | |
| int | delete_kt () |
| void | read_block (uint4 n, uint8_t *p) const |
| read_block(n, p) reads block n of the DB file to address p. More... | |
| void | write_block (uint4 n, const uint8_t *p) const |
| write_block(n, p) writes block n in the DB file from address p. More... | |
| void | set_overwritten () const |
| void | block_to_cursor (Cursor *C_, int j, uint4 n) const |
| void | alter () |
| Btree::alter(); is called when the B-tree is to be altered. More... | |
| void | compact (uint8_t *p) |
| compact(p) compact the block at p by shuffling all the items up to the end. More... | |
| void | enter_key (int j, Key prevkey, Key newkey) |
| enter_key(j, prevkey, newkey) is called after a block split. More... | |
| int | mid_point (uint8_t *p) const |
| mid_point(p) finds the directory entry in c that determines the approximate mid point of the data in the block at p. More... | |
| void | add_item_to_block (uint8_t *p, Item_wr kt, int c) |
| add_item_to_block(p, kt_, c) adds item kt_ to the block at p. More... | |
| void | add_item (Item_wr kt, int j) |
| ChertTable::add_item(kt_, j) adds item kt_ to the block at cursor level C[j]. More... | |
| void | delete_item (int j, bool repeatedly) |
| ChertTable::delete_item(j, repeatedly) is (almost) the converse of add_item. More... | |
| int | add_kt (bool found) |
| add_kt(found) adds the item (key-tag pair) at B->kt into the B-tree, using cursor C. More... | |
| void | read_root () |
| void | split_root (uint4 split_n) |
| Btree needs to gain a new level to insert more items: so split root block and construct a new one. More... | |
| void | form_key (const std::string &key) const |
| char | other_base_letter () const |
| void | lazy_alloc_deflate_zstream () const |
| Allocate the zstream for deflating, if not already allocated. More... | |
| void | lazy_alloc_inflate_zstream () const |
| Allocate the zstream for inflating, if not already allocated. More... | |
| bool | prev (Cursor *C_, int j) const |
| bool | next (Cursor *C_, int j) const |
| bool | prev_default (Cursor *C_, int j) const |
| bool | next_default (Cursor *C_, int j) const |
| bool | prev_for_sequential (Cursor *C_, int dummy) const |
| bool | next_for_sequential (Cursor *C_, int dummy) const |
Static Protected Member Functions inherited from ChertTable | |
| static int | find_in_block (const uint8_t *p, Key key, bool leaf, int c) |
| find_in_block(p, key, leaf, c) searches for the key in the block at p. More... | |
| static uint4 | block_given_by (const uint8_t *p, int c) |
| block_given_by(p, c) finds the item at block address p, directory offset c, and returns its tag value as an integer. More... | |
Protected Attributes inherited from ChertTable | |
| const char * | tablename |
| The name of the table (used when writing changesets). More... | |
| chert_revision_number_t | revision_number |
| revision number of the opened B-tree. More... | |
| chert_tablesize_t | item_count |
| keeps a count of the number of items in the B-tree. More... | |
| unsigned int | block_size |
| block size of the B tree in bytes More... | |
| chert_revision_number_t | latest_revision_number |
| Revision number of the other base, or zero if there is only one base file. More... | |
| bool | both_bases |
| set to true if baseA and baseB both exist as valid bases. More... | |
| char | base_letter |
| the value 'A' or 'B' of the current base More... | |
| bool | faked_root_block |
| true if the root block is faked (not written to disk). More... | |
| bool | sequential |
| true iff the data has been written in a single write in sequential order. More... | |
| int | handle |
| File descriptor of the table. More... | |
| int | level |
| number of levels, counting from 0 More... | |
| uint4 | root |
| the root block of the B-tree More... | |
| Item_wr | kt |
| buffer of size block_size for making up key-tag items More... | |
| uint8_t * | buffer |
| buffer of size block_size for reforming blocks More... | |
| ChertTable_base | base |
| For writing back as file baseA or baseB. More... | |
| std::string | name |
| The path name of the B tree. More... | |
| int | seq_count |
| count of the number of successive instances of purely sequential addition, starting at SEQ_START_POINT (neg) and going up to zero. More... | |
| uint4 | changed_n |
| the last block to be changed by an addition More... | |
| int | changed_c |
| directory offset corresponding to last block to be changed by an addition More... | |
| size_t | max_item_size |
| maximum size of an item (key-tag pair) More... | |
| bool | Btree_modified |
| Set to true the first time the B-tree is modified. More... | |
| bool | full_compaction |
| set to true when full compaction is to be achieved More... | |
| bool | writable |
| Set to true when the database is opened to write. More... | |
| bool | cursor_created_since_last_modification |
| Flag for tracking when cursors need to rebuild. More... | |
| unsigned long | cursor_version |
| Version count for tracking when cursors need to rebuild. More... | |
| Cursor | C [BTREE_CURSOR_LEVELS] |
| uint8_t * | split_p |
| Buffer used when splitting a block. More... | |
| int | compress_strategy |
| DONT_COMPRESS or Z_DEFAULT_STRATEGY, Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE. More... | |
| z_stream * | deflate_zstream |
| Zlib state object for deflating. More... | |
| z_stream * | inflate_zstream |
| Zlib state object for inflating. More... | |
| bool | lazy |
| If true, don't create the table until it's needed. More... | |
| uint4 | last_readahead |
| Last block readahead_key() preread. More... | |
Definition at line 34 of file chert_check.h.
|
inlineprivate |
Definition at line 40 of file chert_check.h.
References block_check(), block_usage(), failure(), print_bytes(), print_key(), print_spaces(), print_tag(), report_block(), report_block_full(), and report_cursor().
|
private |
Definition at line 132 of file chert_check.cc.
References Cursor::c, Item_base< T >::component_of(), D2, Xapian::DBCHECK_FIX, Xapian::DBCHECK_FULL_TREE, Xapian::DBCHECK_SHORT_TREE, DIR_END(), DIR_START, failure(), Item_base< T >::get_address(), GET_LEVEL(), Item_base< T >::key(), MAX_FREE(), Cursor::n, Cursor::p, REVISION(), Item_base< T >::size(), and TOTAL_FREE().
Referenced by check(), and ChertTableCheck().
|
private |
Definition at line 95 of file chert_check.cc.
References DIR_END(), and TOTAL_FREE().
Referenced by ChertTableCheck().
|
static |
Definition at line 235 of file chert_check.cc.
References ChertTable::base, ChertTable::base_letter, block_check(), ChertTable_base::block_free_at_start(), ChertTable::block_size, C, ChertTable::C, ChertTable_base::calculate_last_block(), check_item_count, check_sequential, ChertTable_base::clear_bit_map(), close(), D2, Xapian::DBCHECK_FIX, Xapian::DBCHECK_SHOW_FREELIST, Xapian::DBCHECK_SHOW_STATS, DIR_END(), DIR_START, failure(), ChertTable::faked_root_block, file_size(), ChertTable_base::get_bit_map_size(), ChertTable::get_entry_count(), ChertTable_base::get_last_block(), GET_LEVEL(), ChertTable::get_open_revision_number(), io_read(), ChertTable::item_count, ChertTable::level, ChertTable_base::mark_block(), Cursor::n, O_BINARY, O_CLOEXEC, Xapian::InMemory::open(), ChertTable::open(), Xapian::revision(), REVISION(), ChertTable::revision_number, ChertTable::sequential, ChertTable_base::set_block_size(), ChertTable_base::set_have_fakeroot(), ChertTable_base::set_item_count(), ChertTable_base::set_level(), ChertTable_base::set_revision(), ChertTable_base::set_root(), ChertTable_base::set_sequential(), Item_base< T >::size(), Xapian::Internal::str(), TOTAL_FREE(), and ChertTable_base::write_to_file().
Referenced by check_chert_table().
|
private |
Definition at line 126 of file chert_check.cc.
Referenced by check(), and ChertTableCheck().
|
private |
Definition at line 44 of file chert_check.cc.
Referenced by ChertTableCheck().
|
private |
Definition at line 49 of file chert_check.cc.
References Item_base< T >::component_of(), description_append(), Item_base< T >::key(), Key::length(), and Key::read().
Referenced by ChertTableCheck().
|
private |
Definition at line 39 of file chert_check.cc.
Referenced by ChertTableCheck().
|
private |
Definition at line 63 of file chert_check.cc.
References Item_base< T >::append_chunk(), Item_base< T >::block_given_by(), Item_base< T >::components_of(), and description_append().
Referenced by ChertTableCheck().
|
private |
ChertTableCheck::report_block(m, n, p) prints the block at p, block number n, indented by m spaces.
Definition at line 105 of file chert_check.cc.
References D2, DIR_END(), DIR_START, GET_LEVEL(), and REVISION().
Referenced by ChertTableCheck().
|
private |
Definition at line 77 of file chert_check.cc.
References D2, DIR_END(), DIR_START, GET_LEVEL(), and REVISION().
Referenced by ChertTableCheck().
|
private |
Definition at line 485 of file chert_check.cc.
Referenced by ChertTableCheck().
|
private |
Definition at line 60 of file chert_check.h.
Referenced by check().
|
private |
Definition at line 62 of file chert_check.h.
Referenced by check().
|
private |
Definition at line 64 of file chert_check.h.
|
private |
Definition at line 58 of file chert_check.h.