1 1.1 christos /* $NetBSD: back-wt.h,v 1.3 2025/09/05 21:16:31 christos Exp $ */ 2 1.1 christos 3 1.1 christos /* OpenLDAP WiredTiger backend */ 4 1.1 christos /* $OpenLDAP$ */ 5 1.1 christos /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 6 1.1 christos * 7 1.3 christos * Copyright 2002-2024 The OpenLDAP Foundation. 8 1.1 christos * All rights reserved. 9 1.1 christos * 10 1.1 christos * Redistribution and use in source and binary forms, with or without 11 1.1 christos * modification, are permitted only as authorized by the OpenLDAP 12 1.1 christos * Public License. 13 1.1 christos * 14 1.1 christos * A copy of this license is available in the file LICENSE in the 15 1.1 christos * top-level directory of the distribution or, alternatively, at 16 1.1 christos * <http://www.OpenLDAP.org/license.html>. 17 1.1 christos */ 18 1.1 christos /* ACKNOWLEDGEMENTS: 19 1.1 christos * This work was developed by HAMANO Tsukasa <hamano (at) osstech.co.jp> 20 1.1 christos * based on back-bdb for inclusion in OpenLDAP Software. 21 1.1 christos * WiredTiger is a product of MongoDB Inc. 22 1.1 christos */ 23 1.1 christos 24 1.1 christos #ifndef _BACK_WT_H_ 25 1.1 christos #define _BACK_WT_H_ 26 1.1 christos 27 1.1 christos #include <portable.h> 28 1.1 christos 29 1.1 christos #include <ac/errno.h> 30 1.1 christos #include <sys/stat.h> 31 1.1 christos 32 1.1 christos #include "slap.h" 33 1.1 christos #include "wiredtiger.h" 34 1.1 christos 35 1.1 christos /* The default search IDL stack cache depth */ 36 1.1 christos #define DEFAULT_SEARCH_STACK_DEPTH 16 37 1.1 christos 38 1.3 christos #define WT_CONFIG_MAX 2048 39 1.3 christos 40 1.1 christos struct wt_info { 41 1.1 christos WT_CONNECTION *wi_conn; 42 1.3 christos WT_CONNECTION *wi_cache; 43 1.3 christos char *wi_home; 44 1.3 christos char *wi_config; 45 1.1 christos ID wi_lastid; 46 1.1 christos 47 1.1 christos slap_mask_t wi_defaultmask; 48 1.1 christos int wi_nattrs; 49 1.1 christos struct wt_attrinfo **wi_attrs; 50 1.1 christos void *wi_search_stack; 51 1.1 christos int wi_search_stack_depth; 52 1.1 christos 53 1.1 christos struct re_s *wi_index_task; 54 1.1 christos 55 1.1 christos int wi_flags; 56 1.1 christos #define WT_IS_OPEN 0x01 57 1.1 christos #define WT_OPEN_INDEX 0x02 58 1.1 christos #define WT_DEL_INDEX 0x08 59 1.1 christos #define WT_RE_OPEN 0x10 60 1.1 christos #define WT_NEED_UPGRADE 0x20 61 1.3 christos #define WT_USE_IDLCACHE 0x40 62 1.1 christos }; 63 1.1 christos 64 1.1 christos #define WT_TABLE_ID2ENTRY "table:id2entry" 65 1.1 christos #define WT_TABLE_DN2ID "table:dn2id" 66 1.1 christos 67 1.1 christos #define WT_INDEX_DN "index:id2entry:dn" 68 1.3 christos #define WT_INDEX_NDN "index:dn2id:ndn" 69 1.1 christos #define WT_INDEX_PID "index:dn2id:pid" 70 1.3 christos /* Currently, revdn is primary key, the revdn index is obsolete. */ 71 1.1 christos #define WT_INDEX_REVDN "index:dn2id:revdn" 72 1.1 christos 73 1.3 christos /* table for cache */ 74 1.3 christos #define WT_TABLE_IDLCACHE "table:idlcache" 75 1.3 christos 76 1.1 christos #define ITEMzero(item) (memset((item), 0, sizeof(WT_ITEM))) 77 1.1 christos #define ITEM2bv(item,bv) ((bv)->bv_val = (item)->data, \ 78 1.1 christos (bv)->bv_len = (item)->size) 79 1.1 christos #define bv2ITEM(bv,item) ((item)->data = (bv)->bv_val, \ 80 1.1 christos (item)->size = (bv)->bv_len ) 81 1.1 christos 82 1.3 christos #define WT_INDEX_CACHE_SIZE 1024 83 1.3 christos 84 1.1 christos typedef struct { 85 1.1 christos WT_SESSION *session; 86 1.3 christos int is_begin_transaction; 87 1.3 christos WT_CURSOR *dn2id; 88 1.3 christos WT_CURSOR *dn2id_w; 89 1.3 christos WT_CURSOR *dn2id_ndn; 90 1.3 christos WT_CURSOR *dn2entry; 91 1.3 christos WT_CURSOR *id2entry; 92 1.3 christos WT_CURSOR *id2entry_add; 93 1.3 christos WT_CURSOR *id2entry_update; 94 1.3 christos WT_SESSION *idlcache_session; 95 1.3 christos WT_CURSOR *index_pid; 96 1.1 christos } wt_ctx; 97 1.1 christos 98 1.1 christos /* for the cache of attribute information (which are indexed, etc.) */ 99 1.1 christos typedef struct wt_attrinfo { 100 1.1 christos AttributeDescription *ai_desc; /* attribute description cn;lang-en */ 101 1.1 christos slap_mask_t ai_indexmask; /* how the attr is indexed */ 102 1.1 christos slap_mask_t ai_newmask; /* new settings to replace old mask */ 103 1.1 christos #ifdef LDAP_COMP_MATCH 104 1.1 christos ComponentReference* ai_cr; /*component indexing*/ 105 1.1 christos #endif 106 1.1 christos } AttrInfo; 107 1.1 christos 108 1.1 christos /* These flags must not clash with SLAP_INDEX flags or ops in slap.h! */ 109 1.1 christos #define WT_INDEX_DELETING 0x8000U /* index is being modified */ 110 1.1 christos #define WT_INDEX_UPDATE_OP 0x03 /* performing an index update */ 111 1.1 christos 112 1.1 christos #include "proto-wt.h" 113 1.1 christos 114 1.1 christos #endif /* _BACK_WT_H_ */ 115 1.1 christos 116 1.1 christos /* 117 1.1 christos * Local variables: 118 1.1 christos * indent-tabs-mode: t 119 1.1 christos * tab-width: 4 120 1.1 christos * c-basic-offset: 4 121 1.1 christos * End: 122 1.1 christos */ 123