Home | History | Annotate | Line # | Download | only in back-wt
back-wt.h revision 1.1
      1 /*	$NetBSD: back-wt.h,v 1.1 2021/08/14 16:05:24 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 (at) 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 _BACK_WT_H_
     25 #define _BACK_WT_H_
     26 
     27 #include <portable.h>
     28 
     29 #include <ac/errno.h>
     30 #include <sys/stat.h>
     31 
     32 #include "slap.h"
     33 #include "wiredtiger.h"
     34 
     35 /* The default search IDL stack cache depth */
     36 #define DEFAULT_SEARCH_STACK_DEPTH  16
     37 
     38 struct wt_info {
     39 	WT_CONNECTION *wi_conn;
     40 	char *wi_dbenv_home;
     41 	char *wi_dbenv_config;
     42 	ID	wi_lastid;
     43 
     44 	slap_mask_t wi_defaultmask;
     45 	int         wi_nattrs;
     46 	struct wt_attrinfo **wi_attrs;
     47 	void *wi_search_stack;
     48 	int wi_search_stack_depth;
     49 
     50 	struct re_s *wi_index_task;
     51 
     52 	int wi_flags;
     53 #define WT_IS_OPEN      0x01
     54 #define WT_OPEN_INDEX   0x02
     55 #define WT_DEL_INDEX    0x08
     56 #define WT_RE_OPEN      0x10
     57 #define WT_NEED_UPGRADE 0x20
     58 };
     59 
     60 #define WT_TABLE_ID2ENTRY "table:id2entry"
     61 #define WT_TABLE_DN2ID "table:dn2id"
     62 
     63 #define WT_INDEX_DN "index:id2entry:dn"
     64 #define WT_INDEX_PID "index:dn2id:pid"
     65 #define WT_INDEX_REVDN "index:dn2id:revdn"
     66 
     67 #define ITEMzero(item) (memset((item), 0, sizeof(WT_ITEM)))
     68 #define ITEM2bv(item,bv) ((bv)->bv_val = (item)->data, \
     69 						  (bv)->bv_len = (item)->size)
     70 #define bv2ITEM(bv,item) ((item)->data = (bv)->bv_val, \
     71 						 (item)->size = (bv)->bv_len )
     72 
     73 typedef struct {
     74 	WT_SESSION *session;
     75 } wt_ctx;
     76 
     77 /* for the cache of attribute information (which are indexed, etc.) */
     78 typedef struct wt_attrinfo {
     79 	AttributeDescription *ai_desc; /* attribute description cn;lang-en */
     80 	slap_mask_t ai_indexmask;   /* how the attr is indexed  */
     81 	slap_mask_t ai_newmask; /* new settings to replace old mask */
     82 	#ifdef LDAP_COMP_MATCH
     83 	ComponentReference* ai_cr; /*component indexing*/
     84 	#endif
     85 } AttrInfo;
     86 
     87 /* These flags must not clash with SLAP_INDEX flags or ops in slap.h! */
     88 #define	WT_INDEX_DELETING	0x8000U	/* index is being modified */
     89 #define	WT_INDEX_UPDATE_OP	0x03	/* performing an index update */
     90 
     91 #include "proto-wt.h"
     92 
     93 #endif /* _BACK_WT_H_ */
     94 
     95 /*
     96  * Local variables:
     97  * indent-tabs-mode: t
     98  * tab-width: 4
     99  * c-basic-offset: 4
    100  * End:
    101  */
    102