xapian-core  1.4.25
Classes | Macros | Functions | Variables
chert_table.h File Reference

Btree implementation. More...

#include <xapian/error.h>
#include "chert_types.h"
#include "chert_btreebase.h"
#include "chert_cursor.h"
#include "noreturn.h"
#include "omassert.h"
#include "str.h"
#include "stringutils.h"
#include "wordaccess.h"
#include <algorithm>
#include <string>
#include <zlib.h>
+ Include dependency graph for chert_table.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Key
 
class  Item_base< T >
 
class  Item
 
class  Item_wr
 
class  ChertTable
 Class managing a Btree table in a Chert database. More...
 

Macros

#define CHERT_BTREE_MAX_KEY_LEN   252
 The largest possible value of a key_len. More...
 

Functions

int getint1 (const unsigned char *p, int c)
 
void setint1 (unsigned char *p, int c, int x)
 
int getint2 (const unsigned char *p, int c)
 
void setint2 (unsigned char *p, int c, int x)
 
int getint4 (const unsigned char *p, int c)
 
void setint4 (unsigned char *p, int c, int x)
 
int getK (const unsigned char *p, int c)
 
void setD (unsigned char *p, int c, int x)
 
unsigned REVISION (const uint8_t *b)
 
int GET_LEVEL (const uint8_t *b)
 
int MAX_FREE (const uint8_t *b)
 
int TOTAL_FREE (const uint8_t *b)
 
int DIR_END (const uint8_t *b)
 
void SET_REVISION (uint8_t *b, uint4 rev)
 
void SET_LEVEL (uint8_t *b, int x)
 
void SET_MAX_FREE (uint8_t *b, int x)
 
void SET_TOTAL_FREE (uint8_t *b, int x)
 
void SET_DIR_END (uint8_t *b, int x)
 

Variables

const int DONT_COMPRESS = -1
 
const size_t BLOCK_CAPACITY = 4
 Even for items of at maximum size, it must be possible to get this number of items in a block. More...
 
const int BYTES_PER_BLOCK_NUMBER = 4
 
const int K1 = 1
 
const int I2 = 2
 
const int D2 = 2
 
const int C2 = 2
 
const int DIR_START = 11
 
const size_t CHERT_MAX_ITEM_SIZE = 0x7fff
 
const int BTREE_CURSOR_LEVELS = 10
 

Detailed Description

Btree implementation.

Definition in file chert_table.h.

Macro Definition Documentation

◆ CHERT_BTREE_MAX_KEY_LEN

#define CHERT_BTREE_MAX_KEY_LEN   252

The largest possible value of a key_len.

This gives the upper limit of the size of a key that may be stored in the B-tree (252 bytes with the present implementation).

Definition at line 101 of file chert_table.h.

Referenced by ChertTable::del(), ChertCursor::find_entry(), ChertCursor::find_entry_ge(), Item_wr::form_key(), ChertTable::get_exact_entry(), ChertTable::key_exists(), and ChertTable::readahead_key().

Function Documentation

◆ DIR_END()

int DIR_END ( const uint8_t *  b)
inline

◆ GET_LEVEL()

int GET_LEVEL ( const uint8_t *  b)
inline

◆ getint1()

int getint1 ( const unsigned char *  p,
int  c 
)
inline

Definition at line 47 of file chert_table.h.

References AssertRel.

Referenced by GET_LEVEL(), and getK().

◆ getint2()

int getint2 ( const unsigned char *  p,
int  c 
)
inline

◆ getint4()

int getint4 ( const unsigned char *  p,
int  c 
)
inline

Definition at line 79 of file chert_table.h.

References AssertRel, and unaligned_read4().

Referenced by Item_base< uint8_t *>::block_given_by(), and ChertTable::enter_key().

◆ getK()

int getK ( const unsigned char *  p,
int  c 
)
inline

◆ MAX_FREE()

int MAX_FREE ( const uint8_t *  b)
inline

◆ REVISION()

unsigned REVISION ( const uint8_t *  b)
inline

◆ SET_DIR_END()

void SET_DIR_END ( uint8_t *  b,
int  x 
)
inline

◆ SET_LEVEL()

void SET_LEVEL ( uint8_t *  b,
int  x 
)
inline

Definition at line 158 of file chert_table.h.

References setint1().

Referenced by ChertTable::read_root(), ChertTable::split_root(), and GlassFreeList::write_block().

◆ SET_MAX_FREE()

void SET_MAX_FREE ( uint8_t *  b,
int  x 
)
inline

◆ SET_REVISION()

void SET_REVISION ( uint8_t *  b,
uint4  rev 
)
inline

◆ SET_TOTAL_FREE()

void SET_TOTAL_FREE ( uint8_t *  b,
int  x 
)
inline

◆ setD()

void setD ( unsigned char *  p,
int  c,
int  x 
)
inline

◆ setint1()

void setint1 ( unsigned char *  p,
int  c,
int  x 
)
inline

Definition at line 55 of file chert_table.h.

References AssertRel.

Referenced by Item_wr::set_key_and_block(), Item_wr::set_key_len(), and SET_LEVEL().

◆ setint2()

void setint2 ( unsigned char *  p,
int  c,
int  x 
)
inline

◆ setint4()

void setint4 ( unsigned char *  p,
int  c,
int  x 
)
inline

◆ TOTAL_FREE()

int TOTAL_FREE ( const uint8_t *  b)
inline

Variable Documentation

◆ BLOCK_CAPACITY

const size_t BLOCK_CAPACITY = 4

Even for items of at maximum size, it must be possible to get this number of items in a block.

Definition at line 105 of file chert_table.h.

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

◆ BTREE_CURSOR_LEVELS

const int BTREE_CURSOR_LEVELS = 10

◆ BYTES_PER_BLOCK_NUMBER

const int BYTES_PER_BLOCK_NUMBER = 4

◆ C2

const int C2 = 2

◆ CHERT_MAX_ITEM_SIZE

const size_t CHERT_MAX_ITEM_SIZE = 0x7fff

◆ D2

const int D2 = 2

◆ DIR_START

const int DIR_START = 11

◆ DONT_COMPRESS

const int DONT_COMPRESS = -1

Definition at line 94 of file chert_table.h.

Referenced by ChertTable::add(), and ChertDatabase::compact().

◆ I2

const int I2 = 2

◆ K1

const int K1 = 1