xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-wt/proto-wt.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: proto-wt.h,v 1.2 2021/08/14 16:15:02 christos Exp $	*/
2 
3 /* OpenLDAP WiredTiger backend */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 2002-2021 The OpenLDAP Foundation.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted only as authorized by the OpenLDAP
12  * Public License.
13  *
14  * A copy of this license is available in the file LICENSE in the
15  * top-level directory of the distribution or, alternatively, at
16  * <http://www.OpenLDAP.org/license.html>.
17  */
18 /* ACKNOWLEDGEMENTS:
19  * This work was developed by HAMANO Tsukasa <hamano@osstech.co.jp>
20  * based on back-bdb for inclusion in OpenLDAP Software.
21  * WiredTiger is a product of MongoDB Inc.
22  */
23 
24 #ifndef _PROTO_WT_H_
25 #define _PROTO_WT_H_
26 
27 LDAP_BEGIN_DECL
28 
29 #define WT_UCTYPE  "WT"
30 
31 AttrInfo *wt_attr_mask( struct wt_info *wi, AttributeDescription *desc );
32 void wt_attr_flush( struct wt_info *wi );
33 
34 /*
35  * id2entry.c
36  */
37 int wt_id2entry_add(Operation *op, WT_SESSION *session, Entry *e );
38 int wt_id2entry_update(Operation *op, WT_SESSION *session, Entry *e );
39 int wt_id2entry_delete(Operation *op, WT_SESSION *session, Entry *e );
40 
41 BI_entry_release_rw wt_entry_release;
42 BI_entry_get_rw wt_entry_get;
43 
44 int wt_entry_return(Entry *e);
45 int wt_entry_release(Operation *op, Entry *e, int rw);
46 
47 /*
48  * idl.c
49  */
50 
51 unsigned wt_idl_search( ID *ids, ID id );
52 
53 ID wt_idl_first( ID *ids, ID *cursor );
54 ID wt_idl_next( ID *ids, ID *cursor );
55 
56 
57 /*
58  * index.c
59  */
60 int wt_index_entry LDAP_P(( Operation *op, wt_ctx *wc, int r, Entry *e ));
61 
62 #define wt_index_entry_add(op,t,e) \
63 	wt_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
64 #define wt_index_entry_del(op,t,e) \
65 	wt_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))
66 
67 /*
68  * key.c
69  */
70 int
71 wt_key_read( Backend *be,
72 			 WT_CURSOR *cursor,
73 			 struct berval *k,
74 			 ID *ids,
75 			 WT_CURSOR **saved_cursor,
76 			 int get_flag);
77 
78 int
79 wt_key_change( Backend *be,
80 			   WT_CURSOR *cursor,
81 			   struct berval *k,
82 			   ID id,
83 			   int op);
84 
85 /*
86  * nextid.c
87  */
88 int wt_next_id(BackendDB *be, ID *out);
89 int wt_last_id( BackendDB *be, WT_SESSION *session, ID *out );
90 
91 /*
92  * modify.c
93  */
94 int wt_modify_internal(
95 	Operation *op,
96 	wt_ctx *wc,
97 	Modifications *modlist,
98 	Entry *e,
99 	const char **text,
100 	char *textbuf,
101 	size_t textlen );
102 
103 /*
104  * config.c
105  */
106 int wt_back_init_cf( BackendInfo *bi );
107 
108 /*
109  * dn2id.c
110  */
111 
112 int
113 wt_dn2id(
114 	Operation *op,
115 	WT_SESSION *session,
116     struct berval *ndn,
117     ID *id);
118 
119 int
120 wt_dn2id_add(
121 	Operation *op,
122 	WT_SESSION *session,
123 	ID pid,
124 	Entry *e);
125 
126 int
127 wt_dn2id_delete(
128 	Operation *op,
129 	WT_SESSION *session,
130 	struct berval *ndn);
131 
132 /*
133  * dn2entry.c
134  */
135 int wt_dn2entry( BackendDB *be,
136 				 wt_ctx *wc,
137 				 struct berval *ndn,
138 				 Entry **ep );
139 
140 int wt_dn2pentry( BackendDB *be,
141 				  wt_ctx *wc,
142 				  struct berval *ndn,
143 				  Entry **ep );
144 
145 /*
146  * former ctx.c
147  */
148 wt_ctx *wt_ctx_init(struct wt_info *wi);
149 void wt_ctx_free(void *key, void *data);
150 wt_ctx *wt_ctx_get(Operation *op, struct wt_info *wi);
151 WT_CURSOR *wt_ctx_index_cursor(wt_ctx *wc, struct berval *name, int create);
152 
153 
154 /*
155  * former external.h
156  */
157 
158 extern BI_init              wt_back_initialize;
159 extern BI_db_config         wt_db_config;
160 extern BI_op_add            wt_add;
161 extern BI_op_bind           wt_bind;
162 extern BI_op_compare        wt_compare;
163 extern BI_op_delete         wt_delete;
164 extern BI_op_delete         wt_modify;
165 
166 extern BI_op_search         wt_search;
167 
168 extern BI_operational       wt_operational;
169 
170 /* tools.c */
171 extern BI_tool_entry_open    wt_tool_entry_open;
172 extern BI_tool_entry_close   wt_tool_entry_close;
173 extern BI_tool_entry_first_x wt_tool_entry_first_x;
174 extern BI_tool_entry_next    wt_tool_entry_next;
175 extern BI_tool_entry_get     wt_tool_entry_get;
176 extern BI_tool_entry_put     wt_tool_entry_put;
177 extern BI_tool_entry_reindex wt_tool_entry_reindex;
178 extern BI_tool_dn2id_get     wt_tool_dn2id_get;
179 extern BI_tool_entry_modify  wt_tool_entry_modify;
180 
181 LDAP_END_DECL
182 
183 #endif /* _PROTO_WT_H */
184 
185 /*
186  * Local variables:
187  * indent-tabs-mode: t
188  * tab-width: 4
189  * c-basic-offset: 4
190  * End:
191  */
192 
193