📄 db.in
字号:
/* * See the file LICENSE for redistribution information. * * Copyright (c) 1996-2002 * Sleepycat Software. All rights reserved. * * $Id: db.in,v 11.323 2002/09/03 17:27:16 bostic Exp $ * * db.h include file layout: * General. * Database Environment. * Locking subsystem. * Logging subsystem. * Shared buffer cache (mpool) subsystem. * Transaction subsystem. * Access methods. * Access method cursors. * Dbm/Ndbm, Hsearch historic interfaces. */#ifndef _DB_H_#define _DB_H_#ifndef __NO_SYSTEM_INCLUDES#include <sys/types.h>#include <stdio.h>#endif#if defined(__cplusplus)extern "C" {#endif/* * 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. * * XXX * While Microsoft's compiler is ANSI C compliant, it doesn't have _STDC_ * defined by default, you specify a command line flag or #pragma to turn * it on. Don't do that, however, because some of Microsoft's own header * files won't compile. */#undef __P#if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_VER)#define __P(protos) protos /* ANSI C prototypes */#else#define const#define __P(protos) () /* K&R C preprocessor */#endif/* * Berkeley DB version information. */#define DB_VERSION_MAJOR @DB_VERSION_MAJOR@#define DB_VERSION_MINOR @DB_VERSION_MINOR@#define DB_VERSION_PATCH @DB_VERSION_PATCH@#define DB_VERSION_STRING @DB_VERSION_STRING@/* * !!! * Berkeley DB uses specifically sized types. If they're not provided by * the system, typedef them here. * * We protect them against multiple inclusion using __BIT_TYPES_DEFINED__, * as does BIND and Kerberos, since we don't know for sure what #include * files the user is using. * * !!! * We also provide the standard u_int, u_long etc., if they're not provided * by the system. */#ifndef __BIT_TYPES_DEFINED__#define __BIT_TYPES_DEFINED__@u_int8_decl@@int16_decl@@u_int16_decl@@int32_decl@@u_int32_decl@#endif@u_char_decl@@u_short_decl@@u_int_decl@@u_long_decl@@ssize_t_decl@/* Basic types that are exported or quasi-exported. */typedef u_int32_t db_pgno_t; /* Page number type. */typedef u_int16_t db_indx_t; /* Page offset type. */#define DB_MAX_PAGES 0xffffffff /* >= # of pages in a file */typedef u_int32_t db_recno_t; /* Record number type. */#define DB_MAX_RECORDS 0xffffffff /* >= # of records in a tree */typedef u_int32_t db_timeout_t; /* Type of a timeout. *//* * Region offsets are currently limited to 32-bits. I expect that's going * to have to be fixed in the not-too-distant future, since we won't want to * split 100Gb memory pools into that many different regions. */typedef u_int32_t roff_t;/* * Forward structure declarations, so we can declare pointers and * applications can get type checking. */struct __db; typedef struct __db DB;struct __db_bt_stat; typedef struct __db_bt_stat DB_BTREE_STAT;struct __db_cipher; typedef struct __db_cipher DB_CIPHER;struct __db_dbt; typedef struct __db_dbt DBT;struct __db_env; typedef struct __db_env DB_ENV;struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT;struct __db_ilock; typedef struct __db_ilock DB_LOCK_ILOCK;struct __db_lock_stat; typedef struct __db_lock_stat DB_LOCK_STAT;struct __db_lock_u; typedef struct __db_lock_u DB_LOCK;struct __db_lockreq; typedef struct __db_lockreq DB_LOCKREQ;struct __db_log_cursor; typedef struct __db_log_cursor DB_LOGC;struct __db_log_stat; typedef struct __db_log_stat DB_LOG_STAT;struct __db_lsn; typedef struct __db_lsn DB_LSN;struct __db_mpool; typedef struct __db_mpool DB_MPOOL;struct __db_mpool_fstat;typedef struct __db_mpool_fstat DB_MPOOL_FSTAT;struct __db_mpool_stat; typedef struct __db_mpool_stat DB_MPOOL_STAT;struct __db_mpoolfile; typedef struct __db_mpoolfile DB_MPOOLFILE;struct __db_preplist; typedef struct __db_preplist DB_PREPLIST;struct __db_qam_stat; typedef struct __db_qam_stat DB_QUEUE_STAT;struct __db_rep; typedef struct __db_rep DB_REP;struct __db_rep_stat; typedef struct __db_rep_stat DB_REP_STAT;struct __db_txn; typedef struct __db_txn DB_TXN;struct __db_txn_active; typedef struct __db_txn_active DB_TXN_ACTIVE;struct __db_txn_stat; typedef struct __db_txn_stat DB_TXN_STAT;struct __db_txnmgr; typedef struct __db_txnmgr DB_TXNMGR;struct __dbc; typedef struct __dbc DBC;struct __dbc_internal; typedef struct __dbc_internal DBC_INTERNAL;struct __fh_t; typedef struct __fh_t DB_FH;struct __fname; typedef struct __fname FNAME;struct __key_range; typedef struct __key_range DB_KEY_RANGE;struct __mpoolfile; typedef struct __mpoolfile MPOOLFILE;struct __mutex_t; typedef struct __mutex_t DB_MUTEX;/* Key/data structure -- a Data-Base Thang. */struct __db_dbt { /* * data/size must be fields 1 and 2 for DB 1.85 compatibility. */ void *data; /* Key/data */ u_int32_t size; /* key/data length */ u_int32_t ulen; /* RO: length of user buffer. */ u_int32_t dlen; /* RO: get/put record length. */ u_int32_t doff; /* RO: get/put record offset. */ void *app_private; /* Application-private handle. */#define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */#define DB_DBT_ISSET 0x002 /* Lower level calls set value. */#define DB_DBT_MALLOC 0x004 /* Return in malloc'd memory. */#define DB_DBT_PARTIAL 0x008 /* Partial put/get. */#define DB_DBT_REALLOC 0x010 /* Return in realloc'd memory. */#define DB_DBT_USERMEM 0x020 /* Return in user's memory. */#define DB_DBT_DUPOK 0x040 /* Insert if duplicate. */ u_int32_t flags;};/* * Common flags -- * Interfaces which use any of these common flags should never have * interface specific flags in this range. */#define DB_CREATE 0x000001 /* Create file as necessary. */#define DB_CXX_NO_EXCEPTIONS 0x000002 /* C++: return error values. */#define DB_FORCE 0x000004 /* Force (anything). */#define DB_NOMMAP 0x000008 /* Don't mmap underlying file. */#define DB_RDONLY 0x000010 /* Read-only (O_RDONLY). */#define DB_RECOVER 0x000020 /* Run normal recovery. */#define DB_THREAD 0x000040 /* Applications are threaded. */#define DB_TRUNCATE 0x000080 /* Discard existing DB (O_TRUNC). */#define DB_TXN_NOSYNC 0x000100 /* Do not sync log on commit. */#define DB_USE_ENVIRON 0x000200 /* Use the environment. */#define DB_USE_ENVIRON_ROOT 0x000400 /* Use the environment if root. *//* * Common flags -- * Interfaces which use any of these common flags should never have * interface specific flags in this range. * * DB_AUTO_COMMIT: * DB_ENV->set_flags, DB->associate, DB->del, DB->put, DB->open, * DB->remove, DB->rename, DB->truncate * DB_DIRTY_READ: * DB->cursor, DB->get, DB->join, DB->open, DBcursor->c_get, * DB_ENV->txn_begin * * Shared flags up to 0x000400 */#define DB_AUTO_COMMIT 0x00800000 /* Implied transaction. */#define DB_DIRTY_READ 0x01000000 /* Dirty Read. *//* * Flags private to db_env_create. */#define DB_CLIENT 0x000001 /* Open for a client environment. *//* * Flags private to db_create. */#define DB_XA_CREATE 0x000001 /* Open in an XA environment. *//* * Flags private to DB_ENV->open. * Shared flags up to 0x000400 */#define DB_INIT_CDB 0x000800 /* Concurrent Access Methods. */#define DB_INIT_LOCK 0x001000 /* Initialize locking. */#define DB_INIT_LOG 0x002000 /* Initialize logging. */#define DB_INIT_MPOOL 0x004000 /* Initialize mpool. */#define DB_INIT_TXN 0x008000 /* Initialize transactions. */#define DB_JOINENV 0x010000 /* Initialize all subsystems present. */#define DB_LOCKDOWN 0x020000 /* Lock memory into physical core. */#define DB_PRIVATE 0x040000 /* DB_ENV is process local. */#define DB_RECOVER_FATAL 0x080000 /* Run catastrophic recovery. */#define DB_SYSTEM_MEM 0x100000 /* Use system-backed memory. *//* * Flags private to DB->open. * Shared flags up to 0x000400 */#define DB_EXCL 0x000800 /* Exclusive open (O_EXCL). */#define DB_FCNTL_LOCKING 0x001000 /* UNDOC: fcntl(2) locking. */#define DB_RDWRMASTER 0x002000 /* UNDOC: allow subdb master open R/W */#define DB_WRITEOPEN 0x004000 /* UNDOC: open with write lock. *//* * Flags private to DB_ENV->txn_begin. * Shared flags up to 0x000400 */#define DB_TXN_NOWAIT 0x000800 /* Do not wait for locks in this TXN. */#define DB_TXN_SYNC 0x001000 /* Always sync log on commit. *//* * Flags private to DB_ENV->set_encrypt. */#define DB_ENCRYPT_AES 0x000001 /* AES, assumes SHA1 checksum *//* * Flags private to DB_ENV->set_flags. * Shared flags up to 0x000400 */#define DB_CDB_ALLDB 0x000800 /* Set CDB locking per environment. */#define DB_DIRECT_DB 0x001000 /* Don't buffer databases in the OS. */#define DB_DIRECT_LOG 0x002000 /* Don't buffer log files in the OS. */#define DB_NOLOCKING 0x004000 /* Set locking/mutex behavior. */#define DB_NOPANIC 0x008000 /* Set panic state per DB_ENV. */#define DB_OVERWRITE 0x010000 /* Overwrite unlinked region files. */#define DB_PANIC_ENVIRONMENT 0x020000 /* Set panic state per environment. */#define DB_REGION_INIT 0x040000 /* Page-fault regions on open. */#define DB_TXN_WRITE_NOSYNC 0x080000 /* Write, don't sync, on txn commit. */#define DB_YIELDCPU 0x100000 /* Yield the CPU (a lot). *//* * Flags private to DB->set_feedback's callback. */#define DB_UPGRADE 0x000001 /* Upgrading. */#define DB_VERIFY 0x000002 /* Verifying. *//* * Flags private to DB_MPOOLFILE->open. * Shared flags up to 0x000400 */#define DB_DIRECT 0x000800 /* Don't buffer the file in the OS. */#define DB_EXTENT 0x001000 /* UNDOC: dealing with an extent. */#define DB_ODDFILESIZE 0x002000 /* Truncate file to N * pgsize. *//* * Flags private to DB->set_flags. */#define DB_CHKSUM_SHA1 0x000001 /* Use SHA1 checksumming */#define DB_DUP 0x000002 /* Btree, Hash: duplicate keys. */#define DB_DUPSORT 0x000004 /* Btree, Hash: duplicate keys. */#define DB_ENCRYPT 0x000008 /* Btree, Hash: duplicate keys. */#define DB_RECNUM 0x000010 /* Btree: record numbers. */#define DB_RENUMBER 0x000020 /* Recno: renumber on insert/delete. */#define DB_REVSPLITOFF 0x000040 /* Btree: turn off reverse splits. */#define DB_SNAPSHOT 0x000080 /* Recno: snapshot the input. *//* * Flags private to the DB->stat methods. */#define DB_STAT_CLEAR 0x000001 /* Clear stat after returning values. *//* * Flags private to DB->join. */#define DB_JOIN_NOSORT 0x000001 /* Don't try to optimize join. *//* * Flags private to DB->verify. */#define DB_AGGRESSIVE 0x000001 /* Salvage whatever could be data.*/#define DB_NOORDERCHK 0x000002 /* Skip sort order/hashing check. */#define DB_ORDERCHKONLY 0x000004 /* Only perform the order check. */#define DB_PR_PAGE 0x000008 /* Show page contents (-da). */#define DB_PR_RECOVERYTEST 0x000010 /* Recovery test (-dr). */#define DB_PRINTABLE 0x000020 /* Use printable format for salvage. */#define DB_SALVAGE 0x000040 /* Salvage what looks like data. *//* * !!! * These must not go over 0x8000, or they will collide with the flags * used by __bam_vrfy_subtree. *//* * Flags private to DB->set_rep_transport's send callback. */#define DB_REP_PERMANENT 0x0001 /* Important--app. may want to flush. *//******************************************************* * Locking. *******************************************************/#define DB_LOCKVERSION 1#define DB_FILE_ID_LEN 20 /* Unique file ID length. *//* * Deadlock detector modes; used in the DB_ENV structure to configure the * locking subsystem. */#define DB_LOCK_NORUN 0#define DB_LOCK_DEFAULT 1 /* Default policy. */#define DB_LOCK_EXPIRE 2 /* Only expire locks, no detection. */#define DB_LOCK_MAXLOCKS 3 /* Abort txn with maximum # of locks. */#define DB_LOCK_MINLOCKS 4 /* Abort txn with minimum # of locks. */#define DB_LOCK_MINWRITE 5 /* Abort txn with minimum writelocks. */#define DB_LOCK_OLDEST 6 /* Abort oldest transaction. */#define DB_LOCK_RANDOM 7 /* Abort random transaction. */#define DB_LOCK_YOUNGEST 8 /* Abort youngest transaction. *//* Flag values for lock_vec(), lock_get(). */#define DB_LOCK_FREE_LOCKER 0x001 /* Internal: Free locker as well. */#define DB_LOCK_NOWAIT 0x002 /* Don't wait on unavailable lock. */#define DB_LOCK_RECORD 0x004 /* Internal: record lock. */#define DB_LOCK_REMOVE 0x008 /* Internal: flag object removed. */#define DB_LOCK_SET_TIMEOUT 0x010 /* Internal: set lock timeout. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -