Logo Search packages:      
Sourcecode: xapian-core version File versions  Download package

Btree Class Reference

#include <btree.h>

Inheritance diagram for Btree:


List of all members.

Detailed Description

Class managing a Btree table in a Quartz database.

A table is a store holding a set of key/tag pairs.

A key is used to access a block of data in a quartz table.

Keys are of limited length.

Keys may not be empty (each Btree has a special empty key for internal use).

A tag is a piece of data associated with a given key. The contents of the tag are opaque to the Btree.

Tags may be of arbitrary length (the Btree imposes a very large limit). Note though that they will be loaded into memory in their entirety, so should not be permitted to grow without bound in normal usage.

Tags which are null strings _are_ valid, and are different from a tag simply not being in the table.

Definition at line 308 of file btree.h.

Public Member Functions

bool add (const string &key, string tag)
 Btree (string path_, bool readonly_)
void cancel ()
void close ()
void commit (quartz_revision_number_t revision)
void create (unsigned int blocksize)
Bcursorcursor_get () const
bool del (const string &key)
bool exists () const
bool find_tag (const string &key, string *tag) const
quartz_tablesize_t get_entry_count () const
bool get_exact_entry (const string &key, string &tag) const
quartz_revision_number_t get_latest_revision_number () const
quartz_revision_number_t get_open_revision_number () const
bool is_modified () const
bool open (quartz_revision_number_t revision_)
void open ()
void read_tag (Cursor *C_, string *tag) const
void set_full_compaction (bool parity)
void set_max_item_size (size_t block_capacity)
 ~Btree ()

Protected Member Functions

void add_item (Item_wr kt, int j)
void add_item_to_block (byte *p, Item_wr kt, int c)
int add_kt (bool found)
void alter ()
bool basic_open (bool revision_supplied, quartz_revision_number_t revision)
void block_to_cursor (Cursor *C_, int j, uint4 n) const
void compact (byte *p)
void delete_item (int j, bool repeatedly)
int delete_kt ()
void do_open_to_read (bool revision_supplied, quartz_revision_number_t revision_)
bool do_open_to_write (bool revision_supplied, quartz_revision_number_t revision_)
void enter_key (int j, Key prevkey, Key newkey)
bool find (Cursor *) const
void form_key (const string &key) const
int mid_point (byte *p)
bool next (Cursor *C_, int j) const
bool next_default (Cursor *C_, int j) const
bool next_for_sequential (Cursor *C_, int dummy) const
bool prev (Cursor *C_, int j) const
bool prev_default (Cursor *C_, int j) const
bool prev_for_sequential (Cursor *C_, int dummy) const
void read_block (uint4 n, byte *p) const
 read_block(n, p) reads block n of the DB file to address p.
void read_root ()
void set_overwritten () const
void split_root (uint4 split_n)
void write_block (uint4 n, const byte *p) const

Static Protected Member Functions

static uint4 block_given_by (const byte *p, int c)
static int find_in_block (const byte *p, Key key, bool leaf, int c)

Protected Attributes

Btree_base base
 For writing back as file baseA or baseB.
int base_letter
unsigned int block_size
bool both_bases
bool Btree_modified
 Set to true the first time the B-tree is modified.
byte * buffer
 buffer of size block_size for reforming blocks
int changed_c
uint4 changed_n
bool dont_close_handle
 Set to true if we shouldn't close handle ourselves.
bool faked_root_block
bool full_compaction
 set to true when full compaction is to be achieved
int handle
 corresponding file handle
uint4 item_count
Item_wr kt
 buffer of size block_size for making up key-tag items
quartz_revision_number_t latest_revision_number
int level
 number of levels, counting from 0
size_t max_item_size
 maximum size of an item (key-tag pair)
string name
 The path name of the B tree.
bool(Btree::* next_ptr )(Cursor *, int) const
char other_base_letter
 The base letter ('B' or 'A') of the next base.
bool(Btree::* prev_ptr )(Cursor *, int) const
quartz_revision_number_t revision_number
uint4 root
 the root block of the B-tree
int seq_count
bool sequential
byte * split_p
bool writable
 Set to true when the database is opened to write.

Private Member Functions

 Btree (const Btree &)
 Copying not allowed.
Btreeoperator= (const Btree &)
 Assignment not allowed.


class Bcursor

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

Generated by  Doxygen 1.6.0   Back to index