From 8d6f1731fcd082e4f744ba9cb4bde4be7c08f1b3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 2 Jan 2000 06:01:06 +0000 Subject: Update. * Makeconfig (all-subdirs): Remove db and db2. * db/*: Removed. * db2/*: Removed. --- db2/include/btree.h | 263 -------------- db2/include/btree_auto.h | 127 ------- db2/include/btree_ext.h | 132 ------- db2/include/clib_ext.h | 59 ---- db2/include/common_ext.h | 34 -- db2/include/cxx_int.h | 118 ------- db2/include/db_185.h.src | 178 ---------- db2/include/db_am.h | 86 ----- db2/include/db_auto.h | 111 ------ db2/include/db_cxx.h | 861 ---------------------------------------------- db2/include/db_dispatch.h | 77 ----- db2/include/db_ext.h | 132 ------- db2/include/db_join.h | 23 -- db2/include/db_page.h | 512 --------------------------- db2/include/db_shash.h | 106 ------ db2/include/db_swap.h | 105 ------ db2/include/hash.h | 199 ----------- db2/include/hash_auto.h | 132 ------- db2/include/hash_ext.h | 130 ------- db2/include/lock.h | 197 ----------- db2/include/lock_ext.h | 20 -- db2/include/log.h | 204 ----------- db2/include/log_auto.h | 18 - db2/include/log_ext.h | 26 -- db2/include/mp.h | 299 ---------------- db2/include/mp_ext.h | 21 -- db2/include/mutex_ext.h | 7 - db2/include/os.h | 24 -- db2/include/os_ext.h | 40 --- db2/include/os_jump.h | 40 --- db2/include/queue.h | 275 --------------- db2/include/shqueue.h | 334 ------------------ db2/include/txn.h | 148 -------- db2/include/txn_auto.h | 51 --- db2/include/txn_ext.h | 41 --- db2/include/xa.h | 179 ---------- db2/include/xa_ext.h | 13 - 37 files changed, 5322 deletions(-) delete mode 100644 db2/include/btree.h delete mode 100644 db2/include/btree_auto.h delete mode 100644 db2/include/btree_ext.h delete mode 100644 db2/include/clib_ext.h delete mode 100644 db2/include/common_ext.h delete mode 100644 db2/include/cxx_int.h delete mode 100644 db2/include/db_185.h.src delete mode 100644 db2/include/db_am.h delete mode 100644 db2/include/db_auto.h delete mode 100644 db2/include/db_cxx.h delete mode 100644 db2/include/db_dispatch.h delete mode 100644 db2/include/db_ext.h delete mode 100644 db2/include/db_join.h delete mode 100644 db2/include/db_page.h delete mode 100644 db2/include/db_shash.h delete mode 100644 db2/include/db_swap.h delete mode 100644 db2/include/hash.h delete mode 100644 db2/include/hash_auto.h delete mode 100644 db2/include/hash_ext.h delete mode 100644 db2/include/lock.h delete mode 100644 db2/include/lock_ext.h delete mode 100644 db2/include/log.h delete mode 100644 db2/include/log_auto.h delete mode 100644 db2/include/log_ext.h delete mode 100644 db2/include/mp.h delete mode 100644 db2/include/mp_ext.h delete mode 100644 db2/include/mutex_ext.h delete mode 100644 db2/include/os.h delete mode 100644 db2/include/os_ext.h delete mode 100644 db2/include/os_jump.h delete mode 100644 db2/include/queue.h delete mode 100644 db2/include/shqueue.h delete mode 100644 db2/include/txn.h delete mode 100644 db2/include/txn_auto.h delete mode 100644 db2/include/txn_ext.h delete mode 100644 db2/include/xa.h delete mode 100644 db2/include/xa_ext.h (limited to 'db2/include') diff --git a/db2/include/btree.h b/db2/include/btree.h deleted file mode 100644 index b0c04b1508..0000000000 --- a/db2/include/btree.h +++ /dev/null @@ -1,263 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994, 1995, 1996 - * Keith Bostic. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994, 1995 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Olson. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)btree.h 10.26 (Sleepycat) 12/16/98 - */ - -/* Forward structure declarations. */ -struct __btree; typedef struct __btree BTREE; -struct __cursor; typedef struct __cursor CURSOR; -struct __epg; typedef struct __epg EPG; -struct __recno; typedef struct __recno RECNO; - -#define DEFMINKEYPAGE (2) - -#define ISINTERNAL(p) (TYPE(p) == P_IBTREE || TYPE(p) == P_IRECNO) -#define ISLEAF(p) (TYPE(p) == P_LBTREE || TYPE(p) == P_LRECNO) - -/* - * If doing transactions we have to hold the locks associated with a data item - * from a page for the entire transaction. However, we don't have to hold the - * locks associated with walking the tree. Distinguish between the two so that - * we don't tie up the internal pages of the tree longer than necessary. - */ -#define __BT_LPUT(dbc, lock) \ - (F_ISSET((dbc)->dbp, DB_AM_LOCKING) ? \ - lock_put((dbc)->dbp->dbenv->lk_info, lock) : 0) -#define __BT_TLPUT(dbc, lock) \ - (F_ISSET((dbc)->dbp, DB_AM_LOCKING) && (dbc)->txn == NULL ? \ - lock_put((dbc)->dbp->dbenv->lk_info, lock) : 0) - -/* - * Flags to __bam_search() and __bam_rsearch(). - * - * Note, internal page searches must find the largest record less than key in - * the tree so that descents work. Leaf page searches must find the smallest - * record greater than key so that the returned index is the record's correct - * position for insertion. - * - * The flags parameter to the search routines describes three aspects of the - * search: the type of locking required (including if we're locking a pair of - * pages), the item to return in the presence of duplicates and whether or not - * to return deleted entries. To simplify both the mnemonic representation - * and the code that checks for various cases, we construct a set of bitmasks. - */ -#define S_READ 0x00001 /* Read locks. */ -#define S_WRITE 0x00002 /* Write locks. */ - -#define S_APPEND 0x00040 /* Append to the tree. */ -#define S_DELNO 0x00080 /* Don't return deleted items. */ -#define S_DUPFIRST 0x00100 /* Return first duplicate. */ -#define S_DUPLAST 0x00200 /* Return last duplicate. */ -#define S_EXACT 0x00400 /* Exact items only. */ -#define S_PARENT 0x00800 /* Lock page pair. */ -#define S_STACK 0x01000 /* Need a complete stack. */ -#define S_PAST_EOF 0x02000 /* If doing insert search (or keyfirst - * or keylast operations), or a split - * on behalf of an insert, it's okay to - * return an entry one past end-of-page. - */ - -#define S_DELETE (S_WRITE | S_DUPFIRST | S_DELNO | S_EXACT | S_STACK) -#define S_FIND (S_READ | S_DUPFIRST | S_DELNO) -#define S_FIND_WR (S_WRITE | S_DUPFIRST | S_DELNO) -#define S_INSERT (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) -#define S_KEYFIRST (S_WRITE | S_DUPFIRST | S_PAST_EOF | S_STACK) -#define S_KEYLAST (S_WRITE | S_DUPLAST | S_PAST_EOF | S_STACK) -#define S_WRPAIR (S_WRITE | S_DUPLAST | S_PAST_EOF | S_PARENT) - -/* - * Flags to __bam_iitem(). - */ -#define BI_DELETED 0x01 /* Key/data pair only placeholder. */ -#define BI_DOINCR 0x02 /* Increment the record count. */ -#define BI_NEWKEY 0x04 /* New key. */ - -/* - * Various routines pass around page references. A page reference can be a - * pointer to the page or a page number; for either, an indx can designate - * an item on the page. - */ -struct __epg { - PAGE *page; /* The page. */ - db_indx_t indx; /* The index on the page. */ - DB_LOCK lock; /* The page's lock. */ -}; - -/* - * We maintain a stack of the pages that we're locking in the tree. Btree's - * (currently) only save two levels of the tree at a time, so the default - * stack is always large enough. Recno trees have to lock the entire tree to - * do inserts/deletes, however. Grow the stack as necessary. - */ -#define BT_STK_CLR(c) \ - ((c)->csp = (c)->sp) - -#define BT_STK_ENTER(c, pagep, page_indx, lock, ret) do { \ - if ((ret = \ - (c)->csp == (c)->esp ? __bam_stkgrow(c) : 0) == 0) { \ - (c)->csp->page = pagep; \ - (c)->csp->indx = page_indx; \ - (c)->csp->lock = lock; \ - } \ -} while (0) - -#define BT_STK_PUSH(c, pagep, page_indx, lock, ret) do { \ - BT_STK_ENTER(c, pagep, page_indx, lock, ret); \ - ++(c)->csp; \ -} while (0) - -#define BT_STK_POP(c) \ - ((c)->csp == (c)->stack ? NULL : --(c)->csp) - -/* - * Arguments passed to __bam_ca_replace(). - */ -typedef enum { - REPLACE_SETUP, - REPLACE_SUCCESS, - REPLACE_FAILED -} ca_replace_arg; - -/* Arguments passed to __ram_ca(). */ -typedef enum { - CA_DELETE, - CA_IAFTER, - CA_IBEFORE -} ca_recno_arg; - -#define RECNO_OOB 0 /* Illegal record number. */ - -/* Btree/Recno cursor. */ -struct __cursor { - DBC *dbc; /* Enclosing DBC. */ - - /* Per-thread information: shared by btree/recno. */ - EPG *sp; /* Stack pointer. */ - EPG *csp; /* Current stack entry. */ - EPG *esp; /* End stack pointer. */ - EPG stack[5]; - - /* Per-thread information: btree private. */ - PAGE *page; /* Cursor page. */ - - db_pgno_t pgno; /* Page. */ - db_indx_t indx; /* Page item ref'd by the cursor. */ - - db_pgno_t dpgno; /* Duplicate page. */ - db_indx_t dindx; /* Page item ref'd by the cursor. */ - - DB_LOCK lock; /* Cursor read lock. */ - db_lockmode_t mode; /* Lock mode. */ - - /* Per-thread information: recno private. */ - db_recno_t recno; /* Current record number. */ - - /* - * Btree: - * We set a flag in the cursor structure if the underlying object has - * been deleted. It's not strictly necessary, we could get the same - * information by looking at the page itself. - * - * Recno: - * When renumbering recno databases during deletes, cursors referencing - * "deleted" records end up positioned between two records, and so must - * be specially adjusted on the next operation. - */ -#define C_DELETED 0x0001 /* Record was deleted. */ - u_int32_t flags; -}; - -/* - * The in-memory recno data structure. - * - * !!! - * These fields are ignored as far as multi-threading is concerned. There - * are no transaction semantics associated with backing files, nor is there - * any thread protection. - */ -struct __recno { - int re_delim; /* Variable-length delimiting byte. */ - int re_pad; /* Fixed-length padding byte. */ - u_int32_t re_len; /* Length for fixed-length records. */ - - char *re_source; /* Source file name. */ - int re_fd; /* Source file descriptor */ - db_recno_t re_last; /* Last record number read. */ - void *re_cmap; /* Current point in mapped space. */ - void *re_smap; /* Start of mapped space. */ - void *re_emap; /* End of mapped space. */ - size_t re_msize; /* Size of mapped region. */ - /* Recno input function. */ - int (*re_irec) __P((DBC *, db_recno_t)); - -#define RECNO_EOF 0x0001 /* EOF on backing source file. */ -#define RECNO_MODIFIED 0x0002 /* Tree was modified. */ - u_int32_t flags; -}; - -/* - * The in-memory, per-tree btree data structure. - */ -struct __btree { - db_pgno_t bt_lpgno; /* Last insert location. */ - - db_indx_t bt_maxkey; /* Maximum keys per page. */ - db_indx_t bt_minkey; /* Minimum keys per page. */ - - int (*bt_compare) /* Comparison function. */ - __P((const DBT *, const DBT *)); - size_t(*bt_prefix) /* Prefix function. */ - __P((const DBT *, const DBT *)); - - db_indx_t bt_ovflsize; /* Maximum key/data on-page size. */ - - RECNO *recno; /* Private recno structure. */ -}; - -#include "btree_auto.h" -#include "btree_ext.h" -#include "db_am.h" -#include "common_ext.h" diff --git a/db2/include/btree_auto.h b/db2/include/btree_auto.h deleted file mode 100644 index 041b80f196..0000000000 --- a/db2/include/btree_auto.h +++ /dev/null @@ -1,127 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef bam_AUTO_H -#define bam_AUTO_H - -#define DB_bam_pg_alloc (DB_bam_BEGIN + 1) - -typedef struct _bam_pg_alloc_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - DB_LSN meta_lsn; - DB_LSN page_lsn; - db_pgno_t pgno; - u_int32_t ptype; - db_pgno_t next; -} __bam_pg_alloc_args; - - -#define DB_bam_pg_free (DB_bam_BEGIN + 2) - -typedef struct _bam_pg_free_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN meta_lsn; - DBT header; - db_pgno_t next; -} __bam_pg_free_args; - - -#define DB_bam_split (DB_bam_BEGIN + 3) - -typedef struct _bam_split_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t left; - DB_LSN llsn; - db_pgno_t right; - DB_LSN rlsn; - u_int32_t indx; - db_pgno_t npgno; - DB_LSN nlsn; - DBT pg; -} __bam_split_args; - - -#define DB_bam_rsplit (DB_bam_BEGIN + 4) - -typedef struct _bam_rsplit_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DBT pgdbt; - db_pgno_t nrec; - DBT rootent; - DB_LSN rootlsn; -} __bam_rsplit_args; - - -#define DB_bam_adj (DB_bam_BEGIN + 5) - -typedef struct _bam_adj_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - u_int32_t indx_copy; - u_int32_t is_insert; -} __bam_adj_args; - - -#define DB_bam_cadjust (DB_bam_BEGIN + 6) - -typedef struct _bam_cadjust_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - int32_t adjust; - int32_t total; -} __bam_cadjust_args; - - -#define DB_bam_cdel (DB_bam_BEGIN + 7) - -typedef struct _bam_cdel_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; -} __bam_cdel_args; - - -#define DB_bam_repl (DB_bam_BEGIN + 8) - -typedef struct _bam_repl_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - u_int32_t indx; - u_int32_t isdeleted; - DBT orig; - DBT repl; - u_int32_t prefix; - u_int32_t suffix; -} __bam_repl_args; - -#endif diff --git a/db2/include/btree_ext.h b/db2/include/btree_ext.h deleted file mode 100644 index fbc2ed958f..0000000000 --- a/db2/include/btree_ext.h +++ /dev/null @@ -1,132 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _btree_ext_h_ -#define _btree_ext_h_ -int __bam_cmp __P((DB *, const DBT *, - PAGE *, u_int32_t, int (*)(const DBT *, const DBT *))); -int __bam_defcmp __P((const DBT *, const DBT *)); -size_t __bam_defpfx __P((const DBT *, const DBT *)); -int __bam_pgin __P((db_pgno_t, void *, DBT *)); -int __bam_pgout __P((db_pgno_t, void *, DBT *)); -int __bam_mswap __P((PAGE *)); -int __bam_cprint __P((DB *)); -int __bam_ca_delete __P((DB *, db_pgno_t, u_int32_t, int)); -void __bam_ca_di __P((DB *, db_pgno_t, u_int32_t, int)); -void __bam_ca_dup __P((DB *, - db_pgno_t, u_int32_t, u_int32_t, db_pgno_t, u_int32_t)); -void __bam_ca_rsplit __P((DB *, db_pgno_t, db_pgno_t)); -void __bam_ca_split __P((DB *, - db_pgno_t, db_pgno_t, db_pgno_t, u_int32_t, int)); -int __bam_c_init __P((DBC *)); -int __bam_dup __P((DBC *, CURSOR *, u_int32_t, int)); -int __bam_delete __P((DB *, DB_TXN *, DBT *, u_int32_t)); -int __bam_ditem __P((DBC *, PAGE *, u_int32_t)); -int __bam_adjindx __P((DBC *, PAGE *, u_int32_t, u_int32_t, int)); -int __bam_dpage __P((DBC *, const DBT *)); -int __bam_dpages __P((DBC *)); -int __bam_open __P((DB *, DB_INFO *)); -int __bam_close __P((DB *)); -void __bam_setovflsize __P((DB *)); -int __bam_read_root __P((DB *)); -int __bam_new __P((DBC *, u_int32_t, PAGE **)); -int __bam_lput __P((DBC *, DB_LOCK)); -int __bam_free __P((DBC *, PAGE *)); -int __bam_lt __P((DBC *)); -int __bam_lget - __P((DBC *, int, db_pgno_t, db_lockmode_t, DB_LOCK *)); -int __bam_iitem __P((DBC *, - PAGE **, db_indx_t *, DBT *, DBT *, u_int32_t, u_int32_t)); -int __bam_ritem __P((DBC *, PAGE *, u_int32_t, DBT *)); -int __bam_pg_alloc_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_free_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_split_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_rsplit_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_adj_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cadjust_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cdel_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_repl_recover - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __ram_open __P((DB *, DB_INFO *)); -int __ram_close __P((DB *)); -int __ram_c_del __P((DBC *, u_int32_t)); -int __ram_c_get __P((DBC *, DBT *, DBT *, u_int32_t)); -int __ram_c_put __P((DBC *, DBT *, DBT *, u_int32_t)); -void __ram_ca __P((DB *, db_recno_t, ca_recno_arg)); -int __ram_getno __P((DBC *, const DBT *, db_recno_t *, int)); -int __bam_rsearch __P((DBC *, db_recno_t *, u_int32_t, int, int *)); -int __bam_adjust __P((DBC *, int32_t)); -int __bam_nrecs __P((DBC *, db_recno_t *)); -db_recno_t __bam_total __P((PAGE *)); -int __bam_search __P((DBC *, - const DBT *, u_int32_t, int, db_recno_t *, int *)); -int __bam_stkrel __P((DBC *, int)); -int __bam_stkgrow __P((CURSOR *)); -int __bam_split __P((DBC *, void *)); -int __bam_copy __P((DB *, PAGE *, PAGE *, u_int32_t, u_int32_t)); -int __bam_stat __P((DB *, void *, void *(*)(size_t), u_int32_t)); -int __bam_pg_alloc_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, DB_LSN *, DB_LSN *, db_pgno_t, - u_int32_t, db_pgno_t)); -int __bam_pg_alloc_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_alloc_read __P((void *, __bam_pg_alloc_args **)); -int __bam_pg_free_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, const DBT *, - db_pgno_t)); -int __bam_pg_free_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_pg_free_read __P((void *, __bam_pg_free_args **)); -int __bam_split_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, db_pgno_t, - DB_LSN *, u_int32_t, db_pgno_t, DB_LSN *, - const DBT *)); -int __bam_split_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_split_read __P((void *, __bam_split_args **)); -int __bam_rsplit_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, const DBT *, db_pgno_t, - const DBT *, DB_LSN *)); -int __bam_rsplit_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_rsplit_read __P((void *, __bam_rsplit_args **)); -int __bam_adj_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - u_int32_t, u_int32_t)); -int __bam_adj_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_adj_read __P((void *, __bam_adj_args **)); -int __bam_cadjust_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - int32_t, int32_t)); -int __bam_cadjust_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cadjust_read __P((void *, __bam_cadjust_args **)); -int __bam_cdel_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t)); -int __bam_cdel_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_cdel_read __P((void *, __bam_cdel_args **)); -int __bam_repl_log - __P((DB_LOG *, DB_TXN *, DB_LSN *, u_int32_t, - u_int32_t, db_pgno_t, DB_LSN *, u_int32_t, - u_int32_t, const DBT *, const DBT *, u_int32_t, - u_int32_t)); -int __bam_repl_print - __P((DB_LOG *, DBT *, DB_LSN *, int, void *)); -int __bam_repl_read __P((void *, __bam_repl_args **)); -int __bam_init_print __P((DB_ENV *)); -int __bam_init_recover __P((DB_ENV *)); -#endif /* _btree_ext_h_ */ diff --git a/db2/include/clib_ext.h b/db2/include/clib_ext.h deleted file mode 100644 index 2566b849ce..0000000000 --- a/db2/include/clib_ext.h +++ /dev/null @@ -1,59 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _clib_ext_h_ -#define _clib_ext_h_ -#ifdef __STDC__ -void err __P((int eval, const char *, ...)); -#else -void err(); -#endif -#ifdef __STDC__ -void errx __P((int eval, const char *, ...)); -#else -void errx(); -#endif -#ifdef __STDC__ -void warn __P((const char *, ...)); -#else -void warn(); -#endif -#ifdef __STDC__ -void warnx __P((const char *, ...)); -#else -void warnx(); -#endif -#ifndef HAVE_GETCWD -char *getcwd __P((char *, size_t)); -#endif -void get_long __P((char *, long, long, long *)); -#ifndef HAVE_GETOPT -int getopt __P((int, char * const *, const char *)); -#endif -#ifndef HAVE_MEMCMP -int memcmp __P((const void *, const void *, size_t)); -#endif -#ifndef HAVE_MEMCPY -void *memcpy __P((void *, const void *, size_t)); -#endif -#ifndef HAVE_MEMMOVE -void *memmove __P((void *, const void *, size_t)); -#endif -#ifndef HAVE_RAISE -int raise __P((int)); -#endif -#ifndef HAVE_SNPRINTF -#ifdef __STDC__ -int snprintf __P((char *, size_t, const char *, ...)); -#else -int snprintf(); -#endif -#endif -#ifndef HAVE_STRERROR -char *strerror __P((int)); -#endif -#ifndef HAVE_STRSEP -char *strsep __P((char **, const char *)); -#endif -#ifndef HAVE_VSNPRINTF -int vsnprintf(); -#endif -#endif /* _clib_ext_h_ */ diff --git a/db2/include/common_ext.h b/db2/include/common_ext.h deleted file mode 100644 index 33fb0cb218..0000000000 --- a/db2/include/common_ext.h +++ /dev/null @@ -1,34 +0,0 @@ -/* DO NOT EDIT: automatically built by dist/distrib. */ -#ifndef _common_ext_h_ -#define _common_ext_h_ -int __db_appname __P((DB_ENV *, - APPNAME, const char *, const char *, u_int32_t, int *, char **)); -int __db_apprec __P((DB_ENV *, u_int32_t)); -int __db_byteorder __P((DB_ENV *, int)); -int __db_fchk __P((DB_ENV *, const char *, u_int32_t, u_int32_t)); -int __db_fcchk - __P((DB_ENV *, const char *, u_int32_t, u_int32_t, u_int32_t)); -int __db_ferr __P((const DB_ENV *, const char *, int)); -#ifdef __STDC__ -void __db_err __P((const DB_ENV *dbenv, const char *fmt, ...)); -#else -void __db_err(); -#endif -int __db_pgerr __P((DB *, db_pgno_t)); -int __db_pgfmt __P((DB *, db_pgno_t)); -int __db_panic __P((DB_ENV *, int)); -u_int32_t __db_log2 __P((u_int32_t)); -int __db_rattach __P((REGINFO *)); -int __db_rdetach __P((REGINFO *)); -int __db_runlink __P((REGINFO *, int)); -int __db_rgrow __P((REGINFO *, size_t)); -int __db_rreattach __P((REGINFO *, size_t)); -void __db_shalloc_init __P((void *, size_t)); -int __db_shalloc __P((void *, size_t, size_t, void *)); -void __db_shalloc_free __P((void *, void *)); -size_t __db_shalloc_count __P((void *)); -size_t __db_shsizeof __P((void *)); -void __db_shalloc_dump __P((void *, FILE *)); -int __db_tablesize __P((u_int32_t)); -void __db_hashinit __P((void *, u_int32_t)); -#endif /* _common_ext_h_ */ diff --git a/db2/include/cxx_int.h b/db2/include/cxx_int.h deleted file mode 100644 index 0a59de4391..0000000000 --- a/db2/include/cxx_int.h +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)cxx_int.h 10.5 (Sleepycat) 4/10/98 - */ - -#ifndef _CXX_INT_H_ -#define _CXX_INT_H_ - -// private data structures known to the implementation only - -#include // used by defines below - -// -// Using FooImp classes will allow the implementation to change in the -// future without any modification to user code or even to header files -// that the user includes. FooImp * is just like void * except that it -// provides a little extra protection, since you cannot randomly assign -// any old pointer to a FooImp* as you can with void *. Currently, a -// pointer to such an opaque class is always just a pointer to the -// appropriate underlying implementation struct. These are converted -// back and forth using the various overloaded wrap()/unwrap() methods. -// This is essentially a use of the "Bridge" Design Pattern. -// -// WRAPPED_CLASS implements the appropriate wrap() and unwrap() methods -// for a wrapper class that has an underlying pointer representation. -// -#define WRAPPED_CLASS(_WRAPPER_CLASS, _IMP_CLASS, _WRAPPED_TYPE) \ - \ - class _IMP_CLASS {}; \ - \ - inline _WRAPPED_TYPE unwrap(_WRAPPER_CLASS *val) \ - { \ - if (!val) return 0; \ - return (_WRAPPED_TYPE)(val->imp()); \ - } \ - \ - inline const _WRAPPED_TYPE unwrapConst(const _WRAPPER_CLASS *val) \ - { \ - if (!val) return 0; \ - return (const _WRAPPED_TYPE)(val->imp()); \ - } \ - \ - inline _IMP_CLASS *wrap(_WRAPPED_TYPE val) \ - { \ - return (_IMP_CLASS*)val; \ - } - -WRAPPED_CLASS(DbLockTab, DbLockTabImp, DB_LOCKTAB*) -WRAPPED_CLASS(DbLog, DbLogImp, DB_LOG*) -WRAPPED_CLASS(DbMpool, DbMpoolImp, DB_MPOOL*) -WRAPPED_CLASS(DbMpoolFile, DbMpoolFileImp, DB_MPOOLFILE*) -WRAPPED_CLASS(Db, DbImp, DB*) -WRAPPED_CLASS(DbTxn, DbTxnImp, DB_TXN*) -WRAPPED_CLASS(DbTxnMgr, DbTxnMgrImp, DB_TXNMGR*) - -// Macros that handle detected errors, in case we want to -// change the default behavior. runtime_error() throws an -// exception by default. -// -// Since it's unusual to throw an exception in a destructor, -// we have a separate macro. For now, we silently ignore such -// detected errors. -// -#define DB_ERROR(caller, ecode) \ - DbEnv::runtime_error(caller, ecode) - -#define DB_DESTRUCTOR_ERROR(caller, ecode) \ - DbEnv::runtime_error(caller, ecode, 1) - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// These defines are for tedious flag or field set/get access methods. -// - -// Define setName() and getName() methods that twiddle -// the _flags field. -// -#define DB_FLAG_METHODS(_class, _flags, _cxx_name, _flag_name) \ - \ -void _class::set##_cxx_name(int onOrOff) \ -{ \ - if (onOrOff) \ - _flags |= _flag_name; \ - else \ - _flags &= ~(_flag_name); \ -} \ - \ -int _class::get##_cxx_name() const \ -{ \ - return (_flags & _flag_name) ? 1 : 0; \ -} - - -#define DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ - \ -_type _class::get_##_cxx_name() const \ -{ \ - return _field; \ -} - -#define DB_WO_ACCESS(_class, _type, _cxx_name, _field) \ - \ -void _class::set_##_cxx_name(_type value) \ -{ \ - _field = value; \ -} \ - -#define DB_RW_ACCESS(_class, _type, _cxx_name, _field) \ - DB_RO_ACCESS(_class, _type, _cxx_name, _field) \ - DB_WO_ACCESS(_class, _type, _cxx_name, _field) - -#endif /* !_CXX_INT_H_ */ diff --git a/db2/include/db_185.h.src b/db2/include/db_185.h.src deleted file mode 100644 index a928ca8fd5..0000000000 --- a/db2/include/db_185.h.src +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - */ -/* - * Copyright (c) 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)db_185.h.src 8.7 (Sleepycat) 4/10/98 - */ - -#ifndef _DB_185_H_ -#define _DB_185_H_ - -#include - -#include - -/* - * XXX - * Handle function prototypes and the keyword "const". This steps on name - * space that DB doesn't control, but all of the other solutions are worse. - */ -#undef __P -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* ANSI C prototypes */ -#else -#define const -#define __P(protos) () /* K&R C preprocessor */ -#endif - -#define RET_ERROR -1 /* Return values. */ -#define RET_SUCCESS 0 -#define RET_SPECIAL 1 - -#ifndef __BIT_TYPES_DEFINED__ -#define __BIT_TYPES_DEFINED__ -@u_int8_decl@ -@int16_decl@ -@u_int16_decl@ -@int32_decl@ -@u_int32_decl@ -#endif - -/* - * XXX - * SGI/IRIX already has a pgno_t. - */ -#ifdef sgi -#define pgno_t db_pgno_t -#endif - -#define MAX_PAGE_NUMBER 0xffffffff /* >= # of pages in a file */ -typedef u_int32_t pgno_t; -#define MAX_PAGE_OFFSET 65535 /* >= # of bytes in a page */ -typedef u_int16_t indx_t; -#define MAX_REC_NUMBER 0xffffffff /* >= # of records in a tree */ -typedef u_int32_t recno_t; - -/* Key/data structure -- a Data-Base Thang. */ -typedef struct { - void *data; /* data */ - size_t size; /* data length */ -} DBT; - -/* Routine flags. */ -#define R_CURSOR 1 /* del, put, seq */ -#define __R_UNUSED 2 /* UNUSED */ -#define R_FIRST 3 /* seq */ -#define R_IAFTER 4 /* put (RECNO) */ -#define R_IBEFORE 5 /* put (RECNO) */ -#define R_LAST 6 /* seq (BTREE, RECNO) */ -#define R_NEXT 7 /* seq */ -#define R_NOOVERWRITE 8 /* put */ -#define R_PREV 9 /* seq (BTREE, RECNO) */ -#define R_SETCURSOR 10 /* put (RECNO) */ -#define R_RECNOSYNC 11 /* sync (RECNO) */ - -typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; - -/* Access method description structure. */ -typedef struct __db { - DBTYPE type; /* Underlying db type. */ - int (*close) __P((struct __db *)); - int (*del) __P((const struct __db *, const DBT *, u_int)); - int (*get) __P((const struct __db *, const DBT *, DBT *, u_int)); - int (*put) __P((const struct __db *, DBT *, const DBT *, u_int)); - int (*seq) __P((const struct __db *, DBT *, DBT *, u_int)); - int (*sync) __P((const struct __db *, u_int)); - void *internal; /* Access method private. */ - int (*fd) __P((const struct __db *)); -} DB; - -#define BTREEMAGIC 0x053162 -#define BTREEVERSION 3 - -/* Structure used to pass parameters to the btree routines. */ -typedef struct { -#define R_DUP 0x01 /* duplicate keys */ - u_int32_t flags; - u_int32_t cachesize; /* bytes to cache */ - u_int32_t maxkeypage; /* maximum keys per page */ - u_int32_t minkeypage; /* minimum keys per page */ - u_int32_t psize; /* page size */ - int (*compare) /* comparison function */ - __P((const DBT *, const DBT *)); - size_t (*prefix) /* prefix function */ - __P((const DBT *, const DBT *)); - int lorder; /* byte order */ -} BTREEINFO; - -#define HASHMAGIC 0x061561 -#define HASHVERSION 2 - -/* Structure used to pass parameters to the hashing routines. */ -typedef struct { - u_int32_t bsize; /* bucket size */ - u_int32_t ffactor; /* fill factor */ - u_int32_t nelem; /* number of elements */ - u_int32_t cachesize; /* bytes to cache */ - u_int32_t /* hash function */ - (*hash) __P((const void *, size_t)); - int lorder; /* byte order */ -} HASHINFO; - -/* Structure used to pass parameters to the record routines. */ -typedef struct { -#define R_FIXEDLEN 0x01 /* fixed-length records */ -#define R_NOKEY 0x02 /* key not required */ -#define R_SNAPSHOT 0x04 /* snapshot the input */ - u_int32_t flags; - u_int32_t cachesize; /* bytes to cache */ - u_int32_t psize; /* page size */ - int lorder; /* byte order */ - size_t reclen; /* record length (fixed-length records) */ - u_char bval; /* delimiting byte (variable-length records */ - char *bfname; /* btree file name */ -} RECNOINFO; - -#if defined(__cplusplus) -extern "C" { -#endif -DB *dbopen __P((const char *, int, int, DBTYPE, const void *)); - -#if defined(__cplusplus) -} -#endif -#endif /* !_DB_185_H_ */ diff --git a/db2/include/db_am.h b/db2/include/db_am.h deleted file mode 100644 index fe2176d772..0000000000 --- a/db2/include/db_am.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1996, 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_am.h 10.15 (Sleepycat) 11/22/98 - */ -#ifndef _DB_AM_H -#define _DB_AM_H - -#define DB_ISBIG 0x01 -#define DB_ADD_DUP 0x10 -#define DB_REM_DUP 0x20 -#define DB_ADD_BIG 0x30 -#define DB_REM_BIG 0x40 -#define DB_SPLITOLD 0x50 -#define DB_SPLITNEW 0x60 -#define DB_ADD_PAGE 0x70 -#define DB_REM_PAGE 0x80 - -/* - * Standard initialization and shutdown macros for all recovery functions. - * - * Requires the following local variables: - * - * DB *file_dbp, *mdbp; - * DB_MPOOLFILE *mpf; - * int ret; - */ -#define REC_INTRO(func) { \ - file_dbp = NULL; \ - dbc = NULL; \ - if ((ret = func(dbtp->data, &argp)) != 0) \ - goto out; \ - if ((ret = \ - __db_fileid_to_db(logp, &file_dbp, argp->fileid)) != 0) { \ - if (ret == DB_DELETED) { \ - ret = 0; \ - goto done; \ - } \ - goto out; \ - } \ - if (file_dbp == NULL) \ - goto out; \ - if ((ret = file_dbp->cursor(file_dbp, NULL, &dbc, 0)) != 0) \ - goto out; \ - F_SET(dbc, DBC_RECOVER); \ - mpf = file_dbp->mpf; \ -} - -#define REC_CLOSE { \ - if (argp != NULL) \ - __os_free(argp, sizeof(*argp)); \ - if (dbc != NULL) \ - dbc->c_close(dbc); \ - return (ret); \ -} - -/* - * No-op versions of the same macros. - */ -#define REC_NOOP_INTRO(func) { \ - if ((ret = func(dbtp->data, &argp)) != 0) \ - return (ret); \ -} -#define REC_NOOP_CLOSE { \ - if (argp != NULL) \ - __os_free(argp, sizeof(*argp)); \ - return (ret); \ -} - -/* - * Standard debugging macro for all recovery functions. - */ -#ifdef DEBUG_RECOVER -#define REC_PRINT(func) \ - (void)func(logp, dbtp, lsnp, redo, info); -#else -#define REC_PRINT(func) \ - COMPQUIET(info, NULL); -#endif - -#include "db_auto.h" -#include "db_ext.h" -#endif diff --git a/db2/include/db_auto.h b/db2/include/db_auto.h deleted file mode 100644 index 0d1e43a26a..0000000000 --- a/db2/include/db_auto.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Do not edit: automatically built by dist/db_gen.sh. */ -#ifndef db_AUTO_H -#define db_AUTO_H - -#define DB_db_addrem (DB_db_BEGIN + 1) - -typedef struct _db_addrem_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - u_int32_t indx; - size_t nbytes; - DBT hdr; - DBT dbt; - DB_LSN pagelsn; -} __db_addrem_args; - - -#define DB_db_split (DB_db_BEGIN + 2) - -typedef struct _db_split_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - DBT pageimage; - DB_LSN pagelsn; -} __db_split_args; - - -#define DB_db_big (DB_db_BEGIN + 3) - -typedef struct _db_big_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - db_pgno_t prev_pgno; - db_pgno_t next_pgno; - DBT dbt; - DB_LSN pagelsn; - DB_LSN prevlsn; - DB_LSN nextlsn; -} __db_big_args; - - -#define DB_db_ovref (DB_db_BEGIN + 4) - -typedef struct _db_ovref_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - int32_t adjust; - DB_LSN lsn; -} __db_ovref_args; - - -#define DB_db_relink (DB_db_BEGIN + 5) - -typedef struct _db_relink_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t opcode; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - db_pgno_t prev; - DB_LSN lsn_prev; - db_pgno_t next; - DB_LSN lsn_next; -} __db_relink_args; - - -#define DB_db_addpage (DB_db_BEGIN + 6) - -typedef struct _db_addpage_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - u_int32_t fileid; - db_pgno_t pgno; - DB_LSN lsn; - db_pgno_t nextpgno; - DB_LSN nextlsn; -} __db_addpage_args; - - -#define DB_db_debug (DB_db_BEGIN + 7) - -typedef struct _db_debug_args { - u_int32_t type; - DB_TXN *txnid; - DB_LSN prev_lsn; - DBT op; - u_int32_t fileid; - DBT key; - DBT data; - u_int32_t arg_flags; -} __db_debug_args; - -#endif diff --git a/db2/include/db_cxx.h b/db2/include/db_cxx.h deleted file mode 100644 index f415d594b5..0000000000 --- a/db2/include/db_cxx.h +++ /dev/null @@ -1,861 +0,0 @@ -/*- - * See the file LICENSE for redistribution information. - * - * Copyright (c) 1997, 1998 - * Sleepycat Software. All rights reserved. - * - * @(#)db_cxx.h 10.30 (Sleepycat) 11/22/98 - */ - -#ifndef _DB_CXX_H_ -#define _DB_CXX_H_ -// -// C++ assumptions: -// -// To ensure portability to many platforms, both new and old, we make -// few assumptions about the C++ compiler and library. For example, -// we do not expect STL, templates or namespaces to be available. The -// "newest" C++ feature used is exceptions, which are used liberally -// to transmit error information. Even the use of exceptions can be -// disabled at runtime, see setErrorModel(). -// -// C++ naming conventions: -// -// - All top level class names start with Db. -// - All class members start with lower case letter. -// - All private data members are suffixed with underscore. -// - Use underscores to divide names into multiple words. -// - Simple data accessors are named with get_ or set_ prefix. -// - All method names are taken from names of functions in the C -// layer of db (usually by dropping a prefix like "db_"). -// These methods have the same argument types and order, -// other than dropping the explicit arg that acts as "this". -// -// As a rule, each DbFoo object has exactly one underlying DB_FOO struct -// (defined in db.h) associated with it. In many cases, we inherit directly -// from the DB_FOO structure to make this relationship explicit. Often, -// the underlying C layer allocates and deallocates these structures, so -// there is no easy way to add any data to the DbFoo class. When you see -// a comment about whether data is permitted to be added, this is what -// is going on. Of course, if we need to add data to such C++ classes -// in the future, we will arrange to have an indirect pointer to the -// DB_FOO struct (as some of the classes already have). -// - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Forward declarations -// - -#include -#include - -class Db; // forward -class Dbc; // forward -class DbEnv; // forward -class DbException; // forward -class DbInfo; // forward -class DbLock; // forward -class DbLockTab; // forward -class DbLog; // forward -class DbLsn; // forward -class DbMpool; // forward -class DbMpoolFile; // forward -class Dbt; // forward -class DbTxn; // forward -class DbTxnMgr; // forward - -// These classes are not defined here and should be invisible -// to the user, but some compilers require forward references. -// There is one for each use of the DEFINE_DB_CLASS macro. - -class DbLockTabImp; -class DbLogImp; -class DbMpoolImp; -class DbMpoolFileImp; -class DbImp; -class DbTxnImp; -class DbTxnMgrImp; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Mechanisms for declaring classes -// - -// -// Every class defined in this file has an _exported next to the class name. -// This is needed for WinTel machines so that the class methods can -// be exported or imported in a DLL as appropriate. Users of the DLL -// use the define DB_USE_DLL. When the DLL is built, DB_CREATE_DLL -// must be defined. -// -#if defined(_MSC_VER) - -# if defined(DB_CREATE_DLL) -# define _exported __declspec(dllexport) // creator of dll -# elif defined(DB_USE_DLL) -# define _exported __declspec(dllimport) // user of dll -# else -# define _exported // static lib creator or user -# endif - -#else - -# define _exported - -#endif - -// DEFINE_DB_CLASS defines an imp_ data member and imp() accessor. -// The underlying type is a pointer to an opaque *Imp class, that -// gets converted to the correct implementation class by the implementation. -// -// Since these defines use "private/public" labels, and leave the access -// being "private", we always use these by convention before any data -// members in the private section of a class. Keeping them in the -// private section also emphasizes that they are off limits to user code. -// -#define DEFINE_DB_CLASS(name) \ - public: class name##Imp* imp() { return imp_; } \ - public: const class name##Imp* imp() const { return imp_; } \ - private: class name##Imp* imp_ - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Turn off inappropriate compiler warnings -// - -#ifdef _MSC_VER - -// These are level 4 warnings that are explicitly disabled. -// With Visual C++, by default you do not see above level 3 unless -// you use /W4. But we like to compile with the highest level -// warnings to catch other errors. -// -// 4201: nameless struct/union -// triggered by standard include file -// -// 4514: unreferenced inline function has been removed -// certain include files in MSVC define methods that are not called -// -#pragma warning(disable: 4201 4514) - -#endif - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Exception classes -// - -// Almost any error in the DB library throws a DbException. -// Every exception should be considered an abnormality -// (e.g. bug, misuse of DB, file system error). -// -// NOTE: We would like to inherit from class exception and -// let it handle what(), but there are -// MSVC++ problems when is included. -// -class _exported DbException -{ -public: - virtual ~DbException(); - DbException(int err); - DbException(const char *description); - DbException(const char *prefix, int err); - DbException(const char *prefix1, const char *prefix2, int err); - const int get_errno(); - virtual const char *what() const; - - DbException(const DbException &); - DbException &operator = (const DbException &); - -private: - char *what_; - int err_; // errno -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Lock classes -// - -class _exported DbLock -{ - friend class DbLockTab; - -public: - DbLock(); - - int put(DbLockTab *locktab); - - DbLock(const DbLock &); - DbLock &operator = (const DbLock &); - -protected: - // We can add data to this class if needed - // since its contained class is not allocated by db. - // (see comment at top) - - DbLock(DB_LOCK); - DB_LOCK lock_; -}; - -class _exported DbLockTab -{ - friend class DbEnv; - -public: - int close(); - int detect(u_int32_t flags, int atype); - int get(u_int32_t locker, u_int32_t flags, const Dbt *obj, - db_lockmode_t lock_mode, DbLock *lock); - int id(u_int32_t *idp); - int stat(DB_LOCK_STAT **statp, void *(*db_malloc)(size_t)); - int vec(u_int32_t locker, u_int32_t flags, DB_LOCKREQ list[], - int nlist, DB_LOCKREQ **elistp); - - // Create or remove new locktab files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbLockTab **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // copying not allowed - // - DbLockTab(const DbLockTab &); - DbLockTab &operator = (const DbLockTab &); - - // Note: use DbLockTab::open() or DbEnv::get_lk_info() - // to get pointers to a DbLockTab, - // and call DbLockTab::close() rather than delete to release them. - // - DbLockTab(); - ~DbLockTab(); - - DEFINE_DB_CLASS(DbLockTab); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Log classes -// - -class _exported DbLsn : protected DB_LSN -{ - friend class DbLog; // friendship needed to cast to base class - friend class DbMpool; -}; - -class _exported DbLog -{ - friend class DbEnv; - -public: - int archive(char **list[], u_int32_t flags, void *(*db_malloc)(size_t)); - int close(); - static int compare(const DbLsn *lsn0, const DbLsn *lsn1); - int file(DbLsn *lsn, char *namep, int len); - int flush(const DbLsn *lsn); - int get(DbLsn *lsn, Dbt *data, u_int32_t flags); - int put(DbLsn *lsn, const Dbt *data, u_int32_t flags); - - // Normally these would be called register and unregister to - // parallel the C interface, but "register" is a reserved word. - // - int db_register(Db *dbp, const char *name, DBTYPE type, u_int32_t *fidp); - int db_unregister(u_int32_t fid); - - // Create or remove new log files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbLog **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbLog::open() or DbEnv::get_lg_info() - // to get pointers to a DbLog, - // and call DbLog::close() rather than delete to release them. - // - DbLog(); - ~DbLog(); - - // no copying - DbLog(const DbLog &); - operator = (const DbLog &); - - DEFINE_DB_CLASS(DbLog); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Memory pool classes -// - -class _exported DbMpoolFile -{ - friend class DbEnv; - -public: - int close(); - int get(db_pgno_t *pgnoaddr, u_int32_t flags, void *pagep); - int put(void *pgaddr, u_int32_t flags); - int set(void *pgaddr, u_int32_t flags); - int sync(); - - static int open(DbMpool *mp, const char *file, - u_int32_t flags, int mode, size_t pagesize, - DB_MPOOL_FINFO *finfop, DbMpoolFile **mpf); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbMpoolFile::open() - // to get pointers to a DbMpoolFile, - // and call DbMpoolFile::close() rather than delete to release them. - // - DbMpoolFile(); - - // Shut g++ up. -protected: - ~DbMpoolFile(); - -private: - // no copying - DbMpoolFile(const DbMpoolFile &); - operator = (const DbMpoolFile &); - - DEFINE_DB_CLASS(DbMpoolFile); -}; - -class _exported DbMpool -{ - friend class DbEnv; - -public: - int close(); - - // access to low level interface - // Normally this would be called register to parallel - // the C interface, but "register" is a reserved word. - // - int db_register(int ftype, - int (*pgin)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie), - int (*pgout)(db_pgno_t pgno, void *pgaddr, DBT *pgcookie)); - - int stat(DB_MPOOL_STAT **gsp, DB_MPOOL_FSTAT ***fsp, - void *(*db_malloc)(size_t)); - int sync(DbLsn *lsn); - int trickle(int pct, int *nwrotep); - - // Create or remove new mpool files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbMpool **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbMpool::open() or DbEnv::get_mp_info() - // to get pointers to a DbMpool, - // and call DbMpool::close() rather than delete to release them. - // - DbMpool(); - ~DbMpool(); - - // no copying - DbMpool(const DbMpool &); - DbMpool &operator = (const DbMpool &); - - DEFINE_DB_CLASS(DbMpool); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Transaction classes -// - -class _exported DbTxnMgr -{ - friend class DbEnv; - -public: - int begin(DbTxn *pid, DbTxn **tid); - int checkpoint(u_int32_t kbyte, u_int32_t min) const; - int close(); - int stat(DB_TXN_STAT **statp, void *(*db_malloc)(size_t)); - - // Create or remove new txnmgr files - // - static int open(const char *dir, u_int32_t flags, int mode, - DbEnv* dbenv, DbTxnMgr **regionp); - static int unlink(const char *dir, int force, DbEnv* dbenv); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbTxnMgr::open() or DbEnv::get_tx_info() - // to get pointers to a DbTxnMgr, - // and call DbTxnMgr::close() rather than delete to release them. - // - DbTxnMgr(); - ~DbTxnMgr(); - - // no copying - DbTxnMgr(const DbTxnMgr &); - operator = (const DbTxnMgr &); - - DEFINE_DB_CLASS(DbTxnMgr); -}; - -class _exported DbTxn -{ - friend class DbTxnMgr; - -public: - int abort(); - int commit(); - u_int32_t id(); - int prepare(); - -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use DbTxnMgr::begin() to get pointers to a DbTxn, - // and call DbTxn::abort() or DbTxn::commit rather than - // delete to release them. - // - DbTxn(); - ~DbTxn(); - - // no copying - DbTxn(const DbTxn &); - operator = (const DbTxn &); - - DEFINE_DB_CLASS(DbTxn); -}; - - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Application classes -// - -// -// A set of application options - define how this application uses -// the db library. -// -class _exported DbInfo : protected DB_INFO -{ - friend class DbEnv; - friend class Db; - -public: - DbInfo(); - ~DbInfo(); - - // Byte order. - void set_lorder(int); - - // Underlying cache size. - void set_cachesize(size_t); - - // Underlying page size. - void set_pagesize(size_t); - - // Local heap allocation. - typedef void *(*db_malloc_fcn)(size_t); - void set_malloc(db_malloc_fcn); - - // Duplicate compare function. - typedef int (*dup_compare_fcn)(const DBT *, const DBT *); - void set_dup_compare(dup_compare_fcn); - - //////////////////////////////////////////////////////////////// - // Btree access method. - - // Maximum keys per page. - void set_bt_maxkey(int); - - // Minimum keys per page. - void set_bt_minkey(int); - - // Comparison function. - typedef int (*bt_compare_fcn)(const DBT *, const DBT *); - void set_bt_compare(bt_compare_fcn); - - // Prefix function. - typedef size_t (*bt_prefix_fcn)(const DBT *, const DBT *); - void set_bt_prefix(bt_prefix_fcn); - - //////////////////////////////////////////////////////////////// - // Hash access method. - - // Fill factor. - void set_h_ffactor(u_int32_t); - - // Number of elements. - void set_h_nelem(u_int32_t); - - // Hash function. - typedef u_int32_t (*h_hash_fcn)(const void *, u_int32_t); - void set_h_hash(h_hash_fcn); - - //////////////////////////////////////////////////////////////// - // Recno access method. - - // Fixed-length padding byte. - void set_re_pad(int); - - // Variable-length delimiting byte. - void set_re_delim(int); - - // Length for fixed-length records. - void set_re_len(u_int32_t); - - // Source file name. - void set_re_source(char *); - - // Note: some flags are set as side effects of calling - // above "set" methods. - // - void set_flags(u_int32_t); - - - // (deep) copying of this object is allowed. - // - DbInfo(const DbInfo &); - DbInfo &operator = (const DbInfo &); - -private: - // We can add data to this class if needed - // since parent class is not allocated by db. - // (see comment at top) -}; - -// -// Base application class. Provides functions for opening a database. -// User of this library can use this class as a starting point for -// developing a DB application - derive their application class from -// this one, add application control logic. -// -// Note that if you use the default constructor, you must explicitly -// call appinit() before any other db activity (e.g. opening files) -// -class _exported DbEnv : protected DB_ENV -{ - friend class DbTxnMgr; - friend class DbLog; - friend class DbLockTab; - friend class DbMpool; - friend class Db; - -public: - - ~DbEnv(); - - // This constructor can be used to immediately initialize the - // application with these arguments. Do not use it if you - // need to set other parameters via the access methods. - // - DbEnv(const char *homeDir, char *const *db_config, u_int32_t flags); - - // Use this constructor if you wish to *delay* the initialization - // of the db library. This is useful if you need to set - // any particular parameters via the access methods below. - // Then call appinit() to complete the initialization. - // - DbEnv(); - - // Used in conjunction with the default constructor to - // complete the initialization of the db library. - // - int appinit(const char *homeDir, char *const *db_config, u_int32_t flags); - - // Called automatically when DbEnv is destroyed, or can be - // called at any time to shut down Db. - // - int appexit(); - - // Version information. A static method so it can be obtained anytime. - // - static char *version(int *major, int *minor, int *patch); - - //////////////////////////////////////////////////////////////// - // simple get/set access methods - // - // If you are calling set_ methods, you need to - // use the default constructor along with appinit(). - - // Byte order. - void set_lorder(int); - - // Panic callback. - typedef void (*db_paniccall_fcn)(DbEnv *, int); - void set_paniccall(db_paniccall_fcn); - - // Error message callback. - typedef void (*db_errcall_fcn)(const char *, char *); - void set_errcall(db_errcall_fcn); - - // Error message file stream. - void set_errfile(FILE *); - - // Error message prefix. - void set_errpfx(const char *); - - // Generate debugging messages. - void set_verbose(int); - - //////////////////////////////////////////////////////////////// - // Locking. - - // Return from lock_open(). - DbLockTab *get_lk_info() const; - - // Two dimensional conflict matrix. - void set_lk_conflicts(u_int8_t *); - - // Number of lock modes in table. - void set_lk_modes(int); - - // Maximum number of locks. - void set_lk_max(u_int32_t); - - // Deadlock detect on every conflict. - void set_lk_detect(u_int32_t); - - - //////////////////////////////////////////////////////////////// - // Logging. - - // Return from log_open(). - DbLog *get_lg_info() const; - - // Maximum file size. - void set_lg_max(u_int32_t); - - - //////////////////////////////////////////////////////////////// - // Memory pool. - - // Return from memp_open(). - DbMpool *get_mp_info() const; - - // Maximum file size for mmap. - void set_mp_mmapsize(size_t); - - // Bytes in the mpool cache. - void set_mp_size(size_t); - - - //////////////////////////////////////////////////////////////// - // Transactions. - - // Return from txn_open(). - DbTxnMgr *get_tx_info() const; - - // Maximum number of transactions. - void set_tx_max(u_int32_t); - - // Dispatch function for recovery. - typedef int (*tx_recover_fcn)(DB_LOG *, DBT *, DB_LSN *, int, void *); - void set_tx_recover(tx_recover_fcn); - - // Flags. - void set_flags(u_int32_t); - - //////////////////////////////////////////////////////////////// - // The default error model is to throw an exception whenever - // an error occurs. This generally allows for cleaner logic - // for transaction processing, as a try block can surround a - // single transaction. Alternatively, since almost every method - // returns an error code (errno), the error model can be set to - // not throw exceptions, and instead return the appropriate code. - // - enum ErrorModel { Exception, ErrorReturn }; - void set_error_model(ErrorModel); - - // If an error is detected and the error call function - // or stream is set, a message is dispatched or printed. - // If a prefix is set, each message is prefixed. - // - // You can use set_errcall() or set_errfile() above to control - // error functionality using a C model. Alternatively, you can - // call set_error_stream() to force all errors to a C++ stream. - // It is unwise to mix these approaches. - // - void set_error_stream(class ostream*); - - // used internally - static int runtime_error(const char *caller, int err, - int in_destructor = 0, int force_throw = 0); - -private: - // We can add data to this class if needed - // since parent class is not allocated by db. - // (see comment at top) - - // no copying - DbEnv(const DbEnv &); - operator = (const DbEnv &); - - ErrorModel error_model_; - static void stream_error_function(const char *, char *); - static ostream *error_stream_; -}; - -//////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////// -// -// Table access classes -// - -// -// Represents a database table = a set of keys with associated values. -// -class _exported Db -{ - friend class DbEnv; - -public: - int close(u_int32_t flags); - int cursor(DbTxn *txnid, Dbc **cursorp, u_int32_t flags); - int del(DbTxn *txnid, Dbt *key, u_int32_t flags); - int fd(int *fdp); - int get(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); - int join(Dbc **curslist, u_int32_t flags, Dbc **dbcp); - int put(DbTxn *txnid, Dbt *key, Dbt *data, u_int32_t flags); - int stat(void *sp, void *(*db_malloc)(size_t), u_int32_t flags); - int sync(u_int32_t flags); - - int get_byteswapped() const; - DBTYPE get_type() const; - - static int open(const char *fname, DBTYPE type, u_int32_t flags, - int mode, DbEnv *dbenv, DbInfo *info, Db **dbpp); - - static int xa_open(const char *fname, DBTYPE type, u_int32_t flags, - int mode, DbInfo *info, Db **dbpp); -private: - // We can add data to this class if needed - // since it is implemented via a pointer. - // (see comment at top) - - // Note: use Db::open() to get initialize pointers to a Db, - // and call Db::close() rather than delete to release them. - Db(); - ~Db(); - - // no copying - Db(const Db &); - Db &operator = (const Db &); - - DEFINE_DB_CLASS(Db); -}; - -// -// A chunk of data, maybe a key or value. -// -class _exported Dbt : private DBT -{ - friend class Dbc; - friend class Db; - friend class DbLog; - friend class DbMpoolFile; - friend class DbLockTab; - -public: - - // key/data - void *get_data() const; - void set_data(void *); - - // key/data length - u_int32_t get_size() const; - void set_size(u_int32_t); - - // RO: length of user buffer. - u_int32_t get_ulen() const; - void set_ulen(u_int32_t); - - // RO: get/put record length. - u_int32_t get_dlen() const; - void set_dlen(u_int32_t); - - // RO: get/put record offset. - u_int32_t get_doff() const; - void s