ChertTable_base Class Reference

#include <chert_btreebase.h>

List of all members.

Public Member Functions

 ChertTable_base ()
 Construct an object with all zero fields.
 ChertTable_base (const ChertTable_base &other)
 Copy constructor.
 ~ChertTable_base ()
 Destructor - frees resources.
bool read (const std::string &name, char ch, bool read_bitmap, std::string &err_msg)
 Read values from a base file.
uint4 get_revision () const
uint4 get_block_size () const
uint4 get_root () const
uint4 get_level () const
uint4 get_bit_map_size () const
chert_tablesize_t get_item_count () const
uint4 get_last_block () const
bool get_have_fakeroot () const
bool get_sequential () const
void set_revision (uint4 revision_)
void set_block_size (uint4 block_size_)
void set_root (uint4 root_)
void set_level (uint4 level_)
void set_item_count (chert_tablesize_t item_count_)
void set_have_fakeroot (bool have_fakeroot_)
void set_sequential (bool sequential_)
void write_to_file (const std::string &filename, char base_letter, const std::string &tablename, int changes_fd, const std::string *changes_tail)
 Write the btree base file to disk.
bool block_free_at_start (uint4 n) const
 true iff block n was free at the start of the transaction on the B-tree.
void free_block (uint4 n)
uint4 next_free_block ()
bool find_changed_block (uint4 *n)
 Find the first changed block at or after position *n.
bool block_free_now (uint4 n)
void calculate_last_block ()
void clear_bit_map ()
void commit ()
bool is_empty () const
void swap (ChertTable_base &other)

Private Member Functions

void operator= (const ChertTable_base &other)
 private assignment operator - you probably want swap() instead
void extend_bit_map ()

Private Attributes

uint4 revision
uint4 block_size
uint4 root
uint4 level
uint4 bit_map_size
chert_tablesize_t item_count
uint4 last_block
bool have_fakeroot
bool sequential
uint4 bit_map_low
 byte offset into the bit map below which there are no free blocks
bytebit_map0
 the initial state of the bit map of blocks: 1 means in use, 0 means free
bytebit_map
 the current state of the bit map of blocks


Detailed Description

Definition at line 31 of file chert_btreebase.h.


Constructor & Destructor Documentation

ChertTable_base::ChertTable_base (  ) 

Construct an object with all zero fields.

Definition at line 76 of file chert_btreebase.cc.

ChertTable_base::ChertTable_base ( const ChertTable_base other  ) 

Copy constructor.

Definition at line 92 of file chert_btreebase.cc.

References bit_map, bit_map0, and bit_map_size.

ChertTable_base::~ChertTable_base (  ) 

Destructor - frees resources.

Definition at line 135 of file chert_btreebase.cc.

References bit_map, and bit_map0.


Member Function Documentation

bool ChertTable_base::block_free_at_start ( uint4  n  )  const

true iff block n was free at the start of the transaction on the B-tree.

Definition at line 371 of file chert_btreebase.cc.

References bit_map0.

Referenced by ChertTable::alter(), ChertTableCheck::block_check(), ChertTableCheck::check(), and ChertTable::write_block().

bool ChertTable_base::block_free_now ( uint4  n  ) 

Definition at line 484 of file chert_btreebase.cc.

References bit_map.

Referenced by ChertTableCheck::block_check().

void ChertTable_base::calculate_last_block (  ) 

Definition at line 492 of file chert_btreebase.cc.

References bit_map, bit_map_size, and last_block.

Referenced by ChertTable::write_changed_blocks(), and write_to_file().

void ChertTable_base::clear_bit_map (  ) 

Definition at line 530 of file chert_btreebase.cc.

References bit_map, and bit_map_size.

Referenced by ChertTable::commit().

void ChertTable_base::commit (  ) 

Definition at line 537 of file chert_btreebase.cc.

References bit_map, bit_map0, bit_map_low, and bit_map_size.

Referenced by ChertTable::commit().

void ChertTable_base::extend_bit_map (  )  [private]

Definition at line 405 of file chert_btreebase.cc.

References bit_map, bit_map0, BIT_MAP_INC, and bit_map_size.

Referenced by next_free_block().

bool ChertTable_base::find_changed_block ( uint4 *  n  ) 

Find the first changed block at or after position *n.

Returns true if such a block was found, or false otherwise.

Definition at line 466 of file chert_btreebase.cc.

References bit_map, bit_map0, and last_block.

Referenced by ChertTable::write_changed_blocks().

void ChertTable_base::free_block ( uint4  n  ) 

uint4 ChertTable_base::get_bit_map_size (  )  const [inline]

uint4 ChertTable_base::get_block_size (  )  const [inline]

Definition at line 57 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

bool ChertTable_base::get_have_fakeroot (  )  const [inline]

Definition at line 63 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

chert_tablesize_t ChertTable_base::get_item_count (  )  const [inline]

Definition at line 61 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

uint4 ChertTable_base::get_last_block (  )  const [inline]

Definition at line 62 of file chert_btreebase.h.

Referenced by ChertTableCheck::check(), and ChertTable::next_for_sequential().

uint4 ChertTable_base::get_level (  )  const [inline]

Definition at line 59 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

uint4 ChertTable_base::get_revision (  )  const [inline]

Definition at line 56 of file chert_btreebase.h.

References Xapian::revision().

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

uint4 ChertTable_base::get_root (  )  const [inline]

Definition at line 58 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

bool ChertTable_base::get_sequential (  )  const [inline]

Definition at line 64 of file chert_btreebase.h.

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

bool ChertTable_base::is_empty (  )  const

Definition at line 519 of file chert_btreebase.cc.

References bit_map, and bit_map_size.

Referenced by ChertTableCheck::check().

uint4 ChertTable_base::next_free_block (  ) 

void ChertTable_base::operator= ( const ChertTable_base other  )  [private]

private assignment operator - you probably want swap() instead

bool ChertTable_base::read ( const std::string &  name,
char  ch,
bool  read_bitmap,
std::string &  err_msg 
)

Read values from a base file.

Parameters:
name The base of the filename
ch The suffix
read_bitmap True if we should read the bitmap
err_msg An error string which will be appended to for some errors instead of throwing an exception.
Returns:
true if the read succeeded, or false otherwise.

Definition at line 194 of file chert_btreebase.cc.

References bit_map, bit_map0, bit_map_size, block_size, CURR_FORMAT, DO_UNPACK_UINT_ERRCHECK, Xapian::Internal::format(), have_fakeroot, io_read(), item_count, last_block, level, msvc_posix_open(), O_BINARY, Xapian::InMemory::open(), REASONABLE_BASE_SIZE, revision, root, sequential, Xapian::Internal::str(), and unpack_uint().

Referenced by ChertTable::basic_open(), and ChertTable::cancel().

void ChertTable_base::set_block_size ( uint4  block_size_  )  [inline]

Definition at line 69 of file chert_btreebase.h.

Referenced by ChertTable::create_and_open().

void ChertTable_base::set_have_fakeroot ( bool  have_fakeroot_  )  [inline]

Definition at line 81 of file chert_btreebase.h.

Referenced by ChertTable::commit(), and ChertTable::create_and_open().

void ChertTable_base::set_item_count ( chert_tablesize_t  item_count_  )  [inline]

Definition at line 78 of file chert_btreebase.h.

Referenced by ChertTable::commit().

void ChertTable_base::set_level ( uint4  level_  )  [inline]

Definition at line 75 of file chert_btreebase.h.

Referenced by ChertTable::commit().

void ChertTable_base::set_revision ( uint4  revision_  )  [inline]

Definition at line 66 of file chert_btreebase.h.

References Xapian::revision().

Referenced by ChertTable::commit(), and ChertTable::create_and_open().

void ChertTable_base::set_root ( uint4  root_  )  [inline]

Definition at line 72 of file chert_btreebase.h.

Referenced by ChertTable::commit().

void ChertTable_base::set_sequential ( bool  sequential_  )  [inline]

Definition at line 84 of file chert_btreebase.h.

Referenced by ChertTable::commit(), and ChertTable::create_and_open().

void ChertTable_base::swap ( ChertTable_base other  ) 

void ChertTable_base::write_to_file ( const std::string &  filename,
char  base_letter,
const std::string &  tablename,
int  changes_fd,
const std::string *  changes_tail 
)


Member Data Documentation

the initial state of the bit map of blocks: 1 means in use, 0 means free

Definition at line 149 of file chert_btreebase.h.

Referenced by block_free_at_start(), ChertTable_base(), commit(), extend_bit_map(), find_changed_block(), free_block(), next_free_block(), read(), swap(), and ~ChertTable_base().

byte offset into the bit map below which there are no free blocks

Definition at line 145 of file chert_btreebase.h.

Referenced by commit(), free_block(), next_free_block(), and swap().

uint4 ChertTable_base::block_size [private]

Definition at line 133 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

Definition at line 139 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

Definition at line 137 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

uint4 ChertTable_base::last_block [private]

uint4 ChertTable_base::level [private]

Definition at line 135 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

uint4 ChertTable_base::revision [private]

Definition at line 132 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

uint4 ChertTable_base::root [private]

Definition at line 134 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().

Definition at line 140 of file chert_btreebase.h.

Referenced by read(), swap(), and write_to_file().


The documentation for this class was generated from the following files:

Documentation for Xapian (version 1.2.9).
Generated on 10 May 2012 by Doxygen 1.5.9.