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
27LDAP_BEGIN_DECL
28
29#define WT_UCTYPE  "WT"
30
31AttrInfo *wt_attr_mask( struct wt_info *wi, AttributeDescription *desc );
32void wt_attr_flush( struct wt_info *wi );
33
34/*
35 * id2entry.c
36 */
37int wt_id2entry_add(Operation *op, WT_SESSION *session, Entry *e );
38int wt_id2entry_update(Operation *op, WT_SESSION *session, Entry *e );
39int wt_id2entry_delete(Operation *op, WT_SESSION *session, Entry *e );
40
41BI_entry_release_rw wt_entry_release;
42BI_entry_get_rw wt_entry_get;
43
44int wt_entry_return(Entry *e);
45int wt_entry_release(Operation *op, Entry *e, int rw);
46
47/*
48 * idl.c
49 */
50
51unsigned wt_idl_search( ID *ids, ID id );
52
53ID wt_idl_first( ID *ids, ID *cursor );
54ID wt_idl_next( ID *ids, ID *cursor );
55
56
57/*
58 * index.c
59 */
60int 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 */
70int
71wt_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
78int
79wt_key_change( Backend *be,
80			   WT_CURSOR *cursor,
81			   struct berval *k,
82			   ID id,
83			   int op);
84
85/*
86 * nextid.c
87 */
88int wt_next_id(BackendDB *be, ID *out);
89int wt_last_id( BackendDB *be, WT_SESSION *session, ID *out );
90
91/*
92 * modify.c
93 */
94int 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 */
106int wt_back_init_cf( BackendInfo *bi );
107
108/*
109 * dn2id.c
110 */
111
112int
113wt_dn2id(
114	Operation *op,
115	WT_SESSION *session,
116    struct berval *ndn,
117    ID *id);
118
119int
120wt_dn2id_add(
121	Operation *op,
122	WT_SESSION *session,
123	ID pid,
124	Entry *e);
125
126int
127wt_dn2id_delete(
128	Operation *op,
129	WT_SESSION *session,
130	struct berval *ndn);
131
132/*
133 * dn2entry.c
134 */
135int wt_dn2entry( BackendDB *be,
136				 wt_ctx *wc,
137				 struct berval *ndn,
138				 Entry **ep );
139
140int wt_dn2pentry( BackendDB *be,
141				  wt_ctx *wc,
142				  struct berval *ndn,
143				  Entry **ep );
144
145/*
146 * former ctx.c
147 */
148wt_ctx *wt_ctx_init(struct wt_info *wi);
149void wt_ctx_free(void *key, void *data);
150wt_ctx *wt_ctx_get(Operation *op, struct wt_info *wi);
151WT_CURSOR *wt_ctx_index_cursor(wt_ctx *wc, struct berval *name, int create);
152
153
154/*
155 * former external.h
156 */
157
158extern BI_init              wt_back_initialize;
159extern BI_db_config         wt_db_config;
160extern BI_op_add            wt_add;
161extern BI_op_bind           wt_bind;
162extern BI_op_compare        wt_compare;
163extern BI_op_delete         wt_delete;
164extern BI_op_delete         wt_modify;
165
166extern BI_op_search         wt_search;
167
168extern BI_operational       wt_operational;
169
170/* tools.c */
171extern BI_tool_entry_open    wt_tool_entry_open;
172extern BI_tool_entry_close   wt_tool_entry_close;
173extern BI_tool_entry_first_x wt_tool_entry_first_x;
174extern BI_tool_entry_next    wt_tool_entry_next;
175extern BI_tool_entry_get     wt_tool_entry_get;
176extern BI_tool_entry_put     wt_tool_entry_put;
177extern BI_tool_entry_reindex wt_tool_entry_reindex;
178extern BI_tool_dn2id_get     wt_tool_dn2id_get;
179extern BI_tool_entry_modify  wt_tool_entry_modify;
180
181LDAP_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