]> git.sur5r.net Git - openldap/blob - servers/slapd/back-wt/back-wt.h
a9fe5e43ed732012d9e88298894e758b7ee62885
[openldap] / servers / slapd / back-wt / back-wt.h
1 /* OpenLDAP WiredTiger backend */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2002-2018 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 <hamano@osstech.co.jp>
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 struct wt_info {
37         WT_CONNECTION *wi_conn;
38         char *wi_dbenv_home;
39         char *wi_dbenv_config;
40         ID      wi_lastid;
41
42         slap_mask_t wi_defaultmask;
43         int         wi_nattrs;
44         struct wt_attrinfo **wi_attrs;
45         void *wi_search_stack;
46         int wi_search_stack_depth;
47
48         struct re_s *wi_index_task;
49
50         int wi_flags;
51 #define WT_IS_OPEN      0x01
52 #define WT_OPEN_INDEX   0x02
53 #define WT_DEL_INDEX    0x08
54 #define WT_RE_OPEN      0x10
55 #define WT_NEED_UPGRADE 0x20
56 };
57
58 #define WT_TABLE_ID2ENTRY "table:id2entry"
59 #define WT_TABLE_DN2ID "table:dn2id"
60
61 #define WT_INDEX_DN "index:id2entry:dn"
62 #define WT_INDEX_PID "index:dn2id:pid"
63 #define WT_INDEX_REVDN "index:dn2id:revdn"
64
65 #define ITEMzero(item) (memset((item), 0, sizeof(WT_ITEM)))
66 #define ITEM2bv(item,bv) ((bv)->bv_val = (item)->data, \
67                                                   (bv)->bv_len = (item)->size)
68 #define bv2ITEM(bv,item) ((item)->data = (bv)->bv_val, \
69                                                  (item)->size = (bv)->bv_len )
70
71 typedef struct {
72         WT_SESSION *session;
73 } wt_ctx;
74
75 /* for the cache of attribute information (which are indexed, etc.) */
76 typedef struct wt_attrinfo {
77         AttributeDescription *ai_desc; /* attribute description cn;lang-en */
78         slap_mask_t ai_indexmask;   /* how the attr is indexed  */
79         slap_mask_t ai_newmask; /* new settings to replace old mask */
80         #ifdef LDAP_COMP_MATCH
81         ComponentReference* ai_cr; /*component indexing*/
82         #endif
83 } AttrInfo;
84
85 /* These flags must not clash with SLAP_INDEX flags or ops in slap.h! */
86 #define WT_INDEX_DELETING       0x8000U /* index is being modified */
87 #define WT_INDEX_UPDATE_OP      0x03    /* performing an index update */
88
89 #include "proto-wt.h"
90
91 #endif /* _BACK_WT_H_ */
92
93 /*
94  * Local variables:
95  * indent-tabs-mode: t
96  * tab-width: 4
97  * c-basic-offset: 4
98  * End:
99  */