]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/back-bdb.h
use slab memory for proxyauthz
[openldap] / servers / slapd / back-bdb / back-bdb.h
index 3f3401df5c0519e38c0d4ca091c42fe055a538a7..4405d82f50e2a796eb33a100260c300238848235 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,6 @@ LDAP_BEGIN_DECL
 
 #define DB_VERSION_FULL ((DB_VERSION_MAJOR << 24) | (DB_VERSION_MINOR << 16) | DB_VERSION_PATCH)
 
-#define BDB_SUBENTRIES 1
-
 #define DN_BASE_PREFIX         SLAP_INDEX_EQUALITY_PREFIX
 #define DN_ONE_PREFIX          '%'
 #define DN_SUBTREE_PREFIX      '@'
@@ -87,13 +85,15 @@ typedef struct bdb_entry_info {
         * that is always zero.
         */
        char bei_lockpad;
-                                               
+
        short bei_state;
 #define        CACHE_ENTRY_DELETED     1
 #define        CACHE_ENTRY_NO_KIDS     2
 #define        CACHE_ENTRY_NOT_LINKED  4
 #define CACHE_ENTRY_NO_GRANDKIDS       8
 #define        CACHE_ENTRY_LOADING     0x10
+#define        CACHE_ENTRY_WALKING     0x20
+#define        CACHE_ENTRY_ONELEVEL    0x40
 
        /*
         * remaining fields require backend cache lock to access
@@ -123,6 +123,7 @@ typedef struct bdb_entry_info {
 typedef struct bdb_cache {
        int             c_maxsize;
        int             c_cursize;
+       int             c_minfree;
        int             c_eiused;       /* EntryInfo's in use */
        int             c_leaves;       /* EntryInfo leaf nodes */
        EntryInfo       c_dntree;
@@ -131,7 +132,8 @@ typedef struct bdb_cache {
        EntryInfo       *c_lruhead;     /* lru - add accessed entries here */
        EntryInfo       *c_lrutail;     /* lru - rem lru entries from here */
        ldap_pvt_thread_rdwr_t c_rwlock;
-       ldap_pvt_thread_mutex_t lru_mutex;
+       ldap_pvt_thread_mutex_t lru_head_mutex;
+       ldap_pvt_thread_mutex_t lru_tail_mutex;
        u_int32_t       c_locker;       /* used by lru cleaner */
 #ifdef SLAP_ZONE_ALLOC
        void *c_zctx;
@@ -148,6 +150,9 @@ struct bdb_db_info {
        DB                      *bdi_db;
 };
 
+/* From ldap_rq.h */
+struct re_s;
+
 struct bdb_info {
        DB_ENV          *bi_dbenv;
 
@@ -164,7 +169,8 @@ struct bdb_info {
 
        slap_mask_t     bi_defaultmask;
        Cache           bi_cache;
-       Avlnode         *bi_attrs;
+       struct bdb_attrinfo             **bi_attrs;
+       int                     bi_nattrs;
        void            *bi_search_stack;
        int             bi_search_stack_depth;
        int             bi_linear_index;
@@ -172,8 +178,9 @@ struct bdb_info {
        int                     bi_txn_cp;
        u_int32_t       bi_txn_cp_min;
        u_int32_t       bi_txn_cp_kbyte;
-       void            *bi_txn_cp_task;
-       void            *bi_index_task;
+       struct re_s             *bi_txn_cp_task;
+       struct re_s             *bi_index_task;
+       struct re_s             *bi_cache_task;
 
        int                     bi_lock_detect;
        long            bi_shm_key;
@@ -297,6 +304,19 @@ typedef struct bdb_attrinfo {
 #define        BDB_INDEX_DELETING      0x8000U /* index is being modified */
 #define        BDB_INDEX_UPDATE_OP     0x03    /* performing an index update */
 
+/* For slapindex to record which attrs in an entry belong to which
+ * index database 
+ */
+typedef struct AttrList {
+       struct AttrList *next;
+       Attribute *attr;
+} AttrList;
+
+typedef struct IndexRec {
+       AttrInfo *ai;
+       AttrList *attrs;
+} IndexRec;
+
 #include "proto-bdb.h"
 
 #endif /* _BACK_BDB_H_ */