Debian Codegraph @

servers/slapd/back-wt/back-wt.h

raw
1 /* OpenLDAP WiredTiger backend */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 *
5 * Copyright 2002-2024 The OpenLDAP Foundation.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
10 * Public License.
11 *
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
15 */
16 /* ACKNOWLEDGEMENTS:
17 * This work was developed by HAMANO Tsukasa <[email protected]>
18 * based on back-bdb for inclusion in OpenLDAP Software.
19 * WiredTiger is a product of MongoDB Inc.
20 */
21
22 #ifndef _BACK_WT_H_
23 #define _BACK_WT_H_
24
25 #include <portable.h>
26
27 #include <ac/errno.h>
28 #include <sys/stat.h>
29
30 #include "slap.h"
31 #include "wiredtiger.h"
32
33 /* The default search IDL stack cache depth */
34 #define DEFAULT_SEARCH_STACK_DEPTH 16
35
36 #define WT_CONFIG_MAX 2048
37
38 struct wt_info {
39 WT_CONNECTION *wi_conn;
40 WT_CONNECTION *wi_cache;
41 char *wi_home;
42 char *wi_config;
43 ID wi_lastid;
44
45 slap_mask_t wi_defaultmask;
46 int wi_nattrs;
47 struct wt_attrinfo **wi_attrs;
48 void *wi_search_stack;
49 int wi_search_stack_depth;
50
51 struct re_s *wi_index_task;
52
53 int wi_flags;
54 #define WT_IS_OPEN 0x01
55 #define WT_OPEN_INDEX 0x02
56 #define WT_DEL_INDEX 0x08
57 #define WT_RE_OPEN 0x10
58 #define WT_NEED_UPGRADE 0x20
59 #define WT_USE_IDLCACHE 0x40
60 };
61
62 #define WT_TABLE_ID2ENTRY "table:id2entry"
63 #define WT_TABLE_DN2ID "table:dn2id"
64
65 #define WT_INDEX_DN "index:id2entry:dn"
66 #define WT_INDEX_NDN "index:dn2id:ndn"
67 #define WT_INDEX_PID "index:dn2id:pid"
68 /* Currently, revdn is primary key, the revdn index is obsolete. */
69 #define WT_INDEX_REVDN "index:dn2id:revdn"
70
71 /* table for cache */
72 #define WT_TABLE_IDLCACHE "table:idlcache"
73
74 #define ITEMzero(item) (memset((item), 0, sizeof(WT_ITEM)))
75 #define ITEM2bv(item,bv) ((bv)->bv_val = (item)->data, \
76 (bv)->bv_len = (item)->size)
77 #define bv2ITEM(bv,item) ((item)->data = (bv)->bv_val, \
78 (item)->size = (bv)->bv_len )
79
80 #define WT_INDEX_CACHE_SIZE 1024
81
82 typedef struct {
83 WT_SESSION *session;
84 int is_begin_transaction;
85 WT_CURSOR *dn2id;
86 WT_CURSOR *dn2id_w;
87 WT_CURSOR *dn2id_ndn;
88 WT_CURSOR *dn2entry;
89 WT_CURSOR *id2entry;
90 WT_CURSOR *id2entry_add;
91 WT_CURSOR *id2entry_update;
92 WT_SESSION *idlcache_session;
93 WT_CURSOR *index_pid;
94 } wt_ctx;
95
96 /* for the cache of attribute information (which are indexed, etc.) */
97 typedef struct wt_attrinfo {
98 AttributeDescription *ai_desc; /* attribute description cn;lang-en */
99 slap_mask_t ai_indexmask; /* how the attr is indexed */
100 slap_mask_t ai_newmask; /* new settings to replace old mask */
101 #ifdef LDAP_COMP_MATCH
102 ComponentReference* ai_cr; /*component indexing*/
103 #endif
104 } AttrInfo;
105
106 /* These flags must not clash with SLAP_INDEX flags or ops in slap.h! */
107 #define WT_INDEX_DELETING 0x8000U /* index is being modified */
108 #define WT_INDEX_UPDATE_OP 0x03 /* performing an index update */
109
110 #include "proto-wt.h"
111
112 #endif /* _BACK_WT_H_ */
113
114 /*
115 * Local variables:
116 * indent-tabs-mode: t
117 * tab-width: 4
118 * c-basic-offset: 4
119 * End:
120 */