btree.h File Reference

#include <mpool.h>
#include "extern.h"

Include dependency graph for btree.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _binternal
struct  _bleaf
struct  _btmeta
struct  _btree
struct  _cursor
struct  _epg
struct  _epgno
struct  _page
struct  _rinternal
struct  _rleaf

Defines

#define B_DB_LOCK   0x04000
#define B_DB_SHMEM   0x08000
#define B_DB_TXN   0x10000
#define B_INMEM   0x00001
#define B_METADIRTY   0x00002
#define B_MODIFIED   0x00004
#define B_NEEDSWAP   0x00008
#define B_NODUPS   0x00020
#define B_RDONLY   0x00010
#define BT_CLR(t)   (t->bt_sp = t->bt_stack)
#define BT_POP(t)   (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)
#define BT_PUSH(t, p, i)
#define BTDATAOFF
#define CURS_ACQUIRE   0x01
#define CURS_AFTER   0x02
#define CURS_BEFORE   0x04
#define CURS_INIT   0x08
#define DEFMINKEYPAGE   (2)
#define F_CLR(p, f)   (p)->flags &= ~(f)
#define F_ISSET(p, f)   ((p)->flags & (f))
#define F_SET(p, f)   (p)->flags |= (f)
#define GETBINTERNAL(pg, indx)   ((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
#define GETBLEAF(pg, indx)   ((BLEAF *)((char *)(pg) + (pg)->linp[indx]))
#define GETRINTERNAL(pg, indx)   ((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
#define GETRLEAF(pg, indx)   ((RLEAF *)((char *)(pg) + (pg)->linp[indx]))
#define LALIGN(n)   (((n) + sizeof(pgno_t) - 1) & ~(sizeof(pgno_t) - 1))
#define MINCACHE   (5)
#define MINPSIZE   (512)
#define mpool_close   __mpool_close
#define mpool_filter   __mpool_filter
#define mpool_get   __mpool_get
#define mpool_new   __mpool_new
#define mpool_open   __mpool_open
#define mpool_put   __mpool_put
#define mpool_sync   __mpool_sync
#define NBINTERNAL(len)   LALIGN(sizeof(u_int32_t) + sizeof(pgno_t) + sizeof(u_char) + (len))
#define NBLEAF(p)   NBLEAFDBT((p)->ksize, (p)->dsize)
#define NBLEAFDBT(ksize, dsize)
#define NEXTINDEX(p)   (((p)->lower - BTDATAOFF) / sizeof(indx_t))
#define NOVFLSIZE   (sizeof(pgno_t) + sizeof(u_int32_t))
#define NRINTERNAL   LALIGN(sizeof(recno_t) + sizeof(pgno_t))
#define NRLEAF(p)   NRLEAFDBT((p)->dsize)
#define NRLEAFDBT(dsize)   LALIGN(sizeof(u_int32_t) + sizeof(u_char) + (dsize))
#define P_BIGDATA   0x01
#define P_BIGKEY   0x02
#define P_BINTERNAL   0x01
#define P_BLEAF   0x02
#define P_INVALID   0
#define P_META   0
#define P_OVERFLOW   0x04
#define P_PRESERVE   0x20
#define P_RINTERNAL   0x08
#define P_RLEAF   0x10
#define P_ROOT   1
#define P_TYPE   0x1f
#define R_CLOSEFP   0x00040
#define R_EOF   0x00100
#define R_FIXLEN   0x00200
#define R_INMEM   0x00800
#define R_MEMMAPPED   0x00400
#define R_MODIFIED   0x01000
#define R_RDONLY   0x02000
#define R_RECNO   0x00080
#define SAVEMETA   (B_NODUPS | R_RECNO)
#define WR_BINTERNAL(p, size, pgno, flags)
#define WR_BLEAF(p, key, data, flags)
#define WR_RINTERNAL(p, nrecs, pgno)
#define WR_RLEAF(p, data, flags)

Typedefs

typedef struct _binternal BINTERNAL
typedef struct _bleaf BLEAF
typedef struct _btmeta BTMETA
typedef struct _btree BTREE
typedef struct _cursor CURSOR
typedef struct _epg EPG
typedef struct _epgno EPGNO
typedef struct _page PAGE
typedef struct _rinternal RINTERNAL
typedef struct _rleaf RLEAF


Define Documentation

#define B_DB_LOCK   0x04000

Definition at line 385 of file btree.h.

Referenced by __bt_get(), __bt_open(), __bt_ret(), __bt_seq(), __rec_get(), __rec_ret(), and __rec_seq().

#define B_DB_SHMEM   0x08000

Definition at line 386 of file btree.h.

Referenced by __bt_open().

#define B_DB_TXN   0x10000

Definition at line 387 of file btree.h.

Referenced by __bt_open().

#define B_INMEM   0x00001

Definition at line 368 of file btree.h.

Referenced by __bt_fd(), __bt_open(), and __bt_sync().

#define B_METADIRTY   0x00002

Definition at line 369 of file btree.h.

Referenced by __bt_free(), __bt_new(), __bt_open(), and __bt_sync().

#define B_MODIFIED   0x00004

Definition at line 370 of file btree.h.

Referenced by __bt_delete(), __bt_put(), __bt_sync(), __rec_delete(), and __rec_iput().

#define B_NEEDSWAP   0x00008

Definition at line 371 of file btree.h.

Referenced by __bt_open(), __bt_pgin(), and __bt_pgout().

#define B_NODUPS   0x00020

Definition at line 374 of file btree.h.

Referenced by __bt_bdelete(), __bt_curdel(), __bt_first(), __bt_open(), __bt_put(), and __bt_search().

#define B_RDONLY   0x00010

Definition at line 372 of file btree.h.

Referenced by __bt_delete(), __bt_open(), __bt_put(), and __bt_sync().

#define BT_CLR (  )     (t->bt_sp = t->bt_stack)

Definition at line 328 of file btree.h.

Referenced by __bt_search(), and __rec_search().

#define BT_POP (  )     (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)

Definition at line 327 of file btree.h.

Referenced by __bt_pdelete(), __bt_split(), __bt_stkacq(), and __rec_search().

#define BT_PUSH ( t,
p,
 ) 

Value:

{                 \
   t->bt_sp->pgno = p;                 \
   t->bt_sp->index = i;                   \
   ++t->bt_sp;                   \
}

Definition at line 322 of file btree.h.

Referenced by __bt_search(), __bt_stkacq(), and __rec_search().

#define BTDATAOFF

Value:

(sizeof(pgno_t) + sizeof(pgno_t) + sizeof(pgno_t) +      \
       sizeof(u_int32_t) + sizeof(indx_t) + sizeof(indx_t))

Definition at line 95 of file btree.h.

Referenced by __bt_open(), __bt_pdelete(), __ovfl_delete(), __ovfl_get(), __ovfl_put(), bt_broot(), bt_page(), bt_psplit(), bt_root(), bt_rroot(), and nroot().

#define CURS_ACQUIRE   0x01

Definition at line 288 of file btree.h.

Referenced by __bt_curdel(), __bt_delete(), __bt_dleaf(), __bt_put(), __bt_seqadv(), and __bt_setcur().

#define CURS_AFTER   0x02

Definition at line 289 of file btree.h.

Referenced by __bt_curdel(), __bt_delete(), __bt_put(), __bt_seqadv(), and __bt_setcur().

#define CURS_BEFORE   0x04

Definition at line 290 of file btree.h.

Referenced by __bt_curdel(), __bt_delete(), __bt_put(), __bt_seqadv(), and __bt_setcur().

#define CURS_INIT   0x08

#define DEFMINKEYPAGE   (2)

Definition at line 54 of file btree.h.

Referenced by __bt_open().

#define F_CLR ( p,
f   )     (p)->flags &= ~(f)

Definition at line 41 of file btree.h.

Referenced by __bt_curdel(), __bt_open(), __bt_seqadv(), __bt_setcur(), __bt_sync(), __rec_open(), and __rec_sync().

#define F_ISSET ( p,
f   )     ((p)->flags & (f))

#define F_SET ( p,
f   )     (p)->flags |= (f)

#define GETBINTERNAL ( pg,
indx   )     ((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))

#define GETBLEAF ( pg,
indx   )     ((BLEAF *)((char *)(pg) + (pg)->linp[indx]))

#define GETRINTERNAL ( pg,
indx   )     ((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))

Definition at line 165 of file btree.h.

Referenced by __rec_search(), bt_psplit(), and rec_total().

#define GETRLEAF ( pg,
indx   )     ((RLEAF *)((char *)(pg) + (pg)->linp[indx]))

Definition at line 220 of file btree.h.

Referenced by __rec_dleaf(), __rec_ret(), and bt_psplit().

#define LALIGN (  )     (((n) + sizeof(pgno_t) - 1) & ~(sizeof(pgno_t) - 1))

Definition at line 116 of file btree.h.

#define MINCACHE   (5)

Definition at line 55 of file btree.h.

Referenced by __bt_open().

#define MINPSIZE   (512)

Definition at line 56 of file btree.h.

Referenced by __bt_open().

#define mpool_close   __mpool_close

Definition at line 52 of file btree.h.

Referenced by __bt_close().

#define mpool_filter   __mpool_filter

Definition at line 47 of file btree.h.

Referenced by __bt_open().

#define mpool_get   __mpool_get

#define mpool_new   __mpool_new

Definition at line 48 of file btree.h.

Referenced by __bt_new(), and nroot().

#define mpool_open   __mpool_open

Definition at line 46 of file btree.h.

Referenced by __bt_open().

#define mpool_put   __mpool_put

#define mpool_sync   __mpool_sync

Definition at line 51 of file btree.h.

Referenced by __bt_sync().

#define NBINTERNAL ( len   )     LALIGN(sizeof(u_int32_t) + sizeof(pgno_t) + sizeof(u_char) + (len))

Definition at line 142 of file btree.h.

Referenced by __bt_pdelete(), __bt_split(), bt_broot(), and bt_psplit().

#define NBLEAF (  )     NBLEAFDBT((p)->ksize, (p)->dsize)

Definition at line 192 of file btree.h.

Referenced by __bt_dleaf(), and bt_psplit().

#define NBLEAFDBT ( ksize,
dsize   ) 

Value:

LALIGN(sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_char) +   \
       (ksize) + (dsize))

Definition at line 195 of file btree.h.

Referenced by __bt_open(), __bt_put(), and bt_fast().

#define NEXTINDEX (  )     (((p)->lower - BTDATAOFF) / sizeof(indx_t))

#define NOVFLSIZE   (sizeof(pgno_t) + sizeof(u_int32_t))

Definition at line 117 of file btree.h.

Referenced by __bt_open(), __bt_put(), and __rec_iput().

#define NRINTERNAL   LALIGN(sizeof(recno_t) + sizeof(pgno_t))

Definition at line 169 of file btree.h.

Referenced by __bt_split(), bt_psplit(), and bt_rroot().

#define NRLEAF (  )     NRLEAFDBT((p)->dsize)

Definition at line 224 of file btree.h.

Referenced by __rec_dleaf(), and bt_psplit().

#define NRLEAFDBT ( dsize   )     LALIGN(sizeof(u_int32_t) + sizeof(u_char) + (dsize))

Definition at line 227 of file btree.h.

Referenced by __rec_iput().

#define P_BIGDATA   0x01

#define P_BIGKEY   0x02

#define P_BINTERNAL   0x01

Definition at line 80 of file btree.h.

Referenced by __bt_pgin(), __bt_pgout(), __bt_split(), bt_broot(), and bt_psplit().

#define P_BLEAF   0x02

#define P_INVALID   0

#define P_META   0

Definition at line 64 of file btree.h.

Referenced by __bt_pgin(), __bt_pgout(), and bt_meta().

#define P_OVERFLOW   0x04

Definition at line 82 of file btree.h.

Referenced by __ovfl_put().

#define P_PRESERVE   0x20

Definition at line 86 of file btree.h.

Referenced by __ovfl_delete(), and bt_preserve().

#define P_RINTERNAL   0x08

Definition at line 83 of file btree.h.

Referenced by __bt_split(), bt_psplit(), and bt_rroot().

#define P_RLEAF   0x10

Definition at line 84 of file btree.h.

Referenced by __bt_seqset(), __bt_split(), __rec_open(), __rec_search(), bt_psplit(), and bt_rroot().

#define P_ROOT   1

Definition at line 65 of file btree.h.

Referenced by __bt_pdelete(), __bt_search(), __bt_seqset(), __bt_split(), __rec_open(), __rec_search(), and nroot().

#define P_TYPE   0x1f

#define R_CLOSEFP   0x00040

Definition at line 377 of file btree.h.

Referenced by __rec_close(), and __rec_open().

#define R_EOF   0x00100

#define R_FIXLEN   0x00200

Definition at line 379 of file btree.h.

Referenced by __rec_open(), __rec_put(), and __rec_sync().

#define R_INMEM   0x00800

Definition at line 381 of file btree.h.

Referenced by __rec_close(), __rec_fd(), __rec_get(), __rec_open(), __rec_put(), __rec_seq(), and __rec_sync().

#define R_MEMMAPPED   0x00400

Definition at line 380 of file btree.h.

Referenced by __rec_close(), and __rec_open().

#define R_MODIFIED   0x01000

Definition at line 382 of file btree.h.

Referenced by __rec_delete(), __rec_put(), and __rec_sync().

#define R_RDONLY   0x02000

Definition at line 383 of file btree.h.

Referenced by __rec_open(), and __rec_sync().

#define R_RECNO   0x00080

Definition at line 375 of file btree.h.

Referenced by __bt_split(), and __rec_open().

#define SAVEMETA   (B_NODUPS | R_RECNO)

Definition at line 307 of file btree.h.

Referenced by __bt_open(), and bt_meta().

#define WR_BINTERNAL ( p,
size,
pgno,
flags   ) 

Definition at line 146 of file btree.h.

Referenced by __bt_split(), and bt_broot().

#define WR_BLEAF ( p,
key,
data,
flags   ) 

Definition at line 200 of file btree.h.

Referenced by __bt_put(), and __bt_split().

#define WR_RINTERNAL ( p,
nrecs,
pgno   ) 

Value:

{              \
   *(recno_t *)p = nrecs;                 \
   p += sizeof(recno_t);                  \
   *(pgno_t *)p = pgno;                \
}

Definition at line 173 of file btree.h.

Referenced by bt_rroot().

#define WR_RLEAF ( p,
data,
flags   ) 

Definition at line 231 of file btree.h.

Referenced by __bt_split(), and __rec_iput().


Typedef Documentation

typedef struct _binternal BINTERNAL

typedef struct _bleaf BLEAF

typedef struct _btmeta BTMETA

typedef struct _btree BTREE

typedef struct _cursor CURSOR

typedef struct _epg EPG

typedef struct _epgno EPGNO

typedef struct _page PAGE

typedef struct _rinternal RINTERNAL

typedef struct _rleaf RLEAF


Generated on Thu Apr 16 06:29:16 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6