summaryrefslogtreecommitdiffstats
path: root/servers/slapd/back-wt/proto-wt.h
blob: 00df3fd140f11cfb2708167ce495170146754db0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/* OpenLDAP WiredTiger backend */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
 *
 * Copyright 2002-2024 The OpenLDAP Foundation.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted only as authorized by the OpenLDAP
 * Public License.
 *
 * A copy of this license is available in the file LICENSE in the
 * top-level directory of the distribution or, alternatively, at
 * <http://www.OpenLDAP.org/license.html>.
 */
/* ACKNOWLEDGEMENTS:
 * This work was developed by HAMANO Tsukasa <hamano@osstech.co.jp>
 * based on back-bdb for inclusion in OpenLDAP Software.
 * WiredTiger is a product of MongoDB Inc.
 */

#ifndef _PROTO_WT_H_
#define _PROTO_WT_H_

LDAP_BEGIN_DECL

#define WT_UCTYPE  "WT"

/*
 * attr.c
 */

AttrInfo *wt_attr_mask( struct wt_info *wi, AttributeDescription *desc );
void wt_attr_flush( struct wt_info *wi );
void wt_attr_index_unparse( struct wt_info *wi, BerVarray *bva );
int wt_attr_index_config(
	struct wt_info  *wi,
	const char      *fname,
	int         lineno,
	int         argc,
	char        **argv,
	struct      config_reply_s *c_reply);
void wt_attr_index_destroy( struct wt_info *wi );

/*
 * id2entry.c
 */
int wt_id2entry(BackendDB *be, wt_ctx *wc, ID id, Entry **ep );
int wt_id2entry_add(Operation *op, wt_ctx *wc, Entry *e );
int wt_id2entry_update(Operation *op, wt_ctx *wc, Entry *e );
int wt_id2entry_delete(Operation *op, wt_ctx *wc, Entry *e );

BI_entry_release_rw wt_entry_release;
BI_entry_get_rw wt_entry_get;

int wt_entry_return(Entry *e);
int wt_entry_release(Operation *op, Entry *e, int rw);

/*
 * idl.c
 */

unsigned wt_idl_search( ID *ids, ID id );

ID wt_idl_first( ID *ids, ID *cursor );
ID wt_idl_next( ID *ids, ID *cursor );
int wt_idl_append_one( ID *ids, ID id );
void wt_idl_sort( ID *ids, ID *tmp );
int wt_idl_intersection( ID *a, ID *b );
int wt_filter_candidates(
	Operation *op,
	wt_ctx *wc,
	Filter *f,
	ID *ids,
	ID *tmp,
	ID *stack );
int
wt_idl_union(
	ID  *a,
	ID  *b );

/*
 * index.c
 */

extern AttrInfo *
wt_index_mask LDAP_P((
	Backend *be,
	AttributeDescription *desc,
	struct berval *atname ));

int wt_index_entry LDAP_P(( Operation *op, wt_ctx *wc, int r, Entry *e ));
int wt_index_values(
	Operation *op,
	wt_ctx *wc,
	AttributeDescription *desc,
	BerVarray vals,
	ID id,
	int opid );
int wt_index_param(
	Backend *be,
	AttributeDescription *desc,
	int ftype,
	slap_mask_t *maskp,
	struct berval *prefixp );

WT_CURSOR *wt_index_open(wt_ctx *wc, struct berval *name, int create);

#define wt_index_entry_add(op,t,e) \
	wt_index_entry((op),(t),SLAP_INDEX_ADD_OP,(e))
#define wt_index_entry_del(op,t,e) \
	wt_index_entry((op),(t),SLAP_INDEX_DELETE_OP,(e))

/*
 * key.c
 */
int
wt_key_read( Backend *be,
			 WT_CURSOR *cursor,
			 struct berval *k,
			 ID *ids,
			 WT_CURSOR **saved_cursor,
			 int get_flag);

int
wt_key_change( Backend *be,
			   WT_CURSOR *cursor,
			   struct berval *k,
			   ID id,
			   int op);

/*
 * nextid.c
 */
int wt_next_id(BackendDB *be, ID *out);
int wt_last_id( BackendDB *be, WT_SESSION *session, ID *out );

/*
 * modify.c
 */
int wt_modify_internal(
	Operation *op,
	wt_ctx *wc,
	Modifications *modlist,
	Entry *e,
	const char **text,
	char *textbuf,
	size_t textlen );

/*
 * config.c
 */
int wt_back_init_cf( BackendInfo *bi );

/*
 * dn2id.c
 */

int
wt_dn2id(
	Operation *op,
	wt_ctx *wc,
    struct berval *ndn,
    ID *id);

int
wt_dn2id_add(
	Operation *op,
	wt_ctx *wc,
	ID pid,
	Entry *e);

int
wt_dn2idl(
	Operation *op,
	wt_ctx *wc,
	struct berval *ndn,
	Entry *e,
	ID *ids,
	ID *stack);

int
wt_dn2id_delete(
	Operation *op,
	wt_ctx *wc,
	struct berval *ndn);

int
wt_dn2id_has_children(
	Operation *op,
	wt_ctx *wc,
	ID id );

/*
 * dn2entry.c
 */
int wt_dn2entry( BackendDB *be,
				 wt_ctx *wc,
				 struct berval *ndn,
				 Entry **ep );

int wt_dn2pentry( BackendDB *be,
				  wt_ctx *wc,
				  struct berval *ndn,
				  Entry **ep );
int wt_dn2aentry( BackendDB *be,
				  wt_ctx *wc,
				  struct berval *ndn,
				  Entry **ep );

/*
 * former ctx.c
 */
wt_ctx *wt_ctx_init(struct wt_info *wi);
void wt_ctx_free(void *key, void *data);
wt_ctx *wt_ctx_get(Operation *op, struct wt_info *wi);

/*
 * former cache.c
 */
int wt_idlcache_get(wt_ctx *wc, struct berval *ndn, int scope, ID *ids);
int wt_idlcache_set(wt_ctx *wc, struct berval *ndn, int scope, ID *ids);
int wt_idlcache_begin(wt_ctx *wc, struct berval *ndn, int scope);
int wt_idlcache_clear(Operation *op, wt_ctx *wc, struct berval *ndn);

/*
 * former external.h
 */

extern BI_init              wt_back_initialize;
extern BI_db_config         wt_db_config;
extern BI_op_add            wt_add;
extern BI_op_bind           wt_bind;
extern BI_op_compare        wt_compare;
extern BI_op_delete         wt_delete;
extern BI_op_modify         wt_modify;
extern BI_op_modrdn         wt_modrdn;
extern BI_op_search         wt_search;
extern BI_op_extended       wt_extended;

extern BI_operational       wt_operational;
extern BI_has_subordinates  wt_hasSubordinates;

/* tools.c */
int wt_entry_header(WT_ITEM *item, EntryHeader *eh);
extern BI_tool_entry_open    wt_tool_entry_open;
extern BI_tool_entry_close   wt_tool_entry_close;
extern BI_tool_entry_first_x wt_tool_entry_first_x;
extern BI_tool_entry_next    wt_tool_entry_next;
extern BI_tool_entry_get     wt_tool_entry_get;
extern BI_tool_entry_put     wt_tool_entry_put;
extern BI_tool_entry_reindex wt_tool_entry_reindex;
extern BI_tool_dn2id_get     wt_tool_dn2id_get;
extern BI_tool_entry_modify  wt_tool_entry_modify;
extern BI_tool_entry_delete  wt_tool_entry_delete;

LDAP_END_DECL

#endif /* _PROTO_WT_H */

/*
 * Local variables:
 * indent-tabs-mode: t
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 */