📄 db.h
字号:
*/ struct __cq_fq { struct __dbc *tqh_first; struct __dbc **tqh_last; } free_queue; struct __cq_aq { struct __dbc *tqh_first; struct __dbc **tqh_last; } active_queue; struct __cq_jq { struct __dbc *tqh_first; struct __dbc **tqh_last; } join_queue; /* * Secondary index support. * * Linked list of secondary indices -- set in the primary. * * !!! * Explicit representations of structures from queue.h. * LIST_HEAD(s_secondaries, __db); */ struct { struct __db *lh_first; } s_secondaries; /* * List entries for secondaries, and reference count of how * many threads are updating this secondary (see __db_c_put). * * !!! * Note that these are synchronized by the primary's mutex, but * filled in in the secondaries. * * !!! * Explicit representations of structures from queue.h. * LIST_ENTRY(__db) s_links; */ struct { struct __db *le_next; struct __db **le_prev; } s_links; u_int32_t s_refcnt; /* Secondary callback and free functions -- set in the secondary. */ int (*s_callback) __P((DB *, const DBT *, const DBT *, DBT *)); /* Reference to primary -- set in the secondary. */ DB *s_primary; /* API-private structure: used by DB 1.85, C++, Java, Perl and Tcl */ void *api_internal; /* Subsystem-private structure. */ void *bt_internal; /* Btree/Recno access method. */ void *h_internal; /* Hash access method. */ void *q_internal; /* Queue access method. */ void *xa_internal; /* XA. */ /* Methods. */ int (*associate) __P((DB *, DB_TXN *, DB *, int (*)(DB *, const DBT *, const DBT *, DBT *), u_int32_t)); int (*close) __P((DB *, u_int32_t)); int (*cursor) __P((DB *, DB_TXN *, DBC **, u_int32_t)); int (*del) __P((DB *, DB_TXN *, DBT *, u_int32_t)); int (*dump) __P((DB *, const char *, int (*)(void *, const void *), void *, int, int)); void (*err) __P((DB *, int, const char *, ...)); void (*errx) __P((DB *, const char *, ...)); int (*fd) __P((DB *, int *)); int (*get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*pget) __P((DB *, DB_TXN *, DBT *, DBT *, DBT *, u_int32_t)); int (*get_byteswapped) __P((DB *, int *)); int (*get_cachesize) __P((DB *, u_int32_t *, u_int32_t *, int *)); int (*get_dbname) __P((DB *, const char **, const char **)); int (*get_encrypt_flags) __P((DB *, u_int32_t *)); DB_ENV *(*get_env) __P((DB *)); void (*get_errfile) __P((DB *, FILE **)); void (*get_errpfx) __P((DB *, const char **)); int (*get_flags) __P((DB *, u_int32_t *)); int (*get_lorder) __P((DB *, int *)); int (*get_open_flags) __P((DB *, u_int32_t *)); int (*get_pagesize) __P((DB *, u_int32_t *)); int (*get_transactional) __P((DB *)); int (*get_type) __P((DB *, DBTYPE *)); int (*join) __P((DB *, DBC **, DBC **, u_int32_t)); int (*key_range) __P((DB *, DB_TXN *, DBT *, DB_KEY_RANGE *, u_int32_t)); int (*open) __P((DB *, DB_TXN *, const char *, const char *, DBTYPE, u_int32_t, int)); int (*put) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*remove) __P((DB *, const char *, const char *, u_int32_t)); int (*rename) __P((DB *, const char *, const char *, const char *, u_int32_t)); int (*truncate) __P((DB *, DB_TXN *, u_int32_t *, u_int32_t)); int (*set_append_recno) __P((DB *, int (*)(DB *, DBT *, db_recno_t))); int (*set_alloc) __P((DB *, void *(*)(size_t), void *(*)(void *, size_t), void (*)(void *))); int (*set_cachesize) __P((DB *, u_int32_t, u_int32_t, int)); int (*set_dup_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_encrypt) __P((DB *, const char *, u_int32_t)); void (*set_errcall) __P((DB *, void (*)(const DB_ENV *, const char *, const char *))); void (*set_errfile) __P((DB *, FILE *)); void (*set_errpfx) __P((DB *, const char *)); int (*set_feedback) __P((DB *, void (*)(DB *, int, int))); int (*set_flags) __P((DB *, u_int32_t)); int (*set_lorder) __P((DB *, int)); void (*set_msgcall) __P((DB *, void (*)(const DB_ENV *, const char *))); void (*get_msgfile) __P((DB *, FILE **)); void (*set_msgfile) __P((DB *, FILE *)); int (*set_pagesize) __P((DB *, u_int32_t)); int (*set_paniccall) __P((DB *, void (*)(DB_ENV *, int))); int (*stat) __P((DB *, DB_TXN *, void *, u_int32_t)); int (*stat_print) __P((DB *, u_int32_t)); int (*sync) __P((DB *, u_int32_t)); int (*upgrade) __P((DB *, const char *, u_int32_t)); int (*verify) __P((DB *, const char *, const char *, FILE *, u_int32_t)); int (*get_bt_minkey) __P((DB *, u_int32_t *)); int (*set_bt_compare) __P((DB *, int (*)(DB *, const DBT *, const DBT *))); int (*set_bt_maxkey) __P((DB *, u_int32_t)); int (*set_bt_minkey) __P((DB *, u_int32_t)); int (*set_bt_prefix) __P((DB *, size_t (*)(DB *, const DBT *, const DBT *))); int (*get_h_ffactor) __P((DB *, u_int32_t *)); int (*get_h_nelem) __P((DB *, u_int32_t *)); int (*set_h_ffactor) __P((DB *, u_int32_t)); int (*set_h_hash) __P((DB *, u_int32_t (*)(DB *, const void *, u_int32_t))); int (*set_h_nelem) __P((DB *, u_int32_t)); int (*get_re_delim) __P((DB *, int *)); int (*get_re_len) __P((DB *, u_int32_t *)); int (*get_re_pad) __P((DB *, int *)); int (*get_re_source) __P((DB *, const char **)); int (*set_re_delim) __P((DB *, int)); int (*set_re_len) __P((DB *, u_int32_t)); int (*set_re_pad) __P((DB *, int)); int (*set_re_source) __P((DB *, const char *)); int (*get_q_extentsize) __P((DB *, u_int32_t *)); int (*set_q_extentsize) __P((DB *, u_int32_t)); int (*db_am_remove) __P((DB *, DB_TXN *, const char *, const char *)); int (*db_am_rename) __P((DB *, DB_TXN *, const char *, const char *, const char *)); /* * Never called; these are a place to save function pointers * so that we can undo an associate. */ int (*stored_get) __P((DB *, DB_TXN *, DBT *, DBT *, u_int32_t)); int (*stored_close) __P((DB *, u_int32_t));#define DB_OK_BTREE 0x01#define DB_OK_HASH 0x02#define DB_OK_QUEUE 0x04#define DB_OK_RECNO 0x08 u_int32_t am_ok; /* Legal AM choices. */#define DB_AM_CHKSUM 0x00000001 /* Checksumming. */#define DB_AM_CL_WRITER 0x00000002 /* Allow writes in client replica. */#define DB_AM_COMPENSATE 0x00000004 /* Created by compensating txn. */#define DB_AM_CREATED 0x00000008 /* Database was created upon open. */#define DB_AM_CREATED_MSTR 0x00000010 /* Encompassing file was created. */#define DB_AM_DBM_ERROR 0x00000020 /* Error in DBM/NDBM database. */#define DB_AM_DELIMITER 0x00000040 /* Variable length delimiter set. */#define DB_AM_DIRTY 0x00000080 /* Support Dirty Reads. */#define DB_AM_DISCARD 0x00000100 /* Discard any cached pages. */#define DB_AM_DUP 0x00000200 /* DB_DUP. */#define DB_AM_DUPSORT 0x00000400 /* DB_DUPSORT. */#define DB_AM_ENCRYPT 0x00000800 /* Encryption. */#define DB_AM_FIXEDLEN 0x00001000 /* Fixed-length records. */#define DB_AM_INMEM 0x00002000 /* In-memory; no sync on close. */#define DB_AM_INORDER 0x00004000 /* DB_INORDER. */#define DB_AM_IN_RENAME 0x00008000 /* File is being renamed. */#define DB_AM_NOT_DURABLE 0x00010000 /* Do not log changes. */#define DB_AM_OPEN_CALLED 0x00020000 /* DB->open called. */#define DB_AM_PAD 0x00040000 /* Fixed-length record pad. */#define DB_AM_PGDEF 0x00080000 /* Page size was defaulted. */#define DB_AM_RDONLY 0x00100000 /* Database is readonly. */#define DB_AM_RECNUM 0x00200000 /* DB_RECNUM. */#define DB_AM_RECOVER 0x00400000 /* DB opened by recovery routine. */#define DB_AM_RENUMBER 0x00800000 /* DB_RENUMBER. */#define DB_AM_REPLICATION 0x01000000 /* An internal replication file. */#define DB_AM_REVSPLITOFF 0x02000000 /* DB_REVSPLITOFF. */#define DB_AM_SECONDARY 0x04000000 /* Database is a secondary index. */#define DB_AM_SNAPSHOT 0x08000000 /* DB_SNAPSHOT. */#define DB_AM_SUBDB 0x10000000 /* Subdatabases supported. */#define DB_AM_SWAP 0x20000000 /* Pages need to be byte-swapped. */#define DB_AM_TXN 0x40000000 /* Opened in a transaction. */#define DB_AM_VERIFYING 0x80000000 /* DB handle is in the verifier. */ u_int32_t orig_flags; /* Flags at open, for refresh. */ u_int32_t flags;};/* * Macros for bulk get. These are only intended for the C API. * For C++, use DbMultiple*Iterator. */#define DB_MULTIPLE_INIT(pointer, dbt) \ (pointer = (u_int8_t *)(dbt)->data + \ (dbt)->ulen - sizeof(u_int32_t))#define DB_MULTIPLE_NEXT(pointer, dbt, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ retdata = NULL; \ pointer = NULL; \ break; \ } \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ if (retdlen == 0 && \ retdata == (u_int8_t *)(dbt)->data) \ retdata = NULL; \ } while (0)#define DB_MULTIPLE_KEY_NEXT(pointer, dbt, retkey, retklen, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)-1) { \ retdata = NULL; \ retkey = NULL; \ pointer = NULL; \ break; \ } \ retkey = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retklen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ } while (0)#define DB_MULTIPLE_RECNO_NEXT(pointer, dbt, recno, retdata, retdlen) \ do { \ if (*((u_int32_t *)(pointer)) == (u_int32_t)0) { \ recno = 0; \ retdata = NULL; \ pointer = NULL; \ break; \ } \ recno = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdata = (u_int8_t *) \ (dbt)->data + *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ retdlen = *(u_int32_t *)(pointer); \ (pointer) = (u_int32_t *)(pointer) - 1; \ } while (0)/******************************************************* * Access method cursors. *******************************************************/struct __dbc { DB *dbp; /* Related DB access method. */ DB_TXN *txn; /* Associated transaction. */ /* * Active/free cursor queues. * * !!! * Explicit representations of structures from queue.h. * TAILQ_ENTRY(__dbc) links; */ struct { DBC *tqe_next; DBC **tqe_prev; } links; /* * The DBT *'s below are used by the cursor routines to return * data to the user when DBT flags indicate that DB should manage * the returned memory. They point at a DBT containing the buffer * and length that will be used, and "belonging" to the handle that * should "own" this memory. This may be a "my_*" field of this * cursor--the default--or it may be the corresponding field of * another cursor, a DB handle, a join cursor, etc. In general, it * will be whatever handle the user originally used for the current * DB interface call. */ DBT *rskey; /* Returned secondary key. */ DBT *rkey; /* Returned [primary] key. */ DBT *rdata; /* Returned data. */ DBT my_rskey; /* Space for returned secondary key. */ DBT my_rkey; /* Space for returned [primary] key. */ DBT my_rdata; /* Space for returned data. */ u_int32_t lid; /* Default process' locker id. */ u_int32_t locker; /* Locker for this operation. */ DBT lock_dbt; /* DBT referencing lock. */ DB_LOCK_ILOCK lock; /* Object to be locked. */ DB_LOCK mylock; /* CDB lock held on this cursor. */ u_int cl_id; /* Remote client id. */ DBTYPE dbtype; /* Cursor type. */ DBC_INTERNAL *internal; /* Access method private. */ int (*c_close) __P((DBC *)); /* Methods: public. */ int (*c_count) __P((DBC *, db_recno_t *, u_int32_t)); int (*c_del) __P((DBC *, u_int32_t)); int (*c_dup) __P((DBC *, DBC **, u_int32_t)); int (*c_get) __P((DBC *, DBT *, DBT *, u_int32_t)); int (*c_pget) __P((DBC *, DBT *, DBT *, DBT *, u_int32_t)); int (*c_put) __P((DBC *, DBT *, DBT *, u_int32_t)); /* Methods: private. */ int (*c_am_bulk) __P((DBC *, DBT *, u_int32_t)); int (*c_am_close) __P((DBC *, db_pgno_t, int *)); int (*c_am_del) __P((DBC *)); int (*c_am_destroy) __P((DBC *)); int (*c_am_get) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*c_am_put) __P((DBC *, DBT *, DBT *, u_int32_t, db_pgno_t *)); int (*c_am_writelock) __P((DBC *));#define DBC_ACTIVE 0x0001 /* Cursor in use. */#define DBC_COMPENSATE 0x0002 /* Cursor compensating, don't lock. */#define
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -