]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/config.c
Added bdb_attribute and bdb_group ACL support routines
[openldap] / servers / slapd / back-bdb / config.c
index b1bf856a971b6b45449be221b9d1149bf0bb4db9..c22a84723974c00de01a35760a0701867a8c9fb2 100644 (file)
@@ -1,4 +1,4 @@
-/* config.c - ldbm backend configuration file routine */
+/* config.c - bdb backend configuration file routine */
 /* $OpenLDAP$ */
 /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
@@ -42,6 +42,65 @@ bdb_db_config(
                }
                bdb->bi_dbenv_home = ch_strdup( argv[1] );
 
+
+       /* transaction checkpoint configuration */
+       } else if ( strcasecmp( argv[0], "dbnosync" ) == 0 ) {
+               bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
+
+       /* transaction checkpoint configuration */
+       } else if ( strcasecmp( argv[0], "checkpoint" ) == 0 ) {
+               if ( argc < 3 ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "missing parameters in \"checkpoint <kbyte> <min>\" line\n",
+                               fname, lineno );
+                       return 1;
+               }
+               bdb->bi_txn_cp = 1;
+               bdb->bi_txn_cp_kbyte = strtol( argv[1], NULL, 0 );
+               bdb->bi_txn_cp_min = strtol( argv[2], NULL, 0 );
+
+       /* lock detect configuration */
+       } else if ( strcasecmp( argv[0], "lockdetect" ) == 0 ) {
+#ifndef NO_THREADS
+               if ( argc < 3 ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "missing parameters in \"lockDetect <policy> <seconds>\" line\n",
+                               fname, lineno );
+                       return 1;
+               }
+
+               if( strcasecmp( argv[1], "default" ) == 0 ) {
+                       bdb->bi_lock_detect = DB_LOCK_DEFAULT;
+
+               } else if( strcasecmp( argv[1], "oldest" ) == 0 ) {
+                       bdb->bi_lock_detect = DB_LOCK_OLDEST;
+
+               } else if( strcasecmp( argv[1], "random" ) == 0 ) {
+                       bdb->bi_lock_detect = DB_LOCK_RANDOM;
+
+               } else if( strcasecmp( argv[1], "youngest" ) == 0 ) {
+                       bdb->bi_lock_detect = DB_LOCK_YOUNGEST;
+
+               } else {
+                       fprintf( stderr, "%s: line %d: "
+                               "bad policy (%s) in \"lockDetect <policy> <seconds>\" line\n",
+                               fname, lineno, argv[1] );
+                       return 1;
+               }
+
+               bdb->bi_lock_detect_seconds = strtol( argv[2], NULL, 0 );
+               if( bdb->bi_lock_detect_seconds < 1 ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "bad seconds (%s) in \"lockDetect <policy> <seconds>\" line\n",
+                               fname, lineno, argv[2] );
+                       return 1;
+               }
+#else
+               fprintf( stderr, "%s: line %d: "
+                       "NO THREADS: lockDetect line ignored\n",
+                       fname, lineno );
+#endif
+
        /* mode with which to create new database files */
        } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
                if ( argc < 2 ) {
@@ -52,7 +111,7 @@ bdb_db_config(
                }
                bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
 
-#if 0
+#if BDB_CONFIG_INDICES
        /* attribute to index */
        } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
                int rc;
@@ -67,7 +126,7 @@ bdb_db_config(
                                "line (ignored)\n",
                                fname, lineno );
                }
-               rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
+               rc = bdb_attr_index_config( bdb, fname, lineno, argc - 1, &argv[1] );
 
                if( rc != LDAP_SUCCESS ) return 1;
 #endif