xapian-core  1.4.27
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ChertTable_base Class Reference

#include <chert_btreebase.h>

Public Member Functions

 ChertTable_base ()
 Construct an object with all zero fields. More...
 
 ~ChertTable_base ()
 Destructor - frees resources. More...
 
bool read (const std::string &name, char ch, bool read_bitmap, std::string &err_msg)
 Read values from a base file. More...
 
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. More...
 
bool block_free_at_start (uint4 n) const
 true iff block n was free at the start of the transaction on the B-tree. More...
 
void free_block (uint4 n)
 
void mark_block (uint4 n)
 
uint4 next_free_block ()
 
bool find_changed_block (uint4 *n) const
 Find the first changed block at or after position *n. More...
 
bool block_free_now (uint4 n) const
 
void calculate_last_block ()
 
void clear_bit_map ()
 
void commit ()
 
void swap (ChertTable_base &other)
 

Private Member Functions

 ChertTable_base (const ChertTable_base &)
 No copying. More...
 
void operator= (const ChertTable_base &other)
 private assignment operator - you probably want swap() instead More...
 
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 More...
 
uint8_t * bit_map0
 the initial state of the bit map of blocks: 1 means in use, 0 means free More...
 
uint8_t * bit_map
 the current state of the bit map of blocks More...
 

Detailed Description

Definition at line 30 of file chert_btreebase.h.

Constructor & Destructor Documentation

◆ ChertTable_base() [1/2]

ChertTable_base::ChertTable_base ( )

Construct an object with all zero fields.

Definition at line 74 of file chert_btreebase.cc.

Referenced by set_sequential().

◆ ~ChertTable_base()

ChertTable_base::~ChertTable_base ( )

Destructor - frees resources.

Definition at line 107 of file chert_btreebase.cc.

References bit_map, and bit_map0.

◆ ChertTable_base() [2/2]

ChertTable_base::ChertTable_base ( const ChertTable_base )
private

No copying.

Member Function Documentation

◆ block_free_at_start()

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 338 of file chert_btreebase.cc.

References bit_map0.

Referenced by ChertTableCheck::check(), and set_sequential().

◆ block_free_now()

bool ChertTable_base::block_free_now ( uint4  n) const

Definition at line 469 of file chert_btreebase.cc.

References bit_map.

Referenced by set_sequential().

◆ calculate_last_block()

void ChertTable_base::calculate_last_block ( )

◆ clear_bit_map()

void ChertTable_base::clear_bit_map ( )

Definition at line 501 of file chert_btreebase.cc.

References bit_map, and bit_map_size.

Referenced by ChertTableCheck::check(), ChertTable::commit(), and set_sequential().

◆ commit()

void ChertTable_base::commit ( )

Definition at line 508 of file chert_btreebase.cc.

References bit_map, bit_map0, bit_map_low, and bit_map_size.

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

◆ extend_bit_map()

void ChertTable_base::extend_bit_map ( )
private

Definition at line 390 of file chert_btreebase.cc.

References bit_map, bit_map0, BIT_MAP_INC, and bit_map_size.

Referenced by mark_block(), next_free_block(), and set_sequential().

◆ find_changed_block()

bool ChertTable_base::find_changed_block ( uint4 n) const

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

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

Definition at line 451 of file chert_btreebase.cc.

References bit_map, bit_map0, and last_block.

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

◆ free_block()

void ChertTable_base::free_block ( uint4  n)

Definition at line 351 of file chert_btreebase.cc.

References bit_map, bit_map0, and bit_map_low.

Referenced by set_sequential().

◆ get_bit_map_size()

uint4 ChertTable_base::get_bit_map_size ( ) const
inline

Definition at line 56 of file chert_btreebase.h.

References bit_map_size.

Referenced by ChertTableCheck::check().

◆ get_block_size()

uint4 ChertTable_base::get_block_size ( ) const
inline

Definition at line 53 of file chert_btreebase.h.

References block_size.

Referenced by ChertTable::cancel().

◆ get_have_fakeroot()

bool ChertTable_base::get_have_fakeroot ( ) const
inline

Definition at line 59 of file chert_btreebase.h.

References have_fakeroot.

Referenced by ChertTable::cancel().

◆ get_item_count()

chert_tablesize_t ChertTable_base::get_item_count ( ) const
inline

Definition at line 57 of file chert_btreebase.h.

References item_count.

Referenced by ChertTable::cancel().

◆ get_last_block()

uint4 ChertTable_base::get_last_block ( ) const
inline

Definition at line 58 of file chert_btreebase.h.

References last_block.

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

◆ get_level()

uint4 ChertTable_base::get_level ( ) const
inline

Definition at line 55 of file chert_btreebase.h.

References level.

Referenced by ChertTable::cancel().

◆ get_revision()

uint4 ChertTable_base::get_revision ( ) const
inline

Definition at line 52 of file chert_btreebase.h.

References revision.

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

◆ get_root()

uint4 ChertTable_base::get_root ( ) const
inline

Definition at line 54 of file chert_btreebase.h.

References root.

Referenced by ChertTable::cancel().

◆ get_sequential()

bool ChertTable_base::get_sequential ( ) const
inline

Definition at line 60 of file chert_btreebase.h.

References sequential.

Referenced by ChertTable::cancel().

◆ mark_block()

void ChertTable_base::mark_block ( uint4  n)

Definition at line 368 of file chert_btreebase.cc.

References bit_map, bit_map_low, bit_map_size, and extend_bit_map().

Referenced by ChertTableCheck::check(), and set_sequential().

◆ next_free_block()

uint4 ChertTable_base::next_free_block ( )

Definition at line 428 of file chert_btreebase.cc.

References bit_map, bit_map0, bit_map_low, bit_map_size, extend_bit_map(), and last_block.

Referenced by set_sequential().

◆ operator=()

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

private assignment operator - you probably want swap() instead

Referenced by set_sequential().

◆ read()

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

Read values from a base file.

Parameters
nameThe base of the filename
chThe suffix
read_bitmapTrue if we should read the bitmap
err_msgAn 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 166 of file chert_btreebase.cc.

References bit_map, bit_map0, bit_map_size, block_size, CURR_FORMAT, DO_UNPACK_UINT_ERRCHECK, errno_to_string(), Xapian::Internal::format(), have_fakeroot, io_read(), item_count, last_block, level, O_CLOEXEC, posixy_open, REASONABLE_BASE_SIZE, revision, root, sequential, Xapian::Internal::str(), and unpack_uint().

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

◆ set_block_size()

void ChertTable_base::set_block_size ( uint4  block_size_)
inline

Definition at line 65 of file chert_btreebase.h.

References block_size.

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

◆ set_have_fakeroot()

void ChertTable_base::set_have_fakeroot ( bool  have_fakeroot_)
inline

◆ set_item_count()

void ChertTable_base::set_item_count ( chert_tablesize_t  item_count_)
inline

Definition at line 74 of file chert_btreebase.h.

References item_count.

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

◆ set_level()

void ChertTable_base::set_level ( uint4  level_)
inline

Definition at line 71 of file chert_btreebase.h.

References level.

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

◆ set_revision()

void ChertTable_base::set_revision ( uint4  revision_)
inline

Definition at line 62 of file chert_btreebase.h.

References revision.

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

◆ set_root()

void ChertTable_base::set_root ( uint4  root_)
inline

Definition at line 68 of file chert_btreebase.h.

References root.

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

◆ set_sequential()

void ChertTable_base::set_sequential ( bool  sequential_)
inline

◆ swap()

void ChertTable_base::swap ( ChertTable_base other)

◆ write_to_file()

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

◆ bit_map

uint8_t* ChertTable_base::bit_map
private

◆ bit_map0

uint8_t* ChertTable_base::bit_map0
private

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

Definition at line 147 of file chert_btreebase.h.

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

◆ bit_map_low

uint4 ChertTable_base::bit_map_low
private

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

Definition at line 143 of file chert_btreebase.h.

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

◆ bit_map_size

uint4 ChertTable_base::bit_map_size
private

◆ block_size

uint4 ChertTable_base::block_size
private

Definition at line 131 of file chert_btreebase.h.

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

◆ have_fakeroot

bool ChertTable_base::have_fakeroot
private

Definition at line 137 of file chert_btreebase.h.

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

◆ item_count

chert_tablesize_t ChertTable_base::item_count
private

Definition at line 135 of file chert_btreebase.h.

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

◆ last_block

uint4 ChertTable_base::last_block
private

◆ level

uint4 ChertTable_base::level
private

Definition at line 133 of file chert_btreebase.h.

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

◆ revision

uint4 ChertTable_base::revision
private

Definition at line 130 of file chert_btreebase.h.

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

◆ root

uint4 ChertTable_base::root
private

Definition at line 132 of file chert_btreebase.h.

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

◆ sequential

bool ChertTable_base::sequential
private

Definition at line 138 of file chert_btreebase.h.

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


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