📄 db.in
字号:
u_int32_t st_alloc_max_pages; /* Max checked during allocation. */};/* Mpool file statistics structure. */struct __db_mpool_fstat { char *file_name; /* File name. */ size_t st_pagesize; /* Page size. */ u_int32_t st_map; /* Pages from mapped files. */ u_int32_t st_cache_hit; /* Pages found in the cache. */ u_int32_t st_cache_miss; /* Pages not found in the cache. */ u_int32_t st_page_create; /* Pages created in the cache. */ u_int32_t st_page_in; /* Pages read in. */ u_int32_t st_page_out; /* Pages written out. */};/******************************************************* * Transactions and recovery. *******************************************************/#define DB_TXNVERSION 1typedef enum { DB_TXN_ABORT=0, /* Public. */ DB_TXN_APPLY=1, /* Public. */ DB_TXN_BACKWARD_ALLOC=2, /* Internal. */ DB_TXN_BACKWARD_ROLL=3, /* Public. */ DB_TXN_FORWARD_ROLL=4, /* Public. */ DB_TXN_GETPGNOS=5, /* Internal. */ DB_TXN_OPENFILES=6, /* Internal. */ DB_TXN_POPENFILES=7, /* Internal. */ DB_TXN_PRINT=8 /* Public. */} db_recops;/* * BACKWARD_ALLOC is used during the forward pass to pick up any aborted * allocations for files that were created during the forward pass. * The main difference between _ALLOC and _ROLL is that the entry for * the file not exist during the rollforward pass. */#define DB_UNDO(op) ((op) == DB_TXN_ABORT || \ (op) == DB_TXN_BACKWARD_ROLL || (op) == DB_TXN_BACKWARD_ALLOC)#define DB_REDO(op) ((op) == DB_TXN_FORWARD_ROLL || (op) == DB_TXN_APPLY)struct __db_txn { DB_TXNMGR *mgrp; /* Pointer to transaction manager. */ DB_TXN *parent; /* Pointer to transaction's parent. */ DB_LSN last_lsn; /* Lsn of last log write. */ u_int32_t txnid; /* Unique transaction id. */ roff_t off; /* Detail structure within region. */ db_timeout_t lock_timeout; /* Timeout for locks for this txn. */ db_timeout_t expire; /* Time this txn expires. */ void *txn_list; /* Undo information for parent. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) links; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } links; /* Links transactions off manager. */ /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__events, __txn_event) events; */ struct { struct __txn_event *tqh_first; struct __txn_event **tqh_last; } events; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_HEAD(__kids, __db_txn) kids; */ struct __kids { struct __db_txn *tqh_first; struct __db_txn **tqh_last; } kids; /* * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__db_txn) klinks; */ struct { struct __db_txn *tqe_next; struct __db_txn **tqe_prev; } klinks; /* API-private structure: used by C++ */ void *api_internal; u_int32_t cursors; /* Number of cursors open for txn */ /* Methods. */ int (*abort) __P((DB_TXN *)); int (*commit) __P((DB_TXN *, u_int32_t)); int (*discard) __P((DB_TXN *, u_int32_t)); u_int32_t (*id) __P((DB_TXN *)); int (*prepare) __P((DB_TXN *, u_int8_t *)); int (*set_timeout) __P((DB_TXN *, db_timeout_t, u_int32_t));#define TXN_CHILDCOMMIT 0x01 /* Transaction that has committed. */#define TXN_COMPENSATE 0x02 /* Compensating transaction. */#define TXN_DIRTY_READ 0x04 /* Transaction does dirty reads. */#define TXN_LOCKTIMEOUT 0x08 /* Transaction has a lock timeout. */#define TXN_MALLOC 0x10 /* Structure allocated by TXN system. */#define TXN_NOSYNC 0x20 /* Do not sync on prepare and commit. */#define TXN_NOWAIT 0x40 /* Do not wait on locks. */#define TXN_SYNC 0x80 /* Sync on prepare and commit. */ u_int32_t flags;};/* Transaction statistics structure. */struct __db_txn_active { u_int32_t txnid; /* Transaction ID */ u_int32_t parentid; /* Transaction ID of parent */ DB_LSN lsn; /* LSN when transaction began */};struct __db_txn_stat { DB_LSN st_last_ckp; /* lsn of the last checkpoint */ time_t st_time_ckp; /* time of last checkpoint */ u_int32_t st_last_txnid; /* last transaction id given out */ u_int32_t st_maxtxns; /* maximum txns possible */ u_int32_t st_naborts; /* number of aborted transactions */ u_int32_t st_nbegins; /* number of begun transactions */ u_int32_t st_ncommits; /* number of committed transactions */ u_int32_t st_nactive; /* number of active transactions */ u_int32_t st_nrestores; /* number of restored transactions after recovery. */ u_int32_t st_maxnactive; /* maximum active transactions */ DB_TXN_ACTIVE *st_txnarray; /* array of active transactions */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ u_int32_t st_regsize; /* Region size. */};/* * Structure used for two phase commit interface. Berkeley DB support for two * phase commit is compatible with the X/open XA interface. The xa #define * XIDDATASIZE defines the size of a global transaction ID. We have our own * version here which must have the same value. */#define DB_XIDDATASIZE 128struct __db_preplist { DB_TXN *txn; u_int8_t gid[DB_XIDDATASIZE];};/******************************************************* * Replication. *******************************************************//* Special, out-of-band environment IDs. */#define DB_EID_BROADCAST -1#define DB_EID_INVALID -2/* rep_start flags values */#define DB_REP_CLIENT 0x001#define DB_REP_LOGSONLY 0x002#define DB_REP_MASTER 0x004/* Replication statistics. */struct __db_rep_stat { /* !!! * Many replication statistics fields cannot be protected by a mutex * without an unacceptable performance penalty, since most message * processing is done without the need to hold a region-wide lock. * Fields whose comments end with a '+' may be updated without holding * the replication or log mutexes (as appropriate), and thus may be * off somewhat (or, on unreasonable architectures under unlucky * circumstances, garbaged). */ u_int32_t st_status; /* Current replication status. */ DB_LSN st_next_lsn; /* Next LSN to use or expect. */ DB_LSN st_waiting_lsn; /* LSN we're awaiting, if any. */ u_int32_t st_dupmasters; /* # of times a duplicate master condition was detected.+ */ int st_env_id; /* Current environment ID. */ int st_env_priority; /* Current environment priority. */ u_int32_t st_gen; /* Current generation number. */ u_int32_t st_log_duplicated; /* Log records received multiply.+ */ u_int32_t st_log_queued; /* Log records currently queued.+ */ u_int32_t st_log_queued_max; /* Max. log records queued at once.+ */ u_int32_t st_log_queued_total; /* Total # of log recs. ever queued.+ */ u_int32_t st_log_records; /* Log records received and put.+ */ u_int32_t st_log_requested; /* Log recs. missed and requested.+ */ int st_master; /* Env. ID of the current master. */ u_int32_t st_master_changes; /* # of times we've switched masters. */ u_int32_t st_msgs_badgen; /* Messages with a bad generation #.+ */ u_int32_t st_msgs_processed; /* Messages received and processed.+ */ u_int32_t st_msgs_recover; /* Messages ignored because this site was a client in recovery.+ */ u_int32_t st_msgs_send_failures;/* # of failed message sends.+ */ u_int32_t st_msgs_sent; /* # of successful message sends.+ */ u_int32_t st_newsites; /* # of NEWSITE msgs. received.+ */ int st_nsites; /* Current number of sites we will assume during elections. */ u_int32_t st_nthrottles; /* # of times we were throttled. */ u_int32_t st_outdated; /* # of times we detected and returned an OUTDATED condition.+ */ u_int32_t st_txns_applied; /* # of transactions applied.+ */ /* Elections generally. */ u_int32_t st_elections; /* # of elections held.+ */ u_int32_t st_elections_won; /* # of elections won by this site.+ */ /* Statistics about an in-progress election. */ int st_election_cur_winner; /* Current front-runner. */ u_int32_t st_election_gen; /* Election generation number. */ DB_LSN st_election_lsn; /* Max. LSN of current winner. */ int st_election_nsites; /* # of "registered voters". */ int st_election_priority; /* Current election priority. */ int st_election_status; /* Current election status. */ int st_election_tiebreaker; /* Election tiebreaker value. */ int st_election_votes; /* Votes received in this round. */};/******************************************************* * Access methods. *******************************************************/typedef enum { DB_BTREE=1, DB_HASH=2, DB_RECNO=3, DB_QUEUE=4, DB_UNKNOWN=5 /* Figure it out on open. */} DBTYPE;#define DB_RENAMEMAGIC 0x030800 /* File has been renamed. */#define DB_BTREEVERSION 9 /* Current btree version. */#define DB_BTREEOLDVER 8 /* Oldest btree version supported. */#define DB_BTREEMAGIC 0x053162#define DB_HASHVERSION 8 /* Current hash version. */#define DB_HASHOLDVER 7 /* Oldest hash version supported. */#define DB_HASHMAGIC 0x061561#define DB_QAMVERSION 4 /* Current queue version. */#define DB_QAMOLDVER 3 /* Oldest queue version supported. */#define DB_QAMMAGIC 0x042253/* * DB access method and cursor operation values. Each value is an operation * code to which additional bit flags are added. */#define DB_AFTER 1 /* c_put() */#define DB_APPEND 2 /* put() */#define DB_BEFORE 3 /* c_put() */#define DB_CACHED_COUNTS 4 /* stat() */#define DB_COMMIT 5 /* log_put() (internal) */#define DB_CONSUME 6 /* get() */#define DB_CONSUME_WAIT 7 /* get() */#define DB_CURRENT 8 /* c_get(), c_put(), DB_LOGC->get() */#define DB_FAST_STAT 9 /* stat() */#define DB_FIRST 10 /* c_get(), DB_LOGC->get() */#define DB_GET_BOTH 11 /* get(), c_get() */#define DB_GET_BOTHC 12 /* c_get() (internal) */#define DB_GET_BOTH_RANGE 13 /* get(), c_get() */#define DB_GET_RECNO 14 /* c_get() */#define DB_JOIN_ITEM 15 /* c_get(); do not do primary lookup */#define DB_KEYFIRST 16 /* c_put() */#define DB_KEYLAST 17 /* c_put() */#define DB_LAST 18 /* c_get(), DB_LOGC->get() */#define DB_NEXT 19 /* c_get(), DB_LOGC->get() */#define DB_NEXT_DUP 20 /* c_get() */#define DB_NEXT_NODUP 21 /* c_get() */#define DB_NODUPDATA 22 /* put(), c_put() */#define DB_NOOVERWRITE 23 /* put() */#define DB_NOSYNC 24 /* close() */#define DB_POSITION 25 /* c_dup() */#define DB_POSITIONI 26 /* c_dup() (internal) */#define DB_PREV 27 /* c_get(), DB_LOGC->get() */#define DB_PREV_NODUP 28 /* c_get(), DB_LOGC->get() */#define DB_RECORDCOUNT 29 /* stat() */#define DB_SET 30 /* c_get(), DB_LOGC->get() */#define DB_SET_LOCK_TIMEOUT 31 /* set_timout() */#define DB_SET_RANGE 32 /* c_get() */#define DB_SET_RECNO 33 /* get(), c_get() */#define DB_SET_TXN_NOW 34 /* set_timout() (internal) */#define DB_SET_TXN_TIMEOUT 35 /* set_timout() */#define DB_UPDATE_SECONDARY 36 /* c_get(), c_del() (internal) */#define DB_WRITECURSOR 37 /* cursor() */#define DB_WRITELOCK 38 /* cursor() (internal) *//* This has to change when the max opcode hits 255. */#define DB_OPFLAGS_MASK 0x000000ff /* Mask for operations flags. *//* DB_DIRTY_READ 0x01000000 Dirty Read. */#define DB_FLUSH 0x02000000 /* Flush data to disk. */#define DB_MULTIPLE 0x04000000 /* Return multiple data values. */#define DB_MULTIPLE_KEY 0x08000000 /* Return multiple data/key pairs. */#define DB_NOCOPY 0x10000000 /* Don't copy data */#define DB_PERMANENT 0x20000000 /* Flag record with REP_PERMANENT. */#define DB_RMW 0x40000000 /* Acquire write flag immediately. */#define DB_WRNOSYNC 0x80000000 /* Private: write, don't sync log_put *//* * DB (user visible) error return codes. * * !!! * For source compatibility with DB 2.X deadlock return (EAGAIN), use the * following: * #include <errno.h> * #define DB_LOCK_DEADLOCK EAGAIN * * !!! * We don't want our error returns to conflict with other packages where * possible, so pick a base error value that's hopefully not common. We * document that we own the error name space from -30,800 to -30,999. *//* DB (public) error return codes. */#define DB_DONOTINDEX (-30999)/* "Null" return from 2ndary callbk. */#define DB_KEYEMPTY (-30998)/* Key/data deleted or never created. */#define DB_KEYEXIST (-30997)/* The key/data pair already exists. */#define DB_LOCK_DEADLOCK (-30996)/* Deadlock. */#define DB_LOCK_NOTGRANTED (-30995)/* Lock unavailable. */#define DB_NOSERVER (-30994)/* Server panic return. */#define DB_NOSERVER_HOME (-30993)/* Bad home sent to server. */#define DB_NOSERVER_ID (-30992)/* Bad ID sent to server. */#define DB_NOTFOUND (-30991)/* Key/data pair not found (EOF). */#define DB_OLD_VERSION (-30990)/* Out-of-date version. */#define DB_PAGE_NOTFOUND (-30989)/* Requested page not found. */#define DB_REP_DUPMASTER (-30988)/* There are two masters. */#define DB_REP_HOLDELECTION (-30987)/* Time to hold an election. */#define DB_REP_NEWMASTER (-30986)/* We have learned of a new master. */#define DB_REP_NEWSITE (-30985)/* New site entered system. */#define DB_REP_OUTDATED (-30984)/* Site is too far behind master. */#define DB_REP_UNAVAIL (-30983)/* Site cannot currently be reached. */#define DB_RUNRECOVERY (-30982)/* Panic return. */#define DB_SECONDARY_BAD (-30981)/* Secondary index corrupt. */#define DB_VERIFY_BAD (-30980)/* Verify failed; bad format. *//* DB (private) error return codes. */#define DB_ALREADY_ABORTED (-30899)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -