rpm  5.4.10
db_emu.h
Go to the documentation of this file.
1 /*
2  * This file emulates the db3/4 structures
3  * ...this is supposed to be compatible w/ the _real_ db.h!
4  */
5 
6 #ifndef __DB_EMU_H
7 #define __DB_EMU_H
8 
9 struct __db; typedef struct __db DB;
10 struct __db_dbt; typedef struct __db_dbt DBT;
11 struct __db_env; typedef struct __db_env DB_ENV;
12 struct __db_h_stat; typedef struct __db_h_stat DB_HASH_STAT;
13 struct __dbc; typedef struct __dbc DBC;
14 struct __db_sequence; typedef struct __db_sequence DB_SEQUENCE;
15 struct __db_txn; typedef struct __db_txn DB_TXN;
16 
17 struct __db {
18  void *app_private;
19 };
20 
21 struct __db_dbt {
22  void *data;
23  uint32_t size;
24 
25  uint32_t ulen;
26  uint32_t dlen;
27  uint32_t doff;
28 
29  void *app_data;
30 
31 #define DB_DBT_APPMALLOC 0x001 /* Callback allocated memory. */
32 #define DB_DBT_BULK 0x002 /* Internal: Insert if duplicate. */
33 #define DB_DBT_DUPOK 0x004 /* Internal: Insert if duplicate. */
34 #define DB_DBT_ISSET 0x008 /* Lower level calls set value. */
35 #define DB_DBT_MALLOC 0x010 /* Return in malloc'd memory. */
36 #define DB_DBT_MULTIPLE 0x020 /* References multiple records. */
37 #define DB_DBT_PARTIAL 0x040 /* Partial put/get. */
38 #define DB_DBT_REALLOC 0x080 /* Return in realloc'd memory. */
39 #define DB_DBT_READONLY 0x100 /* Readonly, don't update. */
40 #define DB_DBT_STREAMING 0x200 /* Internal: DBT is being streamed. */
41 #define DB_DBT_USERCOPY 0x400 /* Use the user-supplied callback. */
42 #define DB_DBT_USERMEM 0x800 /* Return in user's memory. */
43  uint32_t flags;
44 };
45 
46 struct __db_env {
47  void *app_private;
48  int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, uint32_t);
49  int (*txn_checkpoint) (DB_ENV *, uint32_t, uint32_t, uint32_t);
50 };
51 
52 struct __db_h_stat { /* SHARED */
53  uint32_t hash_magic; /* Magic number. */
54  uint32_t hash_version; /* Version number. */
55  uint32_t hash_metaflags; /* Metadata flags. */
56  uint32_t hash_nkeys; /* Number of unique keys. */
57  uint32_t hash_ndata; /* Number of data items. */
58  uint32_t hash_pagecnt; /* Page count. */
59  uint32_t hash_pagesize; /* Page size. */
60  uint32_t hash_ffactor; /* Fill factor specified at create. */
61  uint32_t hash_buckets; /* Number of hash buckets. */
62  uint32_t hash_free; /* Pages on the free list. */
63  uintmax_t hash_bfree; /* Bytes free on bucket pages. */
64  uint32_t hash_bigpages; /* Number of big key/data pages. */
65  uintmax_t hash_big_bfree; /* Bytes free on big item pages. */
66  uint32_t hash_overflows; /* Number of overflow pages. */
67  uintmax_t hash_ovfl_free; /* Bytes free on ovfl pages. */
68  uint32_t hash_dup; /* Number of dup pages. */
69  uintmax_t hash_dup_free; /* Bytes free on duplicate pages. */
70 };
71 
72 struct __dbc {
73  DB *dbp;
74 };
75 
76 struct __db_txn {
77  int (*abort) (DB_TXN *);
78  int (*commit) (DB_TXN *, uint32_t);
79  int (*get_name) (DB_TXN *, const char **);
80  uint32_t (*id) (DB_TXN *);
81  int (*set_name) (DB_TXN *, const char *);
82 };
83 
84 #define DB_CURRENT 6
85 #define DB_KEYLAST 14
86 #define DB_NEXT 16
87 #define DB_NEXT_DUP 17
88 #define DB_SET 26
89 #define DB_SET_RANGE 27
90 
91 #define DB_WRITECURSOR 0x00000010
92 
93 #define DB_BUFFER_SMALL (-30999)
94 #define DB_NOTFOUND (-30988)
95 
96 #define DB_INIT_TXN 0x00002000
97 #define DB_EXCL 0x0004000
98 #define DB_PRIVATE 0x0200000
99 
100 #define DB_VERSION_MAJOR 3
101 #define DB_VERSION_MINOR 0
102 #define DB_VERSION_PATCH 0
103 
104 /* --- for rpmdb/dbconfig.c tables: */
105 typedef enum {
111  DB_UNKNOWN=5 /* Figure it out on open. */
112 } DBTYPE;
113 #define DB_CREATE 0x00000001
114 #define DB_INIT_LOCK 0x00000100
115 #define DB_INIT_LOG 0x00000200
116 #define DB_INIT_MPOOL 0x00000400
117 #define DB_INIT_TXN 0x00002000
118 #define DB_AUTO_COMMIT 0x00000100
119 #define DB_THREAD 0x00000020
120 #define DB_DUP 0x00000010
121 #define DB_DUPSORT 0x00000002
122 
123 #endif