📄 db.h
字号:
#define DB_REVSPLITOFF 0x0000080 /* Btree: turn off reverse splits. */#define DB_SNAPSHOT 0x0000100 /* Recno: snapshot the input. *//* * Flags private to the DB_ENV->stat_print, DB->stat and DB->stat_print methods. */#define DB_STAT_ALL 0x0000001 /* Print: Everything. */#define DB_STAT_CLEAR 0x0000002 /* Clear stat after returning values. */#define DB_STAT_LOCK_CONF 0x0000004 /* Print: Lock conflict matrix. */#define DB_STAT_LOCK_LOCKERS 0x0000008 /* Print: Lockers. */#define DB_STAT_LOCK_OBJECTS 0x0000010 /* Print: Lock objects. */#define DB_STAT_LOCK_PARAMS 0x0000020 /* Print: Lock parameters. */#define DB_STAT_MEMP_HASH 0x0000040 /* Print: Mpool hash buckets. */#define DB_STAT_SUBSYSTEM 0x0000080 /* Print: Subsystems too. *//* * Flags private to DB->join. */#define DB_JOIN_NOSORT 0x0000001 /* Don't try to optimize join. *//* * Flags private to DB->verify. */#define DB_AGGRESSIVE 0x0000001 /* Salvage whatever could be data.*/#define DB_NOORDERCHK 0x0000002 /* Skip sort order/hashing check. */#define DB_ORDERCHKONLY 0x0000004 /* Only perform the order check. */#define DB_PR_PAGE 0x0000008 /* Show page contents (-da). */#define DB_PR_RECOVERYTEST 0x0000010 /* Recovery test (-dr). */#define DB_PRINTABLE 0x0000020 /* Use printable format for salvage. */#define DB_SALVAGE 0x0000040 /* Salvage what looks like data. */#define DB_UNREF 0x0000080 /* Report unreferenced pages. *//* * !!! * 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_NOBUFFER 0x0000001 /* Do not buffer this message. */#define DB_REP_PERMANENT 0x0000002 /* 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 /* Select locker with max locks. */#define DB_LOCK_MAXWRITE 4 /* Select locker with max writelocks. */#define DB_LOCK_MINLOCKS 5 /* Select locker with min locks. */#define DB_LOCK_MINWRITE 6 /* Select locker with min writelocks. */#define DB_LOCK_OLDEST 7 /* Select oldest locker. */#define DB_LOCK_RANDOM 8 /* Select random locker. */#define DB_LOCK_YOUNGEST 9 /* Select youngest locker. *//* Flag values for lock_vec(), lock_get(). */#define DB_LOCK_ABORT 0x001 /* Internal: Lock during abort. */#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. */#define DB_LOCK_SWITCH 0x020 /* Internal: switch existing lock. */#define DB_LOCK_UPGRADE 0x040 /* Internal: upgrade existing lock. *//* * Simple R/W lock modes and for multi-granularity intention locking. * * !!! * These values are NOT random, as they are used as an index into the lock * conflicts arrays, i.e., DB_LOCK_IWRITE must be == 3, and DB_LOCK_IREAD * must be == 4. */typedef enum { DB_LOCK_NG=0, /* Not granted. */ DB_LOCK_READ=1, /* Shared/read. */ DB_LOCK_WRITE=2, /* Exclusive/write. */ DB_LOCK_WAIT=3, /* Wait for event */ DB_LOCK_IWRITE=4, /* Intent exclusive/write. */ DB_LOCK_IREAD=5, /* Intent to share/read. */ DB_LOCK_IWR=6, /* Intent to read and write. */ DB_LOCK_DIRTY=7, /* Dirty Read. */ DB_LOCK_WWRITE=8 /* Was Written. */} db_lockmode_t;/* * Request types. */typedef enum { DB_LOCK_DUMP=0, /* Display held locks. */ DB_LOCK_GET=1, /* Get the lock. */ DB_LOCK_GET_TIMEOUT=2, /* Get lock with a timeout. */ DB_LOCK_INHERIT=3, /* Pass locks to parent. */ DB_LOCK_PUT=4, /* Release the lock. */ DB_LOCK_PUT_ALL=5, /* Release locker's locks. */ DB_LOCK_PUT_OBJ=6, /* Release locker's locks on obj. */ DB_LOCK_PUT_READ=7, /* Release locker's read locks. */ DB_LOCK_TIMEOUT=8, /* Force a txn to timeout. */ DB_LOCK_TRADE=9, /* Trade locker ids on a lock. */ DB_LOCK_UPGRADE_WRITE=10 /* Upgrade writes for dirty reads. */} db_lockop_t;/* * Status of a lock. */typedef enum { DB_LSTAT_ABORTED=1, /* Lock belongs to an aborted txn. */ DB_LSTAT_EXPIRED=2, /* Lock has expired. */ DB_LSTAT_FREE=3, /* Lock is unallocated. */ DB_LSTAT_HELD=4, /* Lock is currently held. */ DB_LSTAT_NOTEXIST=5, /* Object on which lock was waiting * was removed */ DB_LSTAT_PENDING=6, /* Lock was waiting and has been * promoted; waiting for the owner * to run and upgrade it to held. */ DB_LSTAT_WAITING=7 /* Lock is on the wait queue. */}db_status_t;/* Lock statistics structure. */struct __db_lock_stat { u_int32_t st_id; /* Last allocated locker ID. */ u_int32_t st_cur_maxid; /* Current maximum unused ID. */ u_int32_t st_maxlocks; /* Maximum number of locks in table. */ u_int32_t st_maxlockers; /* Maximum num of lockers in table. */ u_int32_t st_maxobjects; /* Maximum num of objects in table. */ int st_nmodes; /* Number of lock modes. */ u_int32_t st_nlocks; /* Current number of locks. */ u_int32_t st_maxnlocks; /* Maximum number of locks so far. */ u_int32_t st_nlockers; /* Current number of lockers. */ u_int32_t st_maxnlockers; /* Maximum number of lockers so far. */ u_int32_t st_nobjects; /* Current number of objects. */ u_int32_t st_maxnobjects; /* Maximum number of objects so far. */ u_int32_t st_nconflicts; /* Number of lock conflicts. */ u_int32_t st_nrequests; /* Number of lock gets. */ u_int32_t st_nreleases; /* Number of lock puts. */ u_int32_t st_nnowaits; /* Number of requests that would have waited, but NOWAIT was set. */ u_int32_t st_ndeadlocks; /* Number of lock deadlocks. */ db_timeout_t st_locktimeout; /* Lock timeout. */ u_int32_t st_nlocktimeouts; /* Number of lock timeouts. */ db_timeout_t st_txntimeout; /* Transaction timeout. */ u_int32_t st_ntxntimeouts; /* Number of transaction timeouts. */ u_int32_t st_region_wait; /* Region lock granted after wait. */ u_int32_t st_region_nowait; /* Region lock granted without wait. */ roff_t st_regsize; /* Region size. */};/* * DB_LOCK_ILOCK -- * Internal DB access method lock. */struct __db_ilock { db_pgno_t pgno; /* Page being locked. */ u_int8_t fileid[DB_FILE_ID_LEN];/* File id. */#define DB_HANDLE_LOCK 1#define DB_RECORD_LOCK 2#define DB_PAGE_LOCK 3 u_int32_t type; /* Type of lock. */};/* * DB_LOCK -- * The structure is allocated by the caller and filled in during a * lock_get request (or a lock_vec/DB_LOCK_GET). */struct __db_lock_u { roff_t off; /* Offset of the lock in the region */ u_int32_t ndx; /* Index of the object referenced by * this lock; used for locking. */ u_int32_t gen; /* Generation number of this lock. */ db_lockmode_t mode; /* mode of this lock. */};/* Lock request structure. */struct __db_lockreq { db_lockop_t op; /* Operation. */ db_lockmode_t mode; /* Requested mode. */ db_timeout_t timeout; /* Time to expire lock. */ DBT *obj; /* Object being locked. */ DB_LOCK lock; /* Lock returned. */};/******************************************************* * Logging. *******************************************************/#define DB_LOGVERSION 10 /* Current log version. */#define DB_LOGOLDVER 10 /* Oldest log version supported. */#define DB_LOGMAGIC 0x040988/* Flag values for DB_ENV->log_archive(). */#define DB_ARCH_ABS 0x001 /* Absolute pathnames. */#define DB_ARCH_DATA 0x002 /* Data files. */#define DB_ARCH_LOG 0x004 /* Log files. */#define DB_ARCH_REMOVE 0x008 /* Remove log files. *//* Flag values for DB_ENV->log_put(). */#define DB_FLUSH 0x001 /* Flush data to disk (public). */#define DB_LOG_CHKPNT 0x002 /* Flush supports a checkpoint */#define DB_LOG_COMMIT 0x004 /* Flush supports a commit */#define DB_LOG_NOCOPY 0x008 /* Don't copy data */#define DB_LOG_NOT_DURABLE 0x010 /* Do not log; keep in memory */#define DB_LOG_PERM 0x020 /* Flag record with REP_PERMANENT */#define DB_LOG_RESEND 0x040 /* Resent log record */#define DB_LOG_WRNOSYNC 0x080 /* Write, don't sync log_put *//* * A DB_LSN has two parts, a fileid which identifies a specific file, and an * offset within that file. The fileid is an unsigned 4-byte quantity that * uniquely identifies a file within the log directory -- currently a simple * counter inside the log. The offset is also an unsigned 4-byte value. The * log manager guarantees the offset is never more than 4 bytes by switching * to a new log file before the maximum length imposed by an unsigned 4-byte * offset is reached. */struct __db_lsn { u_int32_t file; /* File ID. */ u_int32_t offset; /* File offset. */};/* * Application-specified log record types start at DB_user_BEGIN, and must not * equal or exceed DB_debug_FLAG. * * DB_debug_FLAG is the high-bit of the u_int32_t that specifies a log record * type. If the flag is set, it's a log record that was logged for debugging * purposes only, even if it reflects a database change -- the change was part * of a non-durable transaction. */#define DB_user_BEGIN 10000#define DB_debug_FLAG 0x80000000/* * DB_LOGC -- * Log cursor. */struct __db_log_cursor { DB_ENV *dbenv; /* Enclosing dbenv. */ DB_FH *c_fhp; /* File handle. */ DB_LSN c_lsn; /* Cursor: LSN */ u_int32_t c_len; /* Cursor: record length */ u_int32_t c_prev; /* Cursor: previous record's offset */ DBT c_dbt; /* Return DBT. */#define DB_LOGC_BUF_SIZE (32 * 1024) u_int8_t *bp; /* Allocated read buffer. */ u_int32_t bp_size; /* Read buffer length in bytes. */ u_int32_t bp_rlen; /* Read buffer valid data length. */ DB_LSN bp_lsn; /* Read buffer first byte LSN. */ u_int32_t bp_maxrec; /* Max record length in the log file. */ /* Methods. */ int (*close) __P((DB_LOGC *, u_int32_t)); int (*get) __P((DB_LOGC *, DB_LSN *, DBT *, u_int32_t));#define DB_LOG_DISK 0x01 /* Log record came from disk. */#define DB_LOG_LOCKED 0x02 /* Log region already locked */#define DB_LOG_SILENT_ERR 0x04 /* Turn-off error messages. */ u_int32_t flags;};/* Log statistics structure. */struct __db_log_stat { u_int32_t st_magic; /* Log file magic number. */ u_int32_t st_version; /* Log file version number. */ int st_mode; /* Log file mode. */ u_int32_t st_lg_bsize; /* Log buffer size. */ u_int32_t st_lg_size; /* Log file size. */ u_int32_t st_w_bytes; /* Bytes to log. */ u_int32_t st_w_mbytes; /* Megabytes to log. */ u_int32_t st_wc_bytes; /* Bytes to log since checkpoint. */ u_int32_t st_wc_mbytes; /* Megabytes to log since checkpoint. */ u_int32_t st_wcount; /* Total writes to the log. */ u_int32_t st_wcount_fill; /* Overflow writes to the log. */ u_int32_t st_scount; /* Total syncs to the log. */ 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_cur_file; /* Current log file number. */ u_int32_t st_cur_offset; /* Current log file offset. */ u_int32_t st_disk_file; /* Known on disk log file number. */ u_int32_t st_disk_offset; /* Known on disk log file offset. */ roff_t st_regsize; /* Region size. */ u_int32_t st_maxcommitperflush; /* Max number of commits in a flush. */ u_int32_t st_mincommitperflush; /* Min number of commits in a flush. */};/* * We need to record the first log record of a transaction. * For user defined logging this macro returns the place to * put that information, if it is need in rlsnp, otherwise it * leaves it unchanged. */#define DB_SET_BEGIN_LSNP(txn, rlsnp) ((txn)->set_begin_lsnp(txn, rlsnp))/******************************************************* * Shared buffer cache (mpool). *******************************************************//* Flag values for DB_MPOOLFILE->get. */#define DB_MPOOL_CREATE 0x001 /* Create a page. */#define DB_MPOOL_LAST 0x002 /* Return the last page. */#define DB_MPOOL_NEW 0x004 /* Create a new page. *//* Flag values for DB_MPOOLFILE->put, DB_MPOOLFILE->set. */#define DB_MPOOL_CLEAN 0x001 /* Page is not modified. */#define DB_MPOOL_DIRTY 0x002 /* Page is modified. */#define DB_MPOOL_DISCARD 0x004 /* Don't cache the page. */#define DB_MPOOL_FREE 0x008 /* Free page if present. *//* Flags values for DB_MPOOLFILE->set_flags. */#define DB_MPOOL_NOFILE 0x001 /* Never open a backing file. */#define DB_MPOOL_UNLINK 0x002 /* Unlink the file on last close. *//* Priority values for DB_MPOOLFILE->set_priority. */typedef enum { DB_PRIORITY_VERY_LOW=1, DB_PRIORITY_LOW=2, DB_PRIORITY_DEFAULT=3, DB_PRIORITY_HIGH=4, DB_PRIORITY_VERY_HIGH=5} DB_CACHE_PRIORITY;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -